UserBill.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\controller\admin\user;
  12. use app\common\repositories\store\ExcelRepository;
  13. use crmeb\basic\BaseController;
  14. use app\common\repositories\user\UserBillRepository;
  15. use crmeb\services\ExcelService;
  16. use think\App;
  17. /**
  18. * Class UserBill
  19. * app\controller\admin\user
  20. * 用户余额记录
  21. */
  22. class UserBill extends BaseController
  23. {
  24. protected $repository;
  25. public function __construct(App $app, UserBillRepository $repository)
  26. {
  27. parent::__construct($app);
  28. $this->repository = $repository;
  29. }
  30. /**
  31. * 用户余额相关记录
  32. * @return \think\response\Json
  33. * @author Qinii
  34. * @day 2023/10/16
  35. */
  36. public function getList()
  37. {
  38. [$page, $limit] = $this->getPage();
  39. $where = $this->request->params(['keyword', 'date', 'type','uid','phone','real_name','nickname']);
  40. $where['category'] = [$this->repository::CATEGORY_NOW_MONEY,$this->repository::CATEGORY_SVIP_PAY];
  41. return app('json')->success($this->repository->getList($where, $page, $limit));
  42. }
  43. /**
  44. * 用户等级成长值记录
  45. * @return \think\response\Json
  46. * @author Qinii
  47. * @day 2023/10/16
  48. */
  49. public function getMembers()
  50. {
  51. [$page, $limit] = $this->getPage();
  52. $where = $this->request->params(['keyword', 'date', 'type', ['category', $this->repository::CATEGORY_SYS_MEMBERS], 'uid']);
  53. return app('json')->success($this->repository->getList($where, $page, $limit));
  54. }
  55. /**
  56. * 获取记录类型 - 用于下啦筛选
  57. * @return \think\response\Json
  58. * @author Qinii
  59. * @day 2023/10/16
  60. */
  61. public function type()
  62. {
  63. $category = $this->request->param('category', $this->repository::CATEGORY_NOW_MONEY);
  64. return app('json')->success($this->repository->type($category));
  65. }
  66. /**
  67. * 导出
  68. * @return \think\response\Json
  69. * @author Qinii
  70. * @day 2023/10/16
  71. */
  72. public function export()
  73. {
  74. $where = $this->request->params(['keyword', 'date', 'type']);
  75. [$page, $limit] = $this->getPage();
  76. $data = app()->make(ExcelService::class)->bill($where, $page, $limit);
  77. return app('json')->success($data);
  78. }
  79. public function brokerage_list()
  80. {
  81. [$page, $limit] = $this->getPage();
  82. $where = $this->request->params(['keyword', 'date', 'type','uid','phone','real_name','nickname']);
  83. $where['category'] = [$this->repository::CATEGORY_BROKERAGE];
  84. return app('json')->success($this->repository->getList($where, $page, $limit));
  85. }
  86. // 分红积分记录
  87. public function award_integral_list(){
  88. [$page, $limit] = $this->getPage();
  89. $where = $this->request->params(['keyword', 'date', 'type','uid','phone','real_name','nickname']);
  90. $where['category'] = [$this->repository::CATEGORY_AWARD_INTEGRAL];
  91. return app('json')->success($this->repository->getList($where, $page, $limit));
  92. }
  93. // 分红份额记录
  94. public function award_range_list(){
  95. [$page, $limit] = $this->getPage();
  96. $where = $this->request->params(['keyword', 'date', 'type','uid','phone','real_name','nickname']);
  97. $where['category'] = [$this->repository::CATEGORY_AWARD_RANGE];
  98. return app('json')->success($this->repository->getList($where, $page, $limit));
  99. }
  100. }