UserBill.php 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. }