Finance.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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\adminapi\controller\v1\finance;
  12. use app\services\user\UserBillServices;
  13. use app\services\user\UserBrokerageServices;
  14. use think\facade\App;
  15. use app\adminapi\controller\AuthController;
  16. /**
  17. * Class Finance
  18. * @package app\adminapi\controller\v1\finance
  19. */
  20. class Finance extends AuthController
  21. {
  22. /**
  23. * Finance constructor.
  24. * @param App $app
  25. * @param UserBillServices $services
  26. */
  27. public function __construct(App $app, UserBillServices $services)
  28. {
  29. parent::__construct($app);
  30. $this->services = $services;
  31. }
  32. /**
  33. * 筛选类型
  34. */
  35. public function bill_type()
  36. {
  37. return app('json')->success($this->services->bill_type());
  38. }
  39. /**
  40. * 资金记录
  41. */
  42. public function list()
  43. {
  44. $where = $this->request->getMore([
  45. ['start_time', ''],
  46. ['end_time', ''],
  47. ['nickname', ''],
  48. ['limit', 20],
  49. ['page', 1],
  50. ['type', ''],
  51. ]);
  52. return app('json')->success($this->services->getBillList($where));
  53. }
  54. /**
  55. * 佣金记录
  56. * @return mixed
  57. */
  58. public function get_commission_list()
  59. {
  60. $where = $this->request->getMore([
  61. ['nickname', ''],
  62. ['price_max', ''],
  63. ['price_min', ''],
  64. ['sum_number', 'normal'],
  65. ['brokerage_price', 'normal'],
  66. ['time', '']
  67. ]);
  68. return app('json')->success($this->services->getCommissionList($where));
  69. }
  70. /**
  71. * 佣金详情用户信息
  72. * @param $id
  73. * @return mixed
  74. */
  75. public function user_info($id)
  76. {
  77. return app('json')->success($this->services->user_info((int)$id));
  78. }
  79. /**
  80. * 佣金提现记录个人列表
  81. */
  82. public function get_extract_list($id = '')
  83. {
  84. if ($id == '') return app('json')->fail(100100);
  85. $where = $this->request->getMore([
  86. ['start_time', ''],
  87. ['end_time', ''],
  88. ['nickname', '']
  89. ]);
  90. $where['category'] = 'now_money';
  91. $where['type'] = ['brokerage', 'brokerage_user'];
  92. return app('json')->success($this->services->getBillOneList((int)$id, $where));
  93. }
  94. /**
  95. * 获取用户佣金列表
  96. * @param UserBrokerageServices $services
  97. * @param string $id
  98. * @return mixed
  99. */
  100. public function getUserBrokeragelist(UserBrokerageServices $services, $id = '')
  101. {
  102. if ($id == '') return app('json')->fail('缺少参数');
  103. $where = $this->request->getMore([
  104. ['start_time', ''],
  105. ['end_time', ''],
  106. ['nickname', '']
  107. ]);
  108. $where['uid'] = (int)$id;
  109. return app('json')->success($services->getBrokerageListNew($where));
  110. }
  111. /**
  112. * 获取佣金记录完整列表(包含user信息)
  113. * @param UserBrokerageServices $services
  114. * @return mixed
  115. */
  116. public function getBrokerageListFull(UserBrokerageServices $services)
  117. {
  118. $where = $this->request->getMore([
  119. ['start_time', ''],
  120. ['end_time', ''],
  121. ['nickname', ''],
  122. ['uid', ''],
  123. ['pm', ''],
  124. ['limit', 20],
  125. ['page', 1]
  126. ]);
  127. return app('json')->success($services->getBrokerageListFull($where));
  128. }
  129. }