UserController.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\api\controller\pc;
  12. use app\Request;
  13. use app\services\pc\UserServices;
  14. use app\services\user\UserBrokerageServices;
  15. use app\services\user\UserMoneyServices;
  16. class UserController
  17. {
  18. protected $services;
  19. public function __construct(UserServices $services)
  20. {
  21. $this->services = $services;
  22. }
  23. /**
  24. * 用户资金记录明细
  25. * @param Request $request
  26. * @param $type 0 全部 1 消费 2 充值 3 返佣 4 提现
  27. * @return mixed
  28. */
  29. public function getBalanceRecord(Request $request, $type)
  30. {
  31. $uid = (int)$request->uid();
  32. $data = [];
  33. switch ($type) {
  34. case 0:
  35. case 1:
  36. case 2:
  37. /** @var UserMoneyServices $moneyService */
  38. $moneyService = app()->make(UserMoneyServices::class);
  39. $data = $moneyService->getMoneyList($uid, $type);
  40. break;
  41. case 3:
  42. case 4:
  43. /** @var UserBrokerageServices $brokerageService */
  44. $brokerageService = app()->make(UserBrokerageServices::class);
  45. $data = $brokerageService->getBrokerageList($uid, $type);
  46. break;
  47. }
  48. return app('json')->success($data);
  49. }
  50. /**
  51. * 获取收藏列表
  52. * @param Request $request
  53. * @return mixed
  54. */
  55. public function getCollectList(Request $request)
  56. {
  57. $uid = (int)$request->uid();
  58. return app('json')->success($this->services->getCollectList($uid));
  59. }
  60. }