ProductGroupBuying.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. namespace app\controller\merchant\store\product;
  3. use app\common\repositories\store\product\ProductGroupUserRepository;
  4. use think\App;
  5. use ln\basic\BaseController;
  6. use app\common\repositories\store\product\ProductGroupBuyingRepository;
  7. class ProductGroupBuying extends BaseController
  8. {
  9. protected $repository ;
  10. /**
  11. * ProductGroup constructor.
  12. * @param App $app
  13. * @param ProductGroupBuyingRepository $repository
  14. */
  15. public function __construct(App $app ,ProductGroupBuyingRepository $repository)
  16. {
  17. parent::__construct($app);
  18. $this->repository = $repository;
  19. }
  20. /**
  21. * TODO 团列表
  22. * @return \think\response\Json
  23. * @author Qinii
  24. * @day 1/12/21
  25. */
  26. public function lst()
  27. {
  28. [$page, $limit] = $this->getPage();
  29. $where = $this->request->params(['keyword','status','date','user_name']);
  30. $where['mer_id'] = $this->request->merId();
  31. $data = $this->repository->getMerchantList($where,$page,$limit);
  32. return app('json')->success($data);
  33. }
  34. /**
  35. * TODO 团成员列表
  36. * @param $id
  37. * @return \think\response\Json
  38. * @author Qinii
  39. * @day 1/12/21
  40. */
  41. public function detail($id)
  42. {
  43. [$page, $limit] = $this->getPage();
  44. if(!$this->repository->get($id))
  45. return app('json')->fail('数据不存在');
  46. $where = ['group_buying_id' => $id];
  47. $list = app()->make(ProductGroupUserRepository::class)->getAdminList($where,$page,$limit);
  48. return app('json')->success($list);
  49. }
  50. }