UserController.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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\user;
  15. use app\adminapi\controller\BaseAdminController;
  16. use app\adminapi\lists\user\UserLists;
  17. use app\adminapi\logic\user\UserLogic;
  18. use app\adminapi\validate\user\AdjustUserMoney;
  19. use app\adminapi\validate\user\UserValidate;
  20. /**
  21. * 用户控制器
  22. * Class UserController
  23. * @package app\adminapi\controller\user
  24. */
  25. class UserController extends BaseAdminController
  26. {
  27. /**
  28. * @notes 用户列表
  29. * @return \think\response\Json
  30. * @author 段誉
  31. * @date 2022/9/22 16:16
  32. */
  33. public function lists()
  34. {
  35. return $this->dataLists(new UserLists());
  36. }
  37. /**
  38. * @notes 获取用户详情
  39. * @return \think\response\Json
  40. * @author 段誉
  41. * @date 2022/9/22 16:34
  42. */
  43. public function detail()
  44. {
  45. $params = (new UserValidate())->goCheck('detail');
  46. $detail = UserLogic::detail($params['id']);
  47. return $this->success('', $detail);
  48. }
  49. /**
  50. * @notes 新增用户信息
  51. * @return \think\response\Json
  52. * @author 段誉
  53. * @date 2022/9/22 16:34
  54. */
  55. public function add()
  56. {
  57. $params = (new UserValidate())->post()->goCheck('addInfo');
  58. UserLogic::addUserInfo($params);
  59. return $this->success('新增成功', [], 1, 1);
  60. }
  61. /**
  62. * @notes 编辑用户信息
  63. * @return \think\response\Json
  64. * @author 段誉
  65. * @date 2022/9/22 16:34
  66. */
  67. public function edit()
  68. {
  69. $params = (new UserValidate())->post()->goCheck('setInfo');
  70. UserLogic::setUserInfo($params);
  71. return $this->success('操作成功', [], 1, 1);
  72. }
  73. /**
  74. * @notes 新增用户信息
  75. * @return \think\response\Json
  76. * @author 段誉
  77. * @date 2022/9/22 16:34
  78. */
  79. public function delete()
  80. {
  81. $params = (new UserValidate())->post()->goCheck('delete');
  82. UserLogic::deleteUserInfo($params);
  83. return $this->success('删除成功', [], 1, 1);
  84. }
  85. /**
  86. * @notes 调整用户余额
  87. * @return \think\response\Json
  88. * @author 段誉
  89. * @date 2023/2/23 14:33
  90. */
  91. public function adjustMoney()
  92. {
  93. $params = (new AdjustUserMoney())->post()->goCheck();
  94. $res = UserLogic::adjustUserMoney($params);
  95. if (true === $res) {
  96. return $this->success('操作成功', [], 1, 1);
  97. }
  98. return $this->fail($res);
  99. }
  100. }