1
0

TenantAdminController.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeadmin快速开发前后端分离管理后台(PHP版)
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
  8. // | github下载:https://github.com/likeshop-github/likeadmin
  9. // | 访问官网:https://www.likeadmin.cn
  10. // | likeadmin团队 版权所有 拥有最终解释权
  11. // +----------------------------------------------------------------------
  12. // | author: likeadminTeam
  13. // +----------------------------------------------------------------------
  14. namespace app\adminapi\controller\tenant;
  15. use app\api\validate\PasswordValidate;
  16. use app\adminapi\controller\BaseAdminController;
  17. use app\adminapi\lists\tenant\TenantAdminLists;
  18. use app\adminapi\logic\tenant\TenantAdminLogic;
  19. use app\adminapi\validate\tenant\TenantAdminValidate;
  20. /**
  21. * 租户账号用户控制器
  22. * Class TenantController
  23. * @package app\adminapi\controller\user
  24. */
  25. class TenantAdminController extends BaseAdminController
  26. {
  27. /**
  28. * @notes 获取租户管理员账号 租户查询参数必传防止越权查看
  29. * @return \think\response\Json
  30. * @author yfdong
  31. * @date 2024/09/04 22:11
  32. */
  33. public function lists()
  34. {
  35. return $this->dataLists(new TenantAdminLists());
  36. }
  37. /**
  38. * @notes 获取租户管理员账号 租户id以及主键id查询参数必传 防止越权查看
  39. * @return \think\response\Json
  40. * @author yfdong
  41. * @date 2024/09/04 22:14
  42. */
  43. public function detail()
  44. {
  45. $params = (new TenantAdminValidate())->goCheck('detail');
  46. $result = TenantAdminLogic::detail($params['id']);
  47. if (false === $result) {
  48. return $this->fail(TenantAdminLogic::getError());
  49. }
  50. return $this->success('获取成功', $result);
  51. }
  52. /**
  53. * @notes 创建租户管理员账号
  54. * @return \think\response\Json
  55. * @author yfdong
  56. * @date 2024/09/04 22:58
  57. */
  58. public function add()
  59. {
  60. $params = (new TenantAdminValidate())->post()->goCheck('add');
  61. $result = TenantAdminLogic::add($params);
  62. if (true === $result) {
  63. return $this->success('操作成功', [], 1, 1);
  64. }
  65. return $this->fail(TenantAdminLogic::getError());
  66. }
  67. /**
  68. * @notes 编辑租户管理员账号
  69. * @return \think\response\Json
  70. * @author yfdong
  71. * @date 2024/09/04 22:58
  72. */
  73. public function edit()
  74. {
  75. $params = (new TenantAdminValidate())->post()->goCheck('edit');
  76. $result = TenantAdminLogic::edit($params);
  77. if (true === $result) {
  78. return $this->success('操作成功', [], 1, 1);
  79. }
  80. return $this->fail(TenantAdminLogic::getError());
  81. }
  82. /**
  83. * @notes 删除租户管理员账号
  84. * @return \think\response\Json
  85. * @author yfdong
  86. * @date 2024/09/04 22:59
  87. */
  88. public function delete()
  89. {
  90. $params = (new TenantAdminValidate())->post()->goCheck('delete');
  91. $result = TenantAdminLogic::delete($params);
  92. if (true === $result) {
  93. return $this->success('删除成功', [], 1, 1);
  94. }
  95. return $this->fail(TenantAdminLogic::getError());
  96. }
  97. }