开发指南 官网
API 2.0 > 3.1 商品 > 3.1.2 创建/更新商品

3.1.2 创建/更新商品

开启令牌和权限后可调用。签名方式请查看开发指南
场景描述:创建或者更新商品信息,通过手工同步或者调用《商品同步到门店》接口,将商品信息同步到门店

请求地址

请求方式 版本信息 请求地址
POST V2 http://openapi.zvcms.com/api/v2

公共参数

参数 参数类型 是否必填 默认值 描述
OpenId string 密钥Id
GrantCode string 授权code
Token string 签名,参考《数字签名sign》
Timestamp string 当前时间戳
Nonce string 随机正整数
Action string goods.goods-update 接口方法
Params array 业务参数

请求参数

参数 参数类型 是否必填 默认值 描述
id int 商品ID 有值是编辑 无值是添加
name string 商品名称
unit string 单位 (零售时是: 库存单位)
market_price Money(分) use_spec为off 时 填写市场价
is_card_discount string 是否参加会员折扣(no or yes)
shelve_status int 是否上架,1是0否 商家小程序发布商品传1
pricing_mode int 计价方式 1计数 2计重
is_sell_online int 销售渠道(是否网店销售) 0否1是
is_sell_offline int 销售渠道(是否门店销售) 0否1是
sell_price float 网店售价
type int 1 商品的销售类型 1表示普通商品 2表示套餐商品。默认是1普通商品(零售-》商品类型(1:实体商品,2:虚拟卡券商品))
recommend_price Money(分) 建议价
cost_price Money(分) 成本价
sales_channels string 销售渠道(1:门店,2:网店)
sales_status string 上下架状态(on or off)
share_text string 分享文字 最大20字
limit_num int 限购数量
limit_user int 限购会员等级
product_no string 实体条码 max:20
text array (数组)【subheading(商品卖点简介),content(内容)】
barcode string 条码 多个条码以 , 隔开
video array (数组) 【link(视频链接)】
category array
 ├0 int 所属商品分类(可同时属于多个分类)
prepare_time TimeStamp 准备时长
prepare_time_type TimeStamp 时间类型。d:日,h:时,m:分
stock int 库存 use_spec = off 时填写
reta_trade_mark string 商品标识,最大支持64位字符,当reta_use_spec为"off"时必填
brand_id int 品牌id
corner_mark_id int 角标id
base_sales_num int 模拟销量
min_buy_num int 起购数量
validity_period_type int 卡券有效期类型:1-长期有效,2-自定义有效期
validity_period_begin TimeStamp 有效期-开始时间
validity_period_end TimeStamp 有效期-结束时间
sort int 排序
is_limit_num_update int 限购数量是否次日更新 0表示不更新 1表示更新
multi_store_ids int type=2时 传multi_store_ids(门店id数组参数)
multi_store_type int multi_store_type多门店类别 1全部适用 2.部分可用 3.部分不可用
entities array
 ├0 array
  ├name string 名称
  ├img string 图片地址
  ├reta_trade_mark string 商品标识,最大支持64位字符
  ├product_no string product_no
  ├market_price string 市场价
  ├sell_price string 零售价
  ├prepare_time int 准备时长
  ├prepare_time_type string 时间类型。d:日,h:时,m:分
  ├stock string 库存
  ├spec array 规格数组: "spec": { "548": 1967 }
  ├cost_price string 成本价 cost_price
  ├handle_dir string 可以传add或者sub 表示添加和减少
  ├handle_handle_qty string 增量 同stock一致即可
leave_message array
 ├0 array
  ├type string text
  ├name string 文本信息
  ├is_must int 是否必填(1.是 0.否)
  ├date Date 日期
  ├image string 图片地址
  ├email string 邮箱
  ├IDcard string 身份证号
  ├phone int 手机号
  ├number int 数字
  ├time TimeStamp 时间
  ├datetime DateTime 日期时间
reta_images array 图片地址 (数组)【img_url(图片地址),is_default(是否是默认图片 1:是 0:否)】)
reta_use_spec string 是否多规格(on or off))
is_city_express int 是否同城/外送 1是 0否
is_fetch int 是否到店自提 1是 0否
is_express int 是否快递发货 1是 0否

响应参数

参数 参数类型 描述
status bool 请求成功或者失败
code int 成功/错误编码
message string 成功/错误描述

请求示例

{
    "OpenId": "6dc05b4ac175cf316d226252b05cf685",
    "GrantCode": "782c281f62",
    "Timestamp": "1547186244",
    "Nonce": "658965",
    "Token": "0%2B%2B3c6hthjwAml4ABAXOYF4Q6UY%3D",
    "Action": "goods.goods-update",
    "Params": {
        "id": "",
        "name": "商品名称",
        "unit": "份\/只",
        "market_price": "",
        "is_card_discount": "",
        "shelve_status": "1",
        "pricing_mode": "1",
        "is_sell_online": "1",
        "is_sell_offline": "1",
        "sell_price": "0.02",
        "type": "",
        "recommend_price": "",
        "cost_price": "",
        "sales_channels": "",
        "sales_status": "",
        "share_text": "",
        "limit_num": "",
        "limit_user": "",
        "product_no": "",
        "text": "",
        "barcode": "",
        "video": "",
        "category": [
            ""
        ],
        "prepare_time": "",
        "prepare_time_type": "",
        "stock": "",
        "reta_trade_mark": "",
        "brand_id": "",
        "corner_mark_id": "",
        "base_sales_num": "",
        "min_buy_num": "",
        "validity_period_type": "",
        "validity_period_begin": "",
        "validity_period_end": "",
        "sort": "",
        "is_limit_num_update": "",
        "multi_store_ids": "",
        "multi_store_type": "",
        "entities": [
            {
                "name": "",
                "img": "",
                "reta_trade_mark": "",
                "product_no": "",
                "market_price": "",
                "sell_price": "",
                "prepare_time": "",
                "prepare_time_type": "d",
                "stock": "",
                "spec": "{       \"212\": 734,       \"250\": 957     }",
                "cost_price": "",
                "handle_dir": "",
                "handle_handle_qty": ""
            }
        ],
        "leave_message": [
            {
                "type": "",
                "name": "",
                "is_must": "",
                "date": "",
                "image": "",
                "email": "",
                "IDcard": "",
                "phone": "",
                "number ": "",
                "time": "",
                "datetime": ""
            }
        ],
        "reta_images": "",
        "reta_use_spec": "",
        "is_city_express": "",
        "is_fetch": "",
        "is_express": ""
    }
} 

响应示例

{
    "status": "true",
    "code": "0",
    "message": "说明",
    "data": {
        "status": "",
        "code": "",
        "message": ""
    }
}

异常示例

{
    "status": true,
    "code": "异常编码,根据不同的业务返回编码",
    "message": "异常说明:查询的信息不存在"
}

错误码

{
    "status": false,
    "code": "系统错误编码:详见全局返回编码",
    "message": "系统错误说明"
}

请求地址

请求方式 版本信息 请求地址
POST V2 http://openapi.zvcms.com/api/v2

公共参数

参数 参数类型 是否必填 默认值 描述
OpenId string 密钥Id
GrantCode string 授权code
Token string 签名,参考《数字签名sign》
Timestamp string 当前时间戳
Nonce string 随机正整数
Action string goods.goods-update 接口方法
Params array 业务参数

请求参数

参数 参数类型 是否必填 默认值 描述
id int 商品ID 有值是编辑 无值是添加
name string 商品名称
category_ids array 商品分类的id(数组形式,一个商品可属于多个分类)
unit string 单位 (零售时是: 库存单位)
images array 商品图片(数组形式)
sell_time_status int 开启分段时销 0- 不开启 1- 开启
sell_time array
 ├0 array
  ├time array
   ├0 string 开始时间(格式:00:00:00)
   ├1 string 结束时间(格式:23:59:59)
production_time int 商品制作时间 单位秒
sale_type array
 ├0 int 商品销售类型 数组,可选值有 1堂食,2外卖
content string 详细介绍
pack_cost float 打包费
use_spec int 是否开启规格 1是 0否 (不开启规格 商品销售类型选择堂食则填写堂食销售价格市场价格和库存,选择外卖填写外卖对应销售价格市场价格和库存.都选都填)
products array
 ├0 array
  ├market_price float 堂食市场价
  ├out_market_price float 外卖市场价
  ├out_sell_price float 外卖销售价格
  ├out_stock int 外卖-库存
  ├sell_price float 堂食销售价格
  ├product_no string 固定值,传空字符串
  ├stock int 堂食-库存
  ├trade_mark string 商品编码(标识,最大字符长度32位)
  ├spec array 数组,键是规格的id,值是规格值的id,一维数组
specs array
 ├0 array
  ├id int 规格id
  ├name string 规格名称
  ├values array
   ├0 array
    ├id int 规格值的id
    ├value string 规格值
    ├image string 规格图片,没有则传空字符串
property array 《套餐商品》不传此参数。做法 [{"name"(做法名称):"加冰","values":[{"value(做法值)":"少冰"},{"value(做法值)":"多冰"}]},{"name"(做法名称):"甜度","values":[{"value"(做法值):"少糖"}]}]
use_property int 0 《套餐商品》不传此参数。是否开启属性 1.开启 0.关闭。默认是0.关闭
type int 1 商品的销售类型 1表示普通商品 2表示套餐商品。默认是1普通商品(零售-》商品类型(1:实体商品,2:虚拟卡券商品))
cover_img string 套餐的封面图
goods_ids array
 ├0 array 商品id数组 注意:《套餐商品》时传此参数 套餐基础商品id数组
 ├1 array 商品id数组 注意:《套餐商品》时传此参数 套餐基础商品id数组
sales int 《套餐商品》不传此参数。产品销量
use_material int 《套餐商品》不传此参数。 使用加料: 0不使用 1使用
material_ids array
 ├0 int 《套餐商品》不传此参数。 需要关联的加料 ID(可关联多个)
goods_infomation array
 ├0 array
  ├goods_id array 《套餐商品》传此参数 array [{"goods_id":4096(商品id),"entity_id":"38c9c674f1f8f490"(实体id)}]
  ├entity_id array 《套餐商品》传此参数 array [{"goods_id":4096(商品id),"entity_id":"38c9c674f1f8f490"(实体id)}]
is_follow_suit int 《套餐商品》 传此参数 值为 1 时 goods_set_meal_group数组必填
goods_set_meal_group array
 ├0 array
  ├group_name array 分组一"(分组名称) goods_set_meal_group数组解析:《套餐商品》 随心配商品信息数组 array [{ "group_name": "分组一"(分组名称), "entity_info"(分组商品数组): [{ "goods_id": 4095(商品id), "entity_id": "416f7fee0420c4f2"(实体id), "sell_price": 0(堂食加价), "out_sell_price": 0(外卖加价), "is_default": 1 (是否默认商品 1.是 0.否) }] }]
  ├entity_info array
   ├0 array
    ├goods_id array (分组商品数组中的 商品id)
    ├entity_id array (分组商品数组中的 实体id)
    ├sell_price array (分组商品数组中的 堂食加价)
    ├is_default array (分组商品数组中的 是否默认商品 1.是 0.否)
    ├out_sell_price array (分组商品数组中的 外卖加价)
sort int 商品排序字段(值越小越靠前)

响应参数

参数 参数类型 描述
status bool 请求成功或者失败
code int 成功/错误编码
message string 成功/错误描述
data array
 ├id int 新增商品的id

请求示例

{
    "OpenId": "6dc05b4ac175cf316d226252b05cf685",
    "GrantCode": "782c281f62",
    "Timestamp": "1547186244",
    "Nonce": "658965",
    "Token": "0%2B%2B3c6hthjwAml4ABAXOYF4Q6UY%3D",
    "Action": "goods.goods-update",
    "Params": {
        "id": "",
        "name": "商品名称",
        "category_ids": "40",
        "unit": "份\/只",
        "images": "[{\"img_url\": \"https:\/\/img-shop.qmimg.cn\/s10627\/2019\/01\/10\/d768755901e3ac5a1b.png\",\"is_default\": 1}]",
        "sell_time_status": "0",
        "sell_time": [
            {
                "time": [
                    "00:00:00",
                    "23:59:59"
                ]
            }
        ],
        "production_time": "90",
        "sale_type": [
            "1"
        ],
        "content": "介绍",
        "pack_cost": "1",
        "use_spec": "0",
        "products": [
            {
                "market_price": "0.03",
                "out_market_price": "0.03",
                "out_sell_price": "0.02",
                "out_stock": "100",
                "sell_price": "0.02",
                "product_no": "",
                "stock": "100",
                "trade_mark": "",
                "spec": "\"spec\":{\"606\":107,\"605\":108}"
            }
        ],
        "specs": [
            {
                "id": "101",
                "name": "规格名称",
                "values": [
                    {
                        "id": "48",
                        "value": "规格值",
                        "image": ""
                    }
                ]
            }
        ],
        "property": "",
        "use_property": "",
        "type": "",
        "cover_img": "",
        "goods_ids": [
            "1",
            "2"
        ],
        "sales": "",
        "use_material": "",
        "material_ids": [
            ""
        ],
        "goods_infomation": [
            {
                "goods_id": "4096",
                "entity_id": "38c9c674f1f8f490"
            }
        ],
        "is_follow_suit": "1",
        "goods_set_meal_group": [
            {
                "group_name": "分组一\"(分组名称)",
                "entity_info": [
                    {
                        "goods_id": "4095",
                        "entity_id": "416f7fee0420c4f2",
                        "sell_price": "0",
                        "is_default": "1",
                        "out_sell_price": "0"
                    }
                ]
            }
        ],
        "sort": "99"
    }
} 

响应示例

{
    "status": "true",
    "code": "0",
    "message": "说明",
    "data": {
        "id": ""
    }
}

异常示例

{
    "status": true,
    "code": "异常编码,根据不同的业务返回编码",
    "message": "异常说明:查询的信息不存在"
}

错误码

{
    "status": false,
    "code": "系统错误编码:详见全局返回编码",
    "message": "系统错误说明"
}

请求地址

请求方式 版本信息 请求地址
POST V2 http://openapi.zvcms.com/api/v2

公共参数

参数 参数类型 是否必填 默认值 描述
OpenId string 密钥Id
GrantCode string 授权code
Token string 签名,参考《数字签名sign》
Timestamp string 当前时间戳
Nonce string 随机正整数
Action string goods.goods-update 接口方法
Params array 业务参数

请求参数

参数 参数类型 是否必填 默认值 描述
id int 商品ID 有值是编辑 无值是添加
name string 商品名称
category_ids array 商品分类的id(数组形式,一个商品可属于多个分类)
unit string 单位 (零售时是: 库存单位)
sort int 排序
tag_name string 标签,空格分割
shelve_status int 上下架状态 1-上架 0-下架
intro string 简介
products array
 ├0 array
  ├name string 规格名
  ├stock int 库存
  ├sell_price Money(元) 售价
  ├market_price Money(元) 市场价
  ├takeout_price Money(元) 外卖价

响应参数

参数 参数类型 描述
goods_id int 新增商品的id

请求示例

{
    "OpenId": "6dc05b4ac175cf316d226252b05cf685",
    "GrantCode": "782c281f62",
    "Timestamp": "1547186244",
    "Nonce": "658965",
    "Token": "0%2B%2B3c6hthjwAml4ABAXOYF4Q6UY%3D",
    "Action": "goods.goods-update",
    "Params": {
        "id": "",
        "name": "商品名称",
        "category_ids": "40",
        "unit": "份\/只",
        "sort": "",
        "tag_name": "新品 \/时尚",
        "shelve_status": "1",
        "intro": "简介",
        "products": [
            {
                "name": "规格名",
                "stock": "10",
                "sell_price": "4",
                "market_price": "3",
                "takeout_price": "2"
            }
        ]
    }
} 

响应示例

{
    "status": "true",
    "code": "0",
    "message": "说明",
    "data": {
        "goods_id": ""
    }
}

异常示例

{
    "status": true,
    "code": "异常编码,根据不同的业务返回编码",
    "message": "异常说明:查询的信息不存在"
}

错误码

{
    "status": false,
    "code": "系统错误编码:详见全局返回编码",
    "message": "系统错误说明"
}

请求地址

请求方式 版本信息 请求地址
POST V2 http://openapi.zvcms.com/api/v2

公共参数

参数 参数类型 是否必填 默认值 描述
OpenId string 密钥Id
GrantCode string 授权code
Token string 签名,参考《数字签名sign》
Timestamp string 当前时间戳
Nonce string 随机正整数
Action string goods.goods-update 接口方法
Params array 业务参数

请求参数

参数 参数类型 是否必填 默认值 描述
id int 商品ID 有值是编辑 无值是添加
name string 商品名称
category_ids array 商品分类的id(数组形式,一个商品可属于多个分类)
unit string 单位 (零售时是: 库存单位)
sort int 排序
tag_name string 标签,空格分割
shelve_status int 上下架状态 1-上架 0-下架
intro string 简介
products array
 ├0 array
  ├name string 规格名
  ├stock int 库存
  ├sell_price Money(元) 售价
  ├market_price Money(元) 市场价
  ├takeout_price Money(元) 外卖价

响应参数

参数 参数类型 描述
goods_id int 新增商品的id

请求示例

{
    "OpenId": "6dc05b4ac175cf316d226252b05cf685",
    "GrantCode": "782c281f62",
    "Timestamp": "1547186244",
    "Nonce": "658965",
    "Token": "0%2B%2B3c6hthjwAml4ABAXOYF4Q6UY%3D",
    "Action": "goods.goods-update",
    "Params": {
        "id": "",
        "name": "商品名称",
        "category_ids": "40",
        "unit": "份\/只",
        "sort": "",
        "tag_name": "新品 \/时尚",
        "shelve_status": "1",
        "intro": "简介",
        "products": [
            {
                "name": "规格名",
                "stock": "10",
                "sell_price": "4",
                "market_price": "3",
                "takeout_price": "2"
            }
        ]
    }
} 

响应示例

{
    "status": "true",
    "code": "0",
    "message": "说明",
    "data": {
        "goods_id": ""
    }
}

异常示例

{
    "status": true,
    "code": "异常编码,根据不同的业务返回编码",
    "message": "异常说明:查询的信息不存在"
}

错误码

{
    "status": false,
    "code": "系统错误编码:详见全局返回编码",
    "message": "系统错误说明"
}

免费升级

营销功能、插件持续每月更新开发升级

免费专业培训

每月建站、微信营销、电商等互联网增值培训

7×24小时服务支持

400电话、QQ、微信、在线等多渠道售后支持

 

安徽智迈科技股份有限公司 版权所有 Copyright 2009-2018 皖公网安备 34019202000074号 增值电信业务经营许可证:皖B2-20170075