UserIntegral.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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\merchant\user;
  12. use app\common\repositories\store\coupon\StoreCouponUserRepository;
  13. use app\common\repositories\store\order\StoreOrderRepository;
  14. use app\common\repositories\user\UserBillRepository;
  15. use app\common\repositories\user\UserLabelRepository;
  16. use app\common\repositories\user\UserMerchantRepository;
  17. use crmeb\basic\BaseController;
  18. use FormBuilder\Exception\FormBuilderException;
  19. use think\App;
  20. use think\db\exception\DataNotFoundException;
  21. use think\db\exception\DbException;
  22. use think\db\exception\ModelNotFoundException;
  23. /**
  24. * Class UserMerchant
  25. * @package app\controller\merchant\user
  26. * @author xaboy
  27. * @day 2020/10/20
  28. */
  29. class UserIntegral extends BaseController
  30. {
  31. protected $repository;
  32. public function __construct(App $app, UserBillRepository $repository)
  33. {
  34. parent::__construct($app);
  35. $this->repository = $repository;
  36. }
  37. /**
  38. * 积分日志
  39. * @return \think\response\Json
  40. * @author Qinii
  41. * @day 6/9/21
  42. */
  43. public function getList()
  44. {
  45. [$page, $limit] = $this->getPage();
  46. $where = $this->request->params(['keyword', 'date']);
  47. $where['category'] = 'mer_integral';
  48. $where['mer_id'] = $this->request->merId();
  49. return app('json')->success($this->repository->getList($where, $page, $limit));
  50. }
  51. /**
  52. * 获取标题
  53. *
  54. * @return mixed
  55. */
  56. public function getTitle()
  57. {
  58. // 调用 json 服务的 success 方法,传入 repository 的 getStat 方法和 request 的 merId 方法的返回值作为参数
  59. return app('json')->success($this->repository->getStat($this->request->merId()));
  60. }
  61. }