ProductAssistSet.php 2.2 KB

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