12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <?php
- namespace app\admin\controller;
- use app\BaseController;
- use app\admin\logic\ActionLogic;
- use app\model\CommonModel;
- use think\exception\ValidateException;
- use think\facade\Config;
- use think\facade\Validate;
- //功能权限
- class Action extends BaseController
- {
- //获取权限列表
- public function List()
- {
- $menuid = $this->request->post('menuid', 0);
- return ActionLogic::List($menuid);
- }
- //添加权限
- public function Add()
- {
- $param = $this->request->only(['menuid','action_code','status'=>CommonModel::$status_normal], 'post');
- $val = Validate::rule(Config::get('validate_rules.actionAdd'));
- if (!$val->check($param)) throw new ValidateException($val->getError());
- return ActionLogic::Add($param);
- }
- //获取权限详情
- public function Read()
- {
- $id = $this->request->post('id/d', 0);
- return ActionLogic::Read($id);
- }
- //编辑权限
- public function Edit()
- {
- $param = $this->request->only([''], 'post');
- $val = Validate::rule(Config::get('validate_rules.'));
- if (!$val->check($param)) throw new ValidateException($val->getError());
- return ActionLogic::Edit($param);
- }
- //删除权限
- public function Delete()
- {
- $param = $this->request->only([''], 'post');
- $val = Validate::rule(Config::get('validate_rules.'));
- if (!$val->check($param)) throw new ValidateException($val->getError());
- return ActionLogic::Delete($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 ActionLogic::Status($param);
- }
- }
|