1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?php
- namespace app\admin\controller;
- use app\admin\logic\CardLogic;
- use app\BaseController;
- use think\exception\ValidateException;
- use think\facade\Config;
- use think\facade\Validate;
- class Card extends BaseController
- {
- //获取卡类型列表
- public function cardList()
- {
- $param = $this->request->only(['page' => 1, 'size' => 10, 'status' => '', 'title' => '',], 'post');
- $val = Validate::rule(Config::get('validate_rules.common'));
- if (!$val->check($param)) throw new ValidateException($val->getError());
- return CardLogic::cardList($param);
- }
- //添加卡类型
- public function cardAdd()
- {
- $param = $this->request->only(['title'], 'post');
- $val = Validate::rule(Config::get('validate_rules.cardAdd'));
- if (!$val->check($param)) throw new ValidateException($val->getError());
- return CardLogic::cardAdd($param);
- }
- //获取卡类型详情
- public function cardRead()
- {
- $id = $this->request->post('id/d',0);
- return CardLogic::cardRead($id);
- }
- //编辑卡类型
- public function cardEdit()
- {
- $param = $this->request->only(['id','title'], 'post');
- $val = Validate::rule(Config::get('validate_rules.cardEdit'));
- if (!$val->check($param)) throw new ValidateException($val->getError());
- return CardLogic::cardEdit($param);
- }
- //卡类型启禁用
- public function cardChange()
- {
- $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 CardLogic::cardChange($param);
- }
- //删除卡类型
- public function cardDelete()
- {
- $id = $this->request->post('id/d',0);
- return CardLogic::cardDelete($id);
- }
- }
|