StoreProductGroupBuying.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace app\controller\admin\store;
  3. use app\common\repositories\store\product\ProductGroupBuyingRepository;
  4. use app\common\repositories\store\product\ProductGroupUserRepository;
  5. use ln\basic\BaseController;
  6. use think\App;
  7. class StoreProductGroupBuying extends BaseController
  8. {
  9. protected $repository;
  10. /**
  11. * Product 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','mer_id','is_trader','user_name']);
  30. $data = $this->repository->getAdminList($where,$page,$limit);
  31. return app('json')->success($data);
  32. }
  33. /**
  34. * TODO 团成员列表
  35. * @param $id
  36. * @return \think\response\Json
  37. * @author Qinii
  38. * @day 1/12/21
  39. */
  40. public function detail($id)
  41. {
  42. [$page, $limit] = $this->getPage();
  43. if(!$this->repository->get($id))
  44. return app('json')->fail('数据不存在');
  45. $where = ['group_buying_id' => $id];
  46. $list = app()->make(ProductGroupUserRepository::class)->getAdminList($where,$page,$limit);
  47. return app('json')->success($list);
  48. }
  49. }