Product.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. namespace app\api\controller\plus\assemble;
  3. use app\api\controller\Controller;
  4. use app\api\model\plus\assemble\Product as ProductModel;
  5. use app\api\model\plus\assemble\Active as ActiveModel;
  6. use app\api\model\settings\Setting as SettingModel;
  7. use app\common\service\product\BaseProductService;
  8. use app\api\model\plus\assemble\Bill as BillModel;
  9. /**
  10. * 拼团控制器
  11. */
  12. class Product extends Controller
  13. {
  14. /**
  15. * 拼团活动
  16. */
  17. public function active()
  18. {
  19. $model = new ActiveModel();
  20. $list = $model->activityList();
  21. return $this->renderSuccess('', compact('list'));
  22. }
  23. /**
  24. * 拼团商品
  25. */
  26. public function product($assemble_activity_id)
  27. {
  28. $detail = ActiveModel::detailWithTrans($assemble_activity_id);
  29. $list = (new ProductModel())->getActivityList($assemble_activity_id);
  30. return $this->renderSuccess('', compact('detail','list'));
  31. }
  32. /**
  33. * 拼团商品详情
  34. */
  35. public function detail($assemble_product_id)
  36. {
  37. $model = new ProductModel();
  38. //详情
  39. $detail = $model->getAssembleDetail($assemble_product_id);
  40. //活动
  41. $active = ActiveModel::detailWithTrans($detail['assemble_activity_id']);
  42. //规格
  43. $specData = BaseProductService::getSpecData($detail['product']);
  44. //拼团订单
  45. $model = new BillModel();
  46. $bill = $model->getBill($detail['assemble_product_id'], $detail['assemble_activity_id'], $detail['assemble_num']);
  47. //是否显示店铺信息
  48. $store_open = SettingModel::getStoreOpen();
  49. return $this->renderSuccess('', compact('detail', 'active', 'specData', 'bill', 'store_open'));
  50. }
  51. }