StoreProductPresell.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 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\api\store\product;
  12. use app\common\repositories\system\CacheRepository;
  13. use think\App;
  14. use crmeb\basic\BaseController;
  15. use app\common\repositories\store\product\ProductPresellRepository;
  16. class StoreProductPresell extends BaseController
  17. {
  18. protected $repository;
  19. protected $userInfo;
  20. /**
  21. * StoreProductPresell constructor.
  22. * @param App $app
  23. * @param repository $repository
  24. */
  25. public function __construct(App $app, ProductPresellRepository $repository)
  26. {
  27. parent::__construct($app);
  28. $this->repository = $repository;
  29. $this->userInfo = $this->request->isLogin() ? $this->request->userInfo() : null;
  30. }
  31. public function lst()
  32. {
  33. [$page, $limit] = $this->getPage();
  34. $where = $this->request->params(['type','star']);
  35. return app('json')->success($this->repository->getApiList($where,$page, $limit));
  36. }
  37. public function detail($id)
  38. {
  39. $uid = $this->userInfo ? $this->userInfo->uid : null;
  40. $data = $this->repository->apiDetail($id,$uid);
  41. return app('json')->success($data);
  42. }
  43. public function getAgree()
  44. {
  45. $make = app()->make(CacheRepository::class);
  46. return app('json')->success(['sys_product_presell_agree' => $make->getResult('sys_product_presell_agree')]);
  47. }
  48. }