UserController.php 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  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\user;
  20. use app\adminapi\{lists\user\SelectUserLists,
  21. lists\user\UserFansLists,
  22. lists\user\UserInviterLists,
  23. logic\user\UserLogic,
  24. validate\user\UserValidate,
  25. validate\user\adjustUserWallet,
  26. controller\BaseAdminController};
  27. /**
  28. * 用户控制器
  29. * Class UserController
  30. * @package app\adminapi\controller\user
  31. */
  32. class UserController extends BaseAdminController
  33. {
  34. /**
  35. * @notes 用户概况
  36. * @return \think\response\Json
  37. * @author cjhao
  38. * @date 2021/8/17 14:59
  39. */
  40. public function index()
  41. {
  42. $data = (new UserLogic)->index();
  43. return $this->success('', $data);
  44. }
  45. /**
  46. * @notes 用户列表
  47. * @return \think\response\Json
  48. * @author cjhao
  49. * @date 2021/8/10 16:49
  50. */
  51. public function lists()
  52. {
  53. return $this->dataLists();
  54. }
  55. /**
  56. * @notes 用户搜索条件列表
  57. * @author cjhao
  58. * @date 2021/8/10 16:49
  59. */
  60. public function otherList()
  61. {
  62. return $this->success('', (new UserLogic())->otherLists());
  63. }
  64. /**
  65. * @notes 批量设置标签
  66. * @return \think\response\Json
  67. * @author cjhao
  68. * @date 2021/8/16 15:54
  69. */
  70. public function setLabel()
  71. {
  72. $params = (new UserValidate())->post()->goCheck('setLabel');
  73. (new UserLogic)->setLabel($params);
  74. return $this->success('设置成功', [], 1, 1);
  75. }
  76. /**
  77. * @notes 用户详情
  78. * @return \think\response\Json
  79. * @throws \think\db\exception\DataNotFoundException
  80. * @throws \think\db\exception\DbException
  81. * @throws \think\db\exception\ModelNotFoundException
  82. * @author cjhao
  83. * @date 2021/8/18 16:27
  84. */
  85. public function detail()
  86. {
  87. $params = (new UserValidate())->goCheck('detail');
  88. $detail = (new UserLogic)->detail($params['user_id']);
  89. return $this->success('', $detail);
  90. }
  91. /**
  92. * @notes 设置用户信息
  93. * @return \think\response\Json
  94. * @author cjhao
  95. * @date 2021/8/18 18:07
  96. */
  97. public function setInfo()
  98. {
  99. $params = (new UserValidate())->post()->goCheck('setInfo');
  100. (new UserLogic)->setUserInfo($params);
  101. return $this->success('更新成功', [], 1, 1);
  102. }
  103. /**
  104. * @notes 设置用户标签
  105. * @return \think\response\Json
  106. * @author cjhao
  107. * @date 2021/8/19 11:14
  108. */
  109. public function setUserLabel()
  110. {
  111. $params = (new UserValidate())->post()->goCheck('setUserLabel');
  112. (new UserLogic)->setUserLabel($params);
  113. return $this->success('更新成功', [], 1, 1);
  114. }
  115. /**
  116. * @notes 调整用户钱包
  117. * @return \think\response\Json
  118. * @author cjhao
  119. * @date 2021/9/10 18:15
  120. */
  121. public function adjustUserWallet()
  122. {
  123. $params = (new adjustUserWallet())->post()->goCheck();
  124. $res = (new UserLogic)->adjustUserWallet($params);
  125. if(true === $res){
  126. return $this->success('调整成功', [], 1, 1);
  127. }
  128. return $this->fail($res);
  129. }
  130. /**
  131. * @notes 粉丝列表
  132. * @return \think\response\Json
  133. * @throws \think\db\exception\DataNotFoundException
  134. * @throws \think\db\exception\DbException
  135. * @throws \think\db\exception\ModelNotFoundException
  136. * @author cjhao
  137. * @date 2021/9/11 10:38
  138. */
  139. public function getFans()
  140. {
  141. (new UserValidate())->goCheck('fans');
  142. return $this->dataLists(new UserFansLists());
  143. }
  144. /**
  145. * @notes 用户信息
  146. * @return \think\response\Json
  147. * @author Tab
  148. * @date 2021/9/13 19:32
  149. */
  150. public function info()
  151. {
  152. $params = (new UserValidate())->goCheck('info');
  153. $data = UserLogic::info($params);
  154. return $this->data($data);
  155. }
  156. /**
  157. * @notes 我邀请的人
  158. * @return \think\response\Json
  159. * @author Tab
  160. * @date 2021/9/14 9:40
  161. */
  162. public function userInviterLists()
  163. {
  164. $params = (new UserValidate())->goCheck('userInviterLists');
  165. return $this->dataLists(new UserInviterLists());
  166. }
  167. /**
  168. * @notes 上级分销商调整信息
  169. * @return \think\response\Json
  170. * @author Tab
  171. * @date 2021/9/14 10:50
  172. */
  173. public function adjustFirstLeaderInfo()
  174. {
  175. $params = (new UserValidate())->goCheck('adjustFirstLeaderInfo');
  176. $result = UserLogic::adjustFirstLeaderInfo($params);
  177. return $this->data($result);
  178. }
  179. /**
  180. * @notes 选择用户列表
  181. * @return \think\response\Json
  182. * @author Tab
  183. * @date 2021/9/14 10:55
  184. */
  185. public function selectUserLists()
  186. {
  187. return $this->dataLists(new SelectUserLists());
  188. }
  189. /**
  190. * @notes 调整上级分销商
  191. * @return \think\response\Json
  192. * @author Tab
  193. * @date 2021/9/14 11:42
  194. */
  195. public function adjustFirstLeader()
  196. {
  197. $params = (new UserValidate())->post()->goCheck('adjustFirstLeader');
  198. $result = UserLogic::adjustFirstLeader($params);
  199. if ($result) {
  200. return $this->success('调整成功', [], 1, 1);
  201. }
  202. return $this->fail(UserLogic::getError());
  203. }
  204. }