ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# 商品规格 #### 规格列表 ``` <pre class="calibre14">``` get:/index.php?ctl=Api_Goods_Spec&met=lists&typ=json int:page#页数 int:rows=100#每页记录数 <<< success { "cmd_id":-140, "status":200, "msg":"success", "data": {"page":1, "total":1, "totalsize":"1", "records":"1", "items":[ {"spec_id":"1", //规格id "spec_name":"颜色", //规格名称 "cat_id":"0", //快捷定位 "spec_displayorder":"40",//排序 "spec_readonly":"1", //不可删除 "id":"1" }]}} <<< error ``` ``` #### 新增规格 ``` <pre class="calibre14">``` get:/index.php?ctl=Api_Goods_Spec&typ=json&met=addGoodsSpec string:spec_name#规格名称 int:spec_displayorder#排序 <<< success {"cmd_id":-140, "status":200, "msg":"success", "data":{ "spec_name":"分量", //规格名称 "spec_displayorder":10, //排序 "id":60, "spec_id":60 //规格id }} <<< error ``` ``` #### 编辑规格 ``` <pre class="calibre14">``` get:/index.php?ctl=Api_Goods_Spec&typ=json&met=editGoodsSpec int:spec_id#规格id string:spec_name#规格名称 int:spec_displayorder#排序 <<< #### success {"cmd_id":-140, "status":200, "msg":"success", "data":{ "spec_name":"分量", //规格名称 "spec_displayorder":10, //排序 "id":60, "spec_id":60 //规格id }} <<< error ``` ``` #### 删除规格 ``` <pre class="calibre14">``` get:/index.php?ctl=Api_Goods_Spec&met=remove&typ=json int:spec_id#规格id <<< success {"cmd_id":-140,"status":200,"msg":"success","data":{"spec_id":[60]}} <<< error ``` ``` #### 新增/编辑规格值 ``` <pre class="calibre14">``` get:/index.php?ctl=Api_Goods_Spec&met=saveSpecValue&typ=json *int:shop_id#店铺id row:old#原有的规格值 row:new#新增规格值,批量增加规格值 int:spec_id#规格id string:name#新增规格值名称,单个新增规格值 string:position#单个更新规格值时传值为storeAddGoods,批量不传值 int:cat_id#分类id <<< success {"cmd_id":-140, "status":200, "msg":"success", "data":[ {"cat_id":4, //分类id "shop_id":"1", //店铺id "spec_value_displayorder":"5", //排序 "spec_value_name":"白皮", //规格值名称 "spec_id":3, //规格id "spec_value_id":12 //规格值id } ]} <<< error {"cmd_id":-140,"status":250,"msg":"failure","data":{}} ``` ``` ``` <pre class="calibre14">``` $old <span class="token">=</span> Array <span class="token1">(</span> <span class="token1">[</span><span class="token6">6</span><span class="token1">]</span> <span class="token">=</span><span class="token">></span> Array <span class="token5">//6为规格值id</span> <span class="token1">(</span> <span class="token1">[</span>displayorder<span class="token1">]</span> <span class="token">=</span><span class="token">></span> <span class="token6">1</span> <span class="token5">//排序</span> <span class="token1">[</span>spec_value_name<span class="token1">]</span> <span class="token">=</span><span class="token">></span> 白皮 <span class="token5">//规格值名称</span> <span class="token1">)</span> <span class="token1">[</span><span class="token6">8</span><span class="token1">]</span> <span class="token">=</span><span class="token">></span> Array <span class="token1">(</span> <span class="token1">[</span>displayorder<span class="token1">]</span> <span class="token">=</span><span class="token">></span> <span class="token6">2</span> <span class="token1">[</span>spec_value_name<span class="token1">]</span> <span class="token">=</span><span class="token">></span> 红皮 <span class="token1">)</span> <span class="token1">)</span> $<span class="token2">new</span> <span class="token">=</span> Array <span class="token1">(</span> <span class="token1">[</span><span class="token6">0</span><span class="token1">]</span> <span class="token">=</span><span class="token">></span> Array <span class="token1">(</span> <span class="token1">[</span>displayorder<span class="token1">]</span> <span class="token">=</span><span class="token">></span> <span class="token6">3</span> <span class="token5">//排序</span> <span class="token1">[</span>spec_value_name<span class="token1">]</span> <span class="token">=</span><span class="token">></span> 青皮 <span class="token5">//规格值名称</span> <span class="token1">)</span> <span class="token1">)</span> ``` ``` #### 删除规格值 ``` <pre class="calibre14">``` get:/index.php?ctl=Api_Goods_Spec&met=removeSpecValue&typ=json *int:spec_value_id#规格值id <<< success {"cmd_id":-140,"status":200,"msg":"success","data":{}} <<< error {"cmd_id":-140,"status":250,"msg":"failure","data":{}} ``` ``` #### 规格值列表 ``` <pre class="calibre15">``` get:/index.php?ctl=Api_Goods_Spec&met=getSpecValue&typ=json *spec_id#规格id *cat_id#分类id <<< success {"cmd_id":-140, "status":200, "msg":"success", "data":{ "8":{ "spec_value_id":"8", //规格值id "spec_value_name":"白皮", //规格值名称 "spec_id":"3", //规格id "type_id":"0", "cat_id":"0", //分类id "shop_id":"1", //店铺id "spec_value_displayorder":"2", //排序 "id":"8" }, "6":{ "spec_value_id":"6", "spec_value_name":"黑皮", "spec_id":"3", "type_id":"0", "cat_id":"0", "shop_id":"1", "spec_value_displayorder":"1", "id":"6" } }} <<< error ``` ```