Product.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace app\api\controller\plus\seckill;
  3. use app\api\controller\Controller;
  4. use app\api\model\plus\seckill\Product as ProductModel;
  5. use app\api\model\plus\seckill\Active as ActiveModel;
  6. use app\common\service\product\BaseProductService;
  7. /**
  8. * 秒杀产品控制器
  9. */
  10. class Product extends Controller
  11. {
  12. /**
  13. * 秒杀活动
  14. */
  15. public function active()
  16. {
  17. $model = new ActiveModel();
  18. $list = $model->activityList();
  19. return $this->renderSuccess('', compact('list'));
  20. }
  21. /**
  22. * 秒杀商品
  23. */
  24. public function product($seckill_activity_id)
  25. {
  26. $detail = ActiveModel::detailWithTrans($seckill_activity_id);
  27. $list = (new ProductModel())->getActivityList($seckill_activity_id);
  28. return $this->renderSuccess('', compact('detail','list'));
  29. }
  30. /**
  31. * 秒杀商品详情
  32. */
  33. public function detail($seckill_product_id, $url = '')
  34. {
  35. $model = new ProductModel();
  36. $detail = $model->getSeckillDetail($seckill_product_id);
  37. $active = ActiveModel::detailWithTrans($detail['seckill_activity_id']);
  38. $specData = BaseProductService::getSpecData($detail['product']);
  39. // 微信公众号分享参数
  40. $share = $this->getShareParams($url, $detail['product']['product_name'], $detail['product']['product_name'], '/pages/plus/seckill/detail/detail', $detail['product']['image'][0]['file_path']);
  41. return $this->renderSuccess('', compact('detail', 'active', 'specData', 'share'));
  42. }
  43. }