# 商品
#### 发布与编辑商品接口
> 调用该接口前,请确保发布商品的店铺可以正常发布商品。发布商品前店铺需要设置售卖区域,运费模板,如果有规格的话需要编辑规格值。
```
<pre class="calibre14">```
get:/index.php?ctl=Api_Goods_Goods&met=AddOrEditGoodsApi&typ=json
int:common_id#商品common_id。发布商品不用填写,编辑商品需要填写
string:name#商品名称
row:spec#规格商品信息
string:code#商家货号
string:action#发布商品不用传值,编辑时传值为‘edit’
int:shop_id#店铺id
int:cat_id#商品分类id
row:sgcate_id#店铺分类
string:cat_name#商品分类名称,需要完整分类等级,例如“一级类目 > 二级分类 > 三级分类”
int:brand_id#品牌id
string:promotion_tips#副标题
string:imagePath#商品主图
string:viedoPath#商品视频
float:price#商品价格,精确到两位小数
float:market_price#市场价格
float:coet_price#成本价格
int:stock#商品库存
int:alarm#库存预警值
int:formatid_top#顶部关联版式
int:formatid_bottom#底部关联版式
float:cubage=1#商品重量,默认为1
int:is_return#7天无理由退货 1-退货 0-不退
string:service#售后服务
string:packing_list#包装清单
int:state=1#商品状态,0下架,1正常,10违规(禁售)
string:is_recommend#是否推荐 1-不推荐 2-推荐
row:property#商品属性
string:spec_name#规格名称
int:transport_area_id#选择售卖区域id
int:is_gv#是否是虚拟商品,0-不是 1-是
int:g_vindate#虚拟商品有效期(2019-04-24)
int:g_vinvalidrefund#支持过期退款 0-不支持 1-支持
string:starttime#定期发布商品(年-月-日)
string:hour#定时发布商品-时
string:minute#定时发布商品-分
row:spec_val#规格值
string:body#内容详情
int:is_limit#商品是否限购 #0-不限购
row:fenxiao#分销分佣比例
<<<
success
Array
(
[cmd_id] => -140
[status] => 200
[msg] => success
[data] => Array
(
[common_id] => 43 //新增成功后的商品common_id
)
)
<<<
error
Array
(
[cmd_id] => -140
[status] => 250
[msg] => '含有违禁词'
[data] => Array ( )
)
Array
(
[cmd_id] => -140
[status] => 250
[msg] => '商品发布数量超出平台限制!'
[data] => Array ( )
)
Array
(
[cmd_id] => -140
[status] => 250
[msg] => '市场价不能低于供货价格'
[data] => Array ( )
)
Array
(
[cmd_id] => -140
[status] => 250
[msg] => '市场价不能低于商品价格'
[data] => Array ( )
)
Array
(
[cmd_id] => -140
[status] => 250
[msg] => '售后服务信息最多输入200个字符'
[data] => Array ( )
)
Array
(
[cmd_id] => -140
[status] => 250
[msg] => '售卖区域有误'
[data] => Array ( )
)
Array
(
[cmd_id] => -140
[status] => 250
[msg] => '请设置售卖区域'
[data] => Array ( )
)
Array
(
[cmd_id] => -140
[status] => 250
[msg] => '请设置运费模板'
[data] => Array ( )
)
Array
(
[cmd_id] => -140
[status] => 250
[msg] => '发布时间不能小于当前时间'
[data] => Array ( )
)
Array
(
[cmd_id] => -140
[status] => 250
[msg] => '最高零售价格不能低于最低零售价格'
[data] => Array ( )
)
```
```
```
<pre class="calibre14">```
$fenxiao <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> <span class="token6">3.00</span> <span class="token5">//一级佣金比例</span>
<span class="token1">[</span><span class="token6">1</span><span class="token1">]</span> <span class="token">=</span><span class="token">></span> <span class="token6">2.00</span> <span class="token5">//二级佣金比例</span>
<span class="token1">[</span><span class="token6">2</span><span class="token1">]</span> <span class="token">=</span><span class="token">></span> <span class="token6">1.00</span> <span class="token5">//三级佣金比例</span>
<span class="token1">)</span>
$property <span class="token">=</span> Array
<span class="token1">(</span>
<span class="token1">[</span>property_151<span class="token1">]</span> <span class="token">=</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> 测试属性<span class="token6">1</span> <span class="token5">//属性名称</span>
<span class="token1">[</span><span class="token6">1</span><span class="token1">]</span> <span class="token">=</span><span class="token">></span> <span class="token6">390</span> <span class="token5">//属性值id</span>
<span class="token1">[</span><span class="token6">2</span><span class="token1">]</span> <span class="token">=</span><span class="token">></span> select <span class="token5">//显示类型</span>
<span class="token1">[</span><span class="token6">3</span><span class="token1">]</span> <span class="token">=</span><span class="token">></span> <span class="token6">151</span> <span class="token5">//属性id</span>
<span class="token1">)</span>
<span class="token1">)</span>
$spec_name <span class="token">=</span> Array
<span class="token1">(</span>
<span class="token1">[</span><span class="token6">10</span><span class="token1">]</span> <span class="token">=</span><span class="token">></span> 测试规格<span class="token6">1</span> <span class="token5">//主键为规格id,值为规格名称</span>
<span class="token1">[</span><span class="token6">11</span><span class="token1">]</span> <span class="token">=</span><span class="token">></span> 测试规格<span class="token6">2</span>
<span class="token1">)</span>
$spec_val <span class="token">=</span><span class="token">></span> Array
<span class="token1">(</span>
<span class="token1">[</span><span class="token6">10</span><span class="token1">]</span> <span class="token">=</span><span class="token">></span> Array <span class="token5">//主键为规格id</span>
<span class="token1">(</span>
<span class="token1">[</span><span class="token6">45</span><span class="token1">]</span> <span class="token">=</span><span class="token">></span> S <span class="token5">//主键为规格值id,值为规格值名称</span>
<span class="token1">[</span><span class="token6">46</span><span class="token1">]</span> <span class="token">=</span><span class="token">></span> M
<span class="token1">)</span>
<span class="token1">[</span><span class="token6">11</span><span class="token1">]</span> <span class="token">=</span><span class="token">></span> Array
<span class="token1">(</span>
<span class="token1">[</span><span class="token6">47</span><span class="token1">]</span> <span class="token">=</span><span class="token">></span> <span class="token6">10</span>
<span class="token1">)</span>
<span class="token1">)</span>
$spec <span class="token">=</span><span class="token">></span> Array
<span class="token1">(</span>
<span class="token1">[</span>i_4547<span class="token1">]</span> <span class="token">=</span><span class="token">></span> Array <span class="token5">//主键为'i_'拼接规格值id,规格值id由小到大排序</span>
<span class="token1">(</span>
<span class="token1">[</span>goods_id<span class="token1">]</span> <span class="token">=</span><span class="token">></span>
<span class="token1">[</span>sp_value<span class="token1">]</span> <span class="token">=</span><span class="token">></span> Array
<span class="token1">(</span>
<span class="token1">[</span><span class="token6">45</span><span class="token1">]</span> <span class="token">=</span><span class="token">></span> S <span class="token5">//主键为规格值id,值为规格值名称</span>
<span class="token1">[</span><span class="token6">47</span><span class="token1">]</span> <span class="token">=</span><span class="token">></span> <span class="token6">10</span>
<span class="token1">)</span>
<span class="token1">[</span>market_price<span class="token1">]</span> <span class="token">=</span><span class="token">></span> <span class="token6">200.3</span> <span class="token5">//市场价</span>
<span class="token1">[</span>price<span class="token1">]</span> <span class="token">=</span><span class="token">></span> <span class="token6">152.3</span> <span class="token5">//商品价格</span>
<span class="token1">[</span>stock<span class="token1">]</span> <span class="token">=</span><span class="token">></span> <span class="token6">1000</span> <span class="token5">//库存</span>
<span class="token1">[</span>alarm<span class="token1">]</span> <span class="token">=</span><span class="token">></span> <span class="token6">10</span> <span class="token5">//库存预警值</span>
<span class="token1">[</span>sku<span class="token1">]</span> <span class="token">=</span><span class="token">></span> A001 <span class="token5">//商家货号</span>
<span class="token1">)</span>
<span class="token1">[</span>i_4647<span class="token1">]</span> <span class="token">=</span><span class="token">></span> Array
<span class="token1">(</span>
<span class="token1">[</span>goods_id<span class="token1">]</span> <span class="token">=</span><span class="token">></span>
<span class="token1">[</span>sp_value<span class="token1">]</span> <span class="token">=</span><span class="token">></span> Array
<span class="token1">(</span>
<span class="token1">[</span><span class="token6">46</span><span class="token1">]</span> <span class="token">=</span><span class="token">></span> M
<span class="token1">[</span><span class="token6">47</span><span class="token1">]</span> <span class="token">=</span><span class="token">></span> <span class="token6">10</span>
<span class="token1">)</span>
<span class="token1">[</span>market_price<span class="token1">]</span> <span class="token">=</span><span class="token">></span> <span class="token6">200.3</span>
<span class="token1">[</span>price<span class="token1">]</span> <span class="token">=</span><span class="token">></span> <span class="token6">152.3</span>
<span class="token1">[</span>stock<span class="token1">]</span> <span class="token">=</span><span class="token">></span> <span class="token6">2000</span>
<span class="token1">[</span>alarm<span class="token1">]</span> <span class="token">=</span><span class="token">></span> <span class="token6">20</span>
<span class="token1">[</span>sku<span class="token1">]</span> <span class="token">=</span><span class="token">></span> A002
<span class="token1">)</span>
<span class="token1">)</span>
$sgcate_id <span class="token">=</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> <span class="token6">2</span> <span class="token5">//店铺分类id</span>
<span class="token1">)</span>
```
```
#### 编辑图片
```
<pre class="calibre14">```
get:/index.php?ctl=Api_Goods_Goods&met=saveGoodsImage&typ=json
*int:common_id#商品common_id
*row:image#商品图片信息
int:is_color#是否含有颜色规格 1-有,不含有颜色规格不传值
<<<
success
{
"cmd_id":-140,
"status":200,
"msg":"success",
"data":[
[
{
"name":"[http://localhost/bbc/shop/image.php/shop/data/upload/media/421aa90e079fa326b6494f812ad13e79/10018/4/image/20190419/1555661347887530.png]", //图片地址
"default":"1", //默认主题,1是,0否
"displayorder":"0" //排序
},
{
"name":"",
"default":"",
"displayorder":"0"
},
{
"name":"",
"default":"",
"displayorder":"0"
},
{
"name":"",
"default":"",
"displayorder":"0"
},
{
"name":"",
"default":"",
"displayorder":"0"
}
]
]
}
<<<
error
{
"cmd_id":-140,
"status":250,
"msg":"缺少common_id",
"data":[ ]
}
{
"cmd_id":-140,
"status":250,
"msg":"缺少图片信息",
"data":[ ]
}
```
```
```
<pre class="calibre15">```
<span class="token">~</span><span class="token">~</span><span class="token">~</span>
$image <span class="token">=</span><span class="token">></span> Array
<span class="token1">(</span>
<span class="token1">[</span><span class="token6">53</span><span class="token1">]</span> <span class="token">=</span><span class="token">></span> Array <span class="token5">//有颜色规格则主键为颜色规格id ,没有颜色规格则主键为0</span>
<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>name<span class="token1">]</span> <span class="token">=</span><span class="token">></span> http<span class="token1">:</span><span class="token">/</span><span class="token">/</span>localhost<span class="token">/</span>bbc<span class="token">/</span>shop<span class="token">/</span>image<span class="token1">.</span>php<span class="token">/</span>shop<span class="token">/</span>data<span class="token">/</span>upload<span class="token">/</span>media<span class="token">/</span><span class="token6">421</span>aa90e079fa326b6494f812ad13e79<span class="token">/</span><span class="token6">10018</span><span class="token">/</span><span class="token6">4</span><span class="token">/</span>image<span class="token">/</span><span class="token6">20190419</span><span class="token">/</span><span class="token6">1555661347887530.</span>png <span class="token5">//图片地址</span>
<span class="token1">[</span>default<span class="token1">]</span> <span class="token">=</span><span class="token">></span> <span class="token6">1</span> <span class="token5">//默认主题,1是,0否</span>
<span class="token1">[</span>displayorder<span class="token1">]</span> <span class="token">=</span><span class="token">></span> <span class="token6">0</span> <span class="token5">//排序</span>
<span class="token1">)</span>
<span class="token1">[</span><span class="token6">1</span><span class="token1">]</span> <span class="token">=</span><span class="token">></span> Array
<span class="token1">(</span>
<span class="token1">[</span>name<span class="token1">]</span> <span class="token">=</span><span class="token">></span>
<span class="token1">[</span>default<span class="token1">]</span> <span class="token">=</span><span class="token">></span> <span class="token6">0</span>
<span class="token1">[</span>displayorder<span class="token1">]</span> <span class="token">=</span><span class="token">></span> <span class="token6">0</span>
<span class="token1">)</span>
<span class="token1">[</span><span class="token6">2</span><span class="token1">]</span> <span class="token">=</span><span class="token">></span> Array
<span class="token1">(</span>
<span class="token1">[</span>name<span class="token1">]</span> <span class="token">=</span><span class="token">></span>
<span class="token1">[</span>default<span class="token1">]</span> <span class="token">=</span><span class="token">></span> <span class="token6">0</span>
<span class="token1">[</span>displayorder<span class="token1">]</span> <span class="token">=</span><span class="token">></span> <span class="token6">0</span>
<span class="token1">)</span>
<span class="token1">[</span><span class="token6">3</span><span class="token1">]</span> <span class="token">=</span><span class="token">></span> Array
<span class="token1">(</span>
<span class="token1">[</span>name<span class="token1">]</span> <span class="token">=</span><span class="token">></span>
<span class="token1">[</span>default<span class="token1">]</span> <span class="token">=</span><span class="token">></span> <span class="token6">0</span>
<span class="token1">[</span>displayorder<span class="token1">]</span> <span class="token">=</span><span class="token">></span> <span class="token6">0</span>
<span class="token1">)</span>
<span class="token1">[</span><span class="token6">4</span><span class="token1">]</span> <span class="token">=</span><span class="token">></span> Array
<span class="token1">(</span>
<span class="token1">[</span>name<span class="token1">]</span> <span class="token">=</span><span class="token">></span>
<span class="token1">[</span>default<span class="token1">]</span> <span class="token">=</span><span class="token">></span> <span class="token6">0</span>
<span class="token1">[</span>displayorder<span class="token1">]</span> <span class="token">=</span><span class="token">></span> <span class="token6">0</span>
<span class="token1">)</span>
<span class="token1">)</span>
<span class="token1">[</span><span class="token6">165</span><span class="token1">]</span> <span class="token">=</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>name<span class="token1">]</span> <span class="token">=</span><span class="token">></span> http<span class="token1">:</span><span class="token">/</span><span class="token">/</span>localhost<span class="token">/</span>bbc<span class="token">/</span>shop<span class="token">/</span>image<span class="token1">.</span>php<span class="token">/</span>shop<span class="token">/</span>data<span class="token">/</span>upload<span class="token">/</span>media<span class="token">/</span><span class="token6">421</span>aa90e079fa326b6494f812ad13e79<span class="token">/</span><span class="token6">10018</span><span class="token">/</span><span class="token6">4</span><span class="token">/</span>image<span class="token">/</span><span class="token6">20190507</span><span class="token">/</span><span class="token6">1557208836124082.</span>png
<span class="token1">[</span>default<span class="token1">]</span> <span class="token">=</span><span class="token">></span>
<span class="token1">[</span>displayorder<span class="token1">]</span> <span class="token">=</span><span class="token">></span> <span class="token6">0</span>
<span class="token1">)</span>
<span class="token1">[</span><span class="token6">1</span><span class="token1">]</span> <span class="token">=</span><span class="token">></span> Array
<span class="token1">(</span>
<span class="token1">[</span>name<span class="token1">]</span> <span class="token">=</span><span class="token">></span> http<span class="token1">:</span><span class="token">/</span><span class="token">/</span>localhost<span class="token">/</span>bbc_jiheng<span class="token">/</span>shop<span class="token">/</span>image<span class="token1">.</span>php<span class="token">/</span>shop<span class="token">/</span>data<span class="token">/</span>upload<span class="token">/</span>media<span class="token">/</span><span class="token6">421</span>aa90e079fa326b6494f812ad13e79<span class="token">/</span><span class="token6">10018</span><span class="token">/</span><span class="token6">4</span><span class="token">/</span>image<span class="token">/</span><span class="token6">20190507</span><span class="token">/</span><span class="token6">1557208894771000.</span>png
<span class="token1">[</span>default<span class="token1">]</span> <span class="token">=</span><span class="token">></span>
<span class="token1">[</span>displayorder<span class="token1">]</span> <span class="token">=</span><span class="token">></span> <span class="token6">0</span>
<span class="token1">)</span>
<span class="token1">[</span><span class="token6">2</span><span class="token1">]</span> <span class="token">=</span><span class="token">></span> Array
<span class="token1">(</span>
<span class="token1">[</span>name<span class="token1">]</span> <span class="token">=</span><span class="token">></span>
<span class="token1">[</span>default<span class="token1">]</span> <span class="token">=</span><span class="token">></span>
<span class="token1">[</span>displayorder<span class="token1">]</span> <span class="token">=</span><span class="token">></span> <span class="token6">0</span>
<span class="token1">)</span>
<span class="token1">[</span><span class="token6">3</span><span class="token1">]</span> <span class="token">=</span><span class="token">></span> Array
<span class="token1">(</span>
<span class="token1">[</span>name<span class="token1">]</span> <span class="token">=</span><span class="token">></span>
<span class="token1">[</span>default<span class="token1">]</span> <span class="token">=</span><span class="token">></span>
<span class="token1">[</span>displayorder<span class="token1">]</span> <span class="token">=</span><span class="token">></span> <span class="token6">0</span>
<span class="token1">)</span>
<span class="token1">[</span><span class="token6">4</span><span class="token1">]</span> <span class="token">=</span><span class="token">></span> Array
<span class="token1">(</span>
<span class="token1">[</span>name<span class="token1">]</span> <span class="token">=</span><span class="token">></span>
<span class="token1">[</span>default<span class="token1">]</span> <span class="token">=</span><span class="token">></span>
<span class="token1">[</span>displayorder<span class="token1">]</span> <span class="token">=</span><span class="token">></span> <span class="token6">0</span>
<span class="token1">)</span>
<span class="token1">)</span>
<span class="token1">)</span>
<span class="token">~</span><span class="token">~</span><span class="token">~</span>
```
```
- 序言
- 系统要求
- 版本更新日志
- 远丰商城技术对接说明
- 开发指导
- 框架内容
- 基础
- 开发规范
- 目录结构
- 架构
- 架构总览
- 数据库
- 数据库连接
- 基本使用
- 缓存
- 配置
- 路由
- 数据字典
- ucenter
- shop
- paycenter
- ucenter_admin
- shop_admin
- paycenter_admin
- 通讯内容
- 商家中心
- 顶部导航栏
- 店铺信息栏
- 店铺及商品提示栏
- 交易提示栏
- 销售情况统计栏
- 单品销量排行栏
- 店铺运营推广栏
- 平台联系方式栏
- 订单物流
- 商品
- 商品列表
- 商品详情
- 商品发布与编辑
- 分销商品
- 关联版式
- 商品规格
- 图片空间
- 淘宝导入
- 订单流程
- 交易订单
- 订单退款/退货
- 促销
- 团购管理
- 加价购
- 限时折扣
- 满即送
- 代金券管理
- 分销
- 店铺
- 店铺设置
- 自销产品供应商
- 实体店铺
- 品牌申请
- 店铺信息
- 消费者保障服务
- 门店账号
- 分销商--产品供应商
- 分销明细
- 批发市场
- 售后服务
- 咨询管理
- 投诉管理
- 退款管理
- 退货管理
- 云方案架构
- 负载集群
- 云存储
- 接口
- Api接口说明
- 品牌
- 商品规格
- 商品类型
- 商品分类
- 商品
- 订单
- 商品/店铺收藏
- 足迹
- 退款及退货
- 商家店铺
- 会员
- 入驻协议
- 订单接口
- 商品接口
- 订单物流接口
- 商家中心接口
- 促销接口
- 快递鸟物流接口
- 代金券接口
- 首页版块
- 团购
- 平台红包
- 限时折扣接口
- 拼团接口
- wap首页模板
- 杂项
- 远程上传图片
- JS
- 银联支付
- 多语言
- 商品评分
- 图片加载
- 买家申请退款退货
- 商家退款退货
- 平台退款退货
- 添加发票
- 提交订单
- 确认订单
- 运费销售区域
- 获取会员地址
- 充值
- 导出XLS
- 商城系统集成
- 多语言实现
- 三级分销推广链接发展推广员
- app.ini.php
- 去分销
- 版本更新
- 物流支持
- 运营人员建议
- 业务逻辑
- 统计结算
- 客服消息
- 账号
- 三级分销
- IM
- 配置
- 平台帐号
- 活动数据表说明