UserController.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 edit()
  56. {
  57. $params = (new UserValidate())->post()->goCheck('setInfo');
  58. UserLogic::setUserInfo($params);
  59. return $this->success('操作成功', [], 1, 1);
  60. }
  61. /**
  62. * @notes 调整用户余额
  63. * @return \think\response\Json
  64. * @author 段誉
  65. * @date 2023/2/23 14:33
  66. */
  67. public function adjustMoney()
  68. {
  69. $params = (new AdjustUserMoney())->post()->goCheck();
  70. $res = UserLogic::adjustUserMoney($params);
  71. if (true === $res) {
  72. return $this->success('操作成功', [], 1, 1);
  73. }
  74. return $this->fail($res);
  75. }
  76. }