RoleController.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeshop100%开源免费商用商城系统
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | 商业版本务必购买商业授权,以免引起法律纠纷
  8. // | 禁止对系统程序代码以任何目的,任何形式的再发布
  9. // | gitee下载:https://gitee.com/likeshop_gitee
  10. // | github下载:https://github.com/likeshop-github
  11. // | 访问官网:https://www.likeshop.cn
  12. // | 访问社区:https://home.likeshop.cn
  13. // | 访问手册:http://doc.likeshop.cn
  14. // | 微信公众号:likeshop技术社区
  15. // | likeshop团队 版权所有 拥有最终解释权
  16. // +----------------------------------------------------------------------
  17. // | author: likeshopTeam
  18. // +----------------------------------------------------------------------
  19. namespace app\adminapi\controller\auth;
  20. use app\adminapi\{
  21. logic\auth\RoleLogic,
  22. lists\auth\RoleLists,
  23. validate\auth\RoleValidate,
  24. controller\BaseAdminController
  25. };
  26. /**
  27. * 角色控制器
  28. * Class RoleController
  29. * @package app\adminapi\controller\auth
  30. */
  31. class RoleController extends BaseAdminController
  32. {
  33. /**
  34. * @notes 查看角色列表
  35. * @return \think\response\Json
  36. * @author Tab
  37. * @date 2021/7/13 10:40
  38. */
  39. public function lists()
  40. {
  41. return $this->dataLists(new RoleLists());
  42. }
  43. /**
  44. * @notes 添加权限
  45. * @return \think\response\Json
  46. * @author cjhao
  47. * @date 2021/8/25 16:08
  48. */
  49. public function add()
  50. {
  51. $params = (new RoleValidate())->post()->goCheck('add');
  52. $res = (new RoleLogic)->add($params);
  53. if(true === $res){
  54. return $this->success('添加成功',[],1,1);
  55. }
  56. return $this->fail($res);
  57. }
  58. /**
  59. * @notes 编辑角色
  60. * @return \think\response\Json
  61. * @author Tab
  62. * @date 2021/7/13 10:52
  63. */
  64. public function edit()
  65. {
  66. $params = (new RoleValidate())->post()->goCheck('edit');
  67. $res = (new RoleLogic)->edit($params);
  68. if(true === $res){
  69. return $this->success('编辑成功',[],1,1);
  70. }
  71. return $this->fail($res);
  72. }
  73. /**
  74. * @notes 删除角色
  75. * @return \think\response\Json
  76. * @author Tab
  77. * @date 2021/7/13 10:53
  78. */
  79. public function delete()
  80. {
  81. $params = (new RoleValidate())->post()->goCheck('del');
  82. (new RoleLogic)->delete($params['id']);
  83. return $this->success('删除成功');
  84. }
  85. /**
  86. * @notes 查看角色详情
  87. * @return \think\response\Json
  88. * @author Tab
  89. * @date 2021/7/13 11:10
  90. */
  91. public function detail()
  92. {
  93. $params = (new RoleValidate())->goCheck('detail');
  94. $detail = (new RoleLogic)->detail($params['id']);
  95. return $this->data($detail);
  96. }
  97. }