Product.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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\api\model\settings\Setting as SettingModel;
  7. use app\common\service\product\BaseProductService;
  8. /**
  9. * 秒杀产品控制器
  10. */
  11. class Product extends Controller
  12. {
  13. /**
  14. * 秒杀活动
  15. */
  16. public function active()
  17. {
  18. $model = new ActiveModel();
  19. $list = $model->activityList();
  20. return $this->renderSuccess('', compact('list'));
  21. }
  22. /**
  23. * 秒杀商品
  24. */
  25. public function product($seckill_activity_id)
  26. {
  27. $detail = ActiveModel::detailWithTrans($seckill_activity_id);
  28. $list = (new ProductModel())->getActivityList($seckill_activity_id);
  29. return $this->renderSuccess('', compact('detail','list'));
  30. }
  31. /**
  32. * 秒杀商品详情
  33. */
  34. public function detail($seckill_product_id)
  35. {
  36. $model = new ProductModel();
  37. $detail = $model->getSeckillDetail($seckill_product_id);
  38. $active = ActiveModel::detailWithTrans($detail['seckill_activity_id']);
  39. $specData = BaseProductService::getSpecData($detail['product']);
  40. //是否显示店铺信息
  41. $store_open = SettingModel::getStoreOpen();
  42. return $this->renderSuccess('', compact('detail', 'active', 'specData', 'store_open'));
  43. }
  44. }