响应参数
参数名 参数说明 备注total 总共商品条数
pagenum 当前商品页数
goods_id 商品 ID
goods_name 商品名称
goods_price 价格
goods_number 数量
goods_weight 重量 不能为空
goods_state 商品状态 商品状态 0: 未通过 1: 审核中 2: 已审核
add_time 添加时间
upd_time 更新时间
hot_mumber 热销品数量
is_promote 是否是热销品
pics 上传的图片临时路径(对象) pics_id:图片 ID,goods_id:商品 ID,pics_big:大图,pics_mid:中图,pics_sma:小图
attrs 商品的参数(数组) goods_id:商品 ID,attr_value:当前商品的参数值,add_price:浮动价格,attr_vals:预定义的参数值,attr_sel:手动输入,还是单选,
响应数据
{ "data": { "goods_id": 145, "goods_name": "test_goods_name2", "goods_price": 20, "goods_number": 30, "goods_weight": 40, "goods_introduce": "abc", "goods_big_logo": "", "goods_small_logo": "", "goods_state": 1, "add_time": 1512962370, "upd_time": 1512962370, "hot_mumber": 0, "is_promote": false, "pics": [ { "pics_id": 397, "goods_id": 145, "pics_big": "uploads/goodspics/big_30f08d52c551ecb447277eae232304b8", "pics_mid": "uploads/goodspics/mid_30f08d52c551ecb447277eae232304b8", "pics_sma": "uploads/goodspics/sma_30f08d52c551ecb447277eae232304b8" } ], "attrs": [ { "goods_id": 145, "attr_id": 15, "attr_value": "ddd", "add_price": null, "attr_name": "fffffff", "attr_sel": "many", "attr_write": "list", "attr_vals": "" }, { "goods_id": 145, "attr_id": 15, "attr_value": "eee", "add_price": null, "attr_name": "fffffff", "attr_sel": "many", "attr_write": "list", "attr_vals": "" } ] }, "meta": { "msg": "创建商品成功", "status": 201 } } 1.8.5. 删除商品请求路径:goods/:id
请求方法:delete
请求参数
参数名 参数说明 备注id 商品 ID 不能为空携带在url中
响应数据
{ "data": null, "meta": { "msg": "删除成功", "status": 200 } }###同步商品图片
请求路径:goods/:id/pics
请求方法:put
请求参数
参数名 参数说明 备注id 商品 ID 不能为空携带在url中
pics 商品图片集合 如果有 pics_id 字段会保留该图片,如果没有 pics_id 但是有 pic 字段就会新生成图片数据
请求数据
;[ { pic: \'tmp_uploads/db28f6316835836e97653b5c75e418be.png\' }, { pics_id: 397, goods_id: 145, pics_big: \'uploads/goodspics/big_30f08d52c551ecb447277eae232304b8\', pics_mid: \'uploads/goodspics/mid_30f08d52c551ecb447277eae232304b8\', pics_sma: \'uploads/goodspics/sma_30f08d52c551ecb447277eae232304b8\' } ]响应数据
{ "data": { "goods_id": 96, "goods_name": "iphoneXX", "goods_price": 2, "goods_number": 22, "goods_weight": 22, "goods_introduce": null, "goods_big_logo": "./uploads/goods/20171113/483a3b8e99e534ec3e4312dbbaee7c9d.jpg", "goods_small_logo": "./uploads/goods/20171113/small_483a3b8e99e534ec3e4312dbbaee7c9d.jpg", "goods_state": 0, "is_del": "1", "add_time": 1510045904, "upd_time": 1512635159, "delete_time": 1512635159, "hot_mumber": 0, "is_promote": false, "pics": [ { "pics_id": 383, "goods_id": 96, "pics_big": "uploads/goodspics/big_6f5750132abd3f5b2b93dd722fcde653.jpg", "pics_mid": "uploads/goodspics/mid_6f5750132abd3f5b2b93dd722fcde653.jpg", "pics_sma": "uploads/goodspics/sma_6f5750132abd3f5b2b93dd722fcde653.jpg" } ], "attrs": [ { "goods_id": 96, "attr_id": 15, "attr_value": "eee", "add_price": null, "attr_name": "fffffff", "attr_sel": "many", "attr_write": "list", "attr_vals": "" }, { "goods_id": 96, "attr_id": 15, "attr_value": "ddd", "add_price": null, "attr_name": "fffffff", "attr_sel": "many", "attr_write": "list", "attr_vals": "" } ] }, "meta": { "msg": "更新成功", "status": 200 } }###同步商品属性
请求路径:goods/:id/attributes
请求方法:put
请求参数
参数名 参数说明 备注id 商品 ID 不能为空携带在url中
请求数据
;[ { attr_id: 15, attr_value: \'ddd\' }, { attr_id: 15, attr_value: \'eee\' } ]