ProductGroupBuying.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2022 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\product;
  12. use app\common\repositories\store\product\ProductGroupUserRepository;
  13. use think\App;
  14. use crmeb\basic\BaseController;
  15. use app\common\repositories\store\product\ProductGroupBuyingRepository;
  16. class ProductGroupBuying extends BaseController
  17. {
  18. protected $repository ;
  19. /**
  20. * ProductGroup constructor.
  21. * @param App $app
  22. * @param ProductGroupBuyingRepository $repository
  23. */
  24. public function __construct(App $app ,ProductGroupBuyingRepository $repository)
  25. {
  26. parent::__construct($app);
  27. $this->repository = $repository;
  28. }
  29. /**
  30. * TODO 团列表
  31. * @return \think\response\Json
  32. * @author Qinii
  33. * @day 1/12/21
  34. */
  35. public function lst()
  36. {
  37. [$page, $limit] = $this->getPage();
  38. $where = $this->request->params(['keyword','status','date','user_name']);
  39. $where['mer_id'] = $this->request->merId();
  40. $data = $this->repository->getMerchantList($where,$page,$limit);
  41. return app('json')->success($data);
  42. }
  43. /**
  44. * TODO 团成员列表
  45. * @param $id
  46. * @return \think\response\Json
  47. * @author Qinii
  48. * @day 1/12/21
  49. */
  50. public function detail($id)
  51. {
  52. [$page, $limit] = $this->getPage();
  53. if(!$this->repository->get($id))
  54. return app('json')->fail('数据不存在');
  55. $where = ['group_buying_id' => $id];
  56. $list = app()->make(ProductGroupUserRepository::class)->getAdminList($where,$page,$limit);
  57. return app('json')->success($list);
  58. }
  59. }