lszyh
parent
9d2a1422aa
commit
52e8b7baa9
@ -0,0 +1,53 @@ |
||||
<?php |
||||
// +---------------------------------------------------------------------- |
||||
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ] |
||||
// +---------------------------------------------------------------------- |
||||
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved. |
||||
// +---------------------------------------------------------------------- |
||||
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行 |
||||
// +---------------------------------------------------------------------- |
||||
// | Author: 萤火科技 <admin@yiovo.com> |
||||
// +---------------------------------------------------------------------- |
||||
declare (strict_types=1); |
||||
|
||||
namespace app\admin\controller; |
||||
use app\store\model\RetailDescribe as retDescribeModel; |
||||
|
||||
class RetailDescribe extends Controller |
||||
{ |
||||
public function index() |
||||
{ |
||||
$model = new retDescribeModel; |
||||
$list = $model->getAll(); |
||||
$grouped = []; |
||||
foreach ($list as $item) { |
||||
$grouped[$item['plate_id']][] = $item; |
||||
} |
||||
return $this->renderSuccess(compact('grouped')); |
||||
} |
||||
|
||||
public function add(){ |
||||
$model = new retDescribeModel; |
||||
if($model->add($this->postData())){ |
||||
return $this->renderSuccess('添加成功'); |
||||
} |
||||
return $this->renderError($model->getError() ?: '添加失败'); |
||||
} |
||||
|
||||
public function edit(int $id){ |
||||
$model = new retDescribeModel; |
||||
if($model->edit($id,$this->postForm())){ |
||||
return $this->renderSuccess('编辑成功'); |
||||
} |
||||
return $this->renderError($model->getError() ?: '编辑失败'); |
||||
} |
||||
|
||||
public function delete(array $id){ |
||||
$model = new retDescribeModel; |
||||
if($model->del($id)){ |
||||
return $this->renderSuccess('删除成功'); |
||||
} |
||||
return $this->renderError($model->getError() ?: '删除失败'); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,40 @@ |
||||
<?php |
||||
// +---------------------------------------------------------------------- |
||||
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ] |
||||
// +---------------------------------------------------------------------- |
||||
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved. |
||||
// +---------------------------------------------------------------------- |
||||
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行 |
||||
// +---------------------------------------------------------------------- |
||||
// | Author: 萤火科技 <admin@yiovo.com> |
||||
// +---------------------------------------------------------------------- |
||||
declare (strict_types=1); |
||||
|
||||
namespace app\store\model; |
||||
|
||||
use app\common\model\RetailDescribe as retDescribeModel; |
||||
|
||||
class RetailDescribe extends RetDescribeModel |
||||
{ |
||||
|
||||
public function getAll() |
||||
{ |
||||
|
||||
return self::select(); |
||||
} |
||||
|
||||
public function detail(int $id){ |
||||
return self::where('id',$id)->find(); |
||||
} |
||||
|
||||
public function add(array $data){ |
||||
return $this->save($data); |
||||
} |
||||
public function edit(int $id ,array $data){ |
||||
return $this->where('id' ,$id)->update($data); |
||||
} |
||||
|
||||
public function del(array $id){ |
||||
return $this->whereIn('id' ,$id)->delete(); |
||||
} |
||||
} |
Loading…
Reference in new issue