getGroupbuyProductList($groupbuy_active_id, $limit); return $this->renderSuccess('', compact('list')); } /** * 团购商品详情 */ public function detail() { $groupbuy_product_id = $this->request->param('groupbuy_product_id'); if (empty($groupbuy_product_id)) { return $this->renderError('缺少必要参数:groupbuy_product_id'); } $detail = ProductModel::detail($groupbuy_product_id, ['product' => ['sku', 'image.file'], 'groupbuySku']); if (empty($detail)) { return $this->renderError('商品不存在'); } return $this->renderSuccess('', compact('detail')); } /** * 团购商品规格详情 */ public function getProductSku($groupbuy_product_id, $product_sku_id) { $model = new ProductModel; $detail = $model->getProductSku($groupbuy_product_id, $product_sku_id); return $this->renderSuccess('', compact('detail')); } /** * 搜索团购商品 */ public function search($keyword = '', $groupbuy_active_id = 0) { $params = []; if ($keyword) { $params['keyword'] = $keyword; } if ($groupbuy_active_id) { $params['groupbuy_active_id'] = $groupbuy_active_id; } $list = (new ProductModel)->getProductListByApi($params); return $this->renderSuccess('', compact('list')); } }