1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?php
- namespace app\controller\api\store\product;
- use app\common\repositories\system\CacheRepository;
- use think\App;
- use ln\basic\BaseController;
- use app\common\repositories\store\product\ProductPresellRepository;
- class StoreProductPresell extends BaseController
- {
- protected $repository;
- protected $userInfo;
- /**
- * StoreProductPresell constructor.
- * @param App $app
- * @param repository $repository
- */
- public function __construct(App $app, ProductPresellRepository $repository)
- {
- parent::__construct($app);
- $this->repository = $repository;
- $this->userInfo = $this->request->isLogin() ? $this->request->userInfo() : null;
- }
- public function lst()
- {
- [$page, $limit] = $this->getPage();
- $where = $this->request->params(['type','star']);
- return app('json')->success($this->repository->getApiList($where,$page, $limit));
- }
- public function detail($id)
- {
- $uid = $this->userInfo ? $this->userInfo->uid : null;
- $data = $this->repository->apiDetail($id,$this->userInfo);
- return app('json')->success($data);
- }
- public function getAgree()
- {
- $make = app()->make(CacheRepository::class);
- return app('json')->success(['sys_product_presell_agree' => $make->getResult('sys_product_presell_agree')]);
- }
- }
|