12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <?php
- namespace app\admin\controller;
- use app\admin\logic\ThemeLogic;
- use app\BaseController;
- use think\exception\ValidateException;
- use think\facade\Config;
- use think\facade\Validate;
- //手机主题
- class Theme extends BaseController
- {
- //列表
- public function list()
- {
- $param = $this->request->only(['page' => 1, 'size' => 10, 'company_title' => '', 'card_title' => '', 'status' => ''], 'post');
- return ThemeLogic::list($param);
- }
- //添加
- public function add()
- {
- $param = $this->request->only([
- 'group_id',
- 'code',
- 'modular',
- ], 'post');
- $val = Validate::rule(Config::get('validate_rules.ThemeAdd'));
- if (!$val->check($param)) throw new ValidateException($val->getError());
- return ThemeLogic::add($param);
- }
- //详情
- public function read()
- {
- $id = $this->request->post('id/d', 0);
- return ThemeLogic::read($id);
- }
- //修改
- public function edit()
- {
- $param = $this->request->only([
- 'id',
- 'group_id',
- 'code',
- 'modular',
- ], 'post');
- $val = Validate::rule(array_merge(Config::get('validate_rules.ThemeAdd'), ['id|主题id' => 'require|number|gt:0']));
- if (!$val->check($param)) throw new ValidateException($val->getError());
- return ThemeLogic::edit($param);
- }
- //启禁用
- public function status()
- {
- $param = $this->request->only(['id', 'status'], 'post');
- $val = Validate::rule(Config::get('validate_rules.status'));
- if (!$val->check($param)) throw new ValidateException($val->getError());
- return ThemeLogic::status($param);
- }
- }
|