dataLists(new RoleLists()); } /** * @notes 添加权限 * @return \think\response\Json * @author 段誉 * @date 2021/12/29 11:49 */ public function add() { $params = (new RoleValidate())->post()->goCheck('add'); $res = RoleLogic::add($params); if (true === $res) { return $this->success('添加成功', [], 1, 1); } return $this->fail(RoleLogic::getError()); } /** * @notes 编辑角色 * @return \think\response\Json * @author 段誉 * @date 2021/12/29 14:18 */ public function edit() { $params = (new RoleValidate())->post()->goCheck('edit'); $res = RoleLogic::edit($params); if (true === $res) { return $this->success('编辑成功', [], 1, 1); } return $this->fail(RoleLogic::getError()); } /** * @notes 删除角色 * @return \think\response\Json * @author 段誉 * @date 2021/12/29 14:18 */ public function delete() { $params = (new RoleValidate())->post()->goCheck('del'); RoleLogic::delete($params['id']); return $this->success('删除成功', [], 1, 1); } /** * @notes 查看角色详情 * @return \think\response\Json * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author 段誉 * @date 2021/12/29 14:18 */ public function detail() { $params = (new RoleValidate())->goCheck('detail'); $detail = RoleLogic::detail($params['id']); return $this->data($detail); } /** * @notes 获取角色数据 * @return \think\response\Json * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author 段誉 * @date 2022/10/13 10:39 */ public function all() { $result = RoleLogic::getAllData(); return $this->data($result); } }