正在显示
2 个修改的文件
包含
23 行增加
和
0 行删除
@@ -319,4 +319,27 @@ class Index extends Api | @@ -319,4 +319,27 @@ class Index extends Api | ||
319 | $spec_data = $goods['spec_type'] == '2' ? $goods->getManySpecData($goods['spec_rel'], $goods['spec']) : null; | 319 | $spec_data = $goods['spec_type'] == '2' ? $goods->getManySpecData($goods['spec_rel'], $goods['spec']) : null; |
320 | $this->success(__('成功'),compact('spec_data')); | 320 | $this->success(__('成功'),compact('spec_data')); |
321 | } | 321 | } |
322 | + | ||
323 | + /** | ||
324 | + * 规格-获取商品sku | ||
325 | + * @ApiMethod (GET) | ||
326 | + * @ApiParams (name="goods_id", type="integer", required=true, description="商品ID") | ||
327 | + * @ApiParams (name="spec_sku_id", type="string", description="商品sku") | ||
328 | + * @ApiReturnParams (name="code", type="integer", required=true, sample="0") | ||
329 | + * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功") | ||
330 | + * @ApiReturnParams (name="data", type="object", description="扩展数据返回") | ||
331 | + * @ApiReturn ({ | ||
332 | + 'code':'1', | ||
333 | + 'msg':'返回成功' | ||
334 | + }) | ||
335 | + */ | ||
336 | + public function getGoodsSku() | ||
337 | + { | ||
338 | + $goods_id = $this->request->request('goods_id'); | ||
339 | + $spec_sku_id = $this->request->request('spec_sku_id'); | ||
340 | + $goods = Goods::get($goods_id,['spec_rel.spec']); | ||
341 | + empty($goods) && $this->error(__('商品信息不存在')); | ||
342 | + empty($spec_sku_id) && $this->error(__('请选择规格')); | ||
343 | + $this->success(__('成功'),$goods->getGoodsSku($spec_sku_id)); | ||
344 | + } | ||
322 | } | 345 | } |
此 diff 太大无法显示。
-
请 注册 或 登录 后发表评论