StoreProductPresell.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace app\controller\api\store\product;
  3. use app\common\repositories\system\CacheRepository;
  4. use think\App;
  5. use ln\basic\BaseController;
  6. use app\common\repositories\store\product\ProductPresellRepository;
  7. class StoreProductPresell extends BaseController
  8. {
  9. protected $repository;
  10. protected $userInfo;
  11. /**
  12. * StoreProductPresell constructor.
  13. * @param App $app
  14. * @param repository $repository
  15. */
  16. public function __construct(App $app, ProductPresellRepository $repository)
  17. {
  18. parent::__construct($app);
  19. $this->repository = $repository;
  20. $this->userInfo = $this->request->isLogin() ? $this->request->userInfo() : null;
  21. }
  22. public function lst()
  23. {
  24. [$page, $limit] = $this->getPage();
  25. $where = $this->request->params(['type','star']);
  26. return app('json')->success($this->repository->getApiList($where,$page, $limit));
  27. }
  28. public function detail($id)
  29. {
  30. $uid = $this->userInfo ? $this->userInfo->uid : null;
  31. $data = $this->repository->apiDetail($id,$this->userInfo);
  32. return app('json')->success($data);
  33. }
  34. public function getAgree()
  35. {
  36. $make = app()->make(CacheRepository::class);
  37. return app('json')->success(['sys_product_presell_agree' => $make->getResult('sys_product_presell_agree')]);
  38. }
  39. }