CouponSend.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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\store\coupon;
  12. use app\common\repositories\store\coupon\StoreCouponSendRepository;
  13. use crmeb\basic\BaseController;
  14. use think\App;
  15. class CouponSend extends BaseController
  16. {
  17. protected $repository;
  18. /**
  19. * 构造函数
  20. *
  21. * @param App $app 应用实例
  22. * @param StoreCouponSendRepository $repository 优惠券发放记录仓库实例
  23. */
  24. public function __construct(App $app, StoreCouponSendRepository $repository)
  25. {
  26. // 调用父类构造函数
  27. parent::__construct($app);
  28. // 初始化仓库实例
  29. $this->repository = $repository;
  30. }
  31. /**
  32. * 获取优惠券发放记录列表
  33. *
  34. * @return \think\response\Json
  35. */
  36. public function lst()
  37. {
  38. // 获取分页参数
  39. [$page, $limit] = $this->getPage();
  40. // 获取查询条件
  41. $where = $this->request->params(['date', 'coupon_type', 'coupon_name', 'status']);
  42. // 添加商家ID查询条件
  43. $where['mer_id'] = $this->request->merId();
  44. // 调用仓库实例的获取列表方法并返回结果
  45. return app('json')->success($this->repository->getList($where, $page, $limit));
  46. }
  47. }