Product.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace app\api\controller\plus\points;
  3. use app\api\controller\Controller;
  4. use app\api\model\plus\points\Product as ProductModel;
  5. use app\common\service\product\BaseProductService;
  6. /**
  7. * 积分商城控制器
  8. */
  9. class Product extends Controller
  10. {
  11. /**
  12. *积分商品列表
  13. */
  14. public function index()
  15. {
  16. $model = new ProductModel();
  17. $list = $model->getList($this->request->param());
  18. $points = $this->getUser()['points'];
  19. return $this->renderSuccess('', compact('list', 'points'));
  20. }
  21. /**
  22. *积分商品列表
  23. */
  24. public function detail($point_product_id, $url = '')
  25. {
  26. $detail = (new ProductModel())->getPointDetail($point_product_id);
  27. //规格
  28. $specData = BaseProductService::getSpecData($detail['product']);
  29. // 微信公众号分享参数
  30. $share = $this->getShareParams($url, $detail['product']['product_name'], $detail['product']['product_name'], '/pages/plus/assemble/detail/detail', $detail['product']['image'][0]['file_path']);
  31. return $this->renderSuccess('', compact('detail', 'specData', 'share'));
  32. }
  33. }