...
|
...
|
@@ -319,4 +319,27 @@ class Index extends Api |
|
|
$spec_data = $goods['spec_type'] == '2' ? $goods->getManySpecData($goods['spec_rel'], $goods['spec']) : null;
|
|
|
$this->success(__('成功'),compact('spec_data'));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 规格-获取商品sku
|
|
|
* @ApiMethod (GET)
|
|
|
* @ApiParams (name="goods_id", type="integer", required=true, description="商品ID")
|
|
|
* @ApiParams (name="spec_sku_id", type="string", description="商品sku")
|
|
|
* @ApiReturnParams (name="code", type="integer", required=true, sample="0")
|
|
|
* @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
|
|
|
* @ApiReturnParams (name="data", type="object", description="扩展数据返回")
|
|
|
* @ApiReturn ({
|
|
|
'code':'1',
|
|
|
'msg':'返回成功'
|
|
|
})
|
|
|
*/
|
|
|
public function getGoodsSku()
|
|
|
{
|
|
|
$goods_id = $this->request->request('goods_id');
|
|
|
$spec_sku_id = $this->request->request('spec_sku_id');
|
|
|
$goods = Goods::get($goods_id,['spec_rel.spec']);
|
|
|
empty($goods) && $this->error(__('商品信息不存在'));
|
|
|
empty($spec_sku_id) && $this->error(__('请选择规格'));
|
|
|
$this->success(__('成功'),$goods->getGoodsSku($spec_sku_id));
|
|
|
}
|
|
|
} |
...
|
...
|
|