You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
yanzong/app/admin/controller/RetailDescribe.php

63 lines
2.3 KiB

5 months ago
<?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;
4 months ago
use app\common\enum\RetailDescribeEnum;
5 months ago
class RetailDescribe extends Controller
{
public function index()
{
$model = new retDescribeModel;
5 months ago
$where = $this->request->get();
4 months ago
$list = $model->getList($where)->toArray();
foreach($list['data'] as &$item){
$item['plate_name'] = RetailDescribeEnum::$version[$item['plate_id']]??'';
}
5 months ago
return $this->renderSuccess(compact('list'));
5 months ago
}
public function add(){
$model = new retDescribeModel;
4 months ago
if($model->add($this->postForm())){
5 months ago
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() ?: '删除失败');
}
4 months ago
public function getPlate(){
$list1 = RetailDescribeEnum::$version;
$list = [];
foreach($list1 as $key => $value){
$list[] = ['id' => $key, 'name' => $value];
};
return $this->renderSuccess(compact('list'));
}
5 months ago
}