ProductAssistSet.php 1.6 KB

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