线下商品同步线上
<h1>线下商品同步线上</h1>
<h2>请求URL</h2>
<p>POST localhost/addons/yun_shop/api.php?route=plugin.wisely-system.open.goods.push&i=1</p>
<h2>请求参数</h2>
<table>
<thead>
<tr>
<th>参数名</th>
<th>类型</th>
<th>是否必需</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>body.mobile</td>
<td>string</td>
<td>是</td>
<td>当前时间戳(秒级10位) *参加签名</td>
</tr>
<tr>
<td>body.timestamp</td>
<td>string</td>
<td>是</td>
<td>当前时间戳(秒级10位) *参加签名</td>
</tr>
<tr>
<td>body.notstr</td>
<td>string</td>
<td>是</td>
<td>a-z A-Z 1-9, 随机12位字符串 *参加签名</td>
</tr>
<tr>
<td>goods</td>
<td>array[object]</td>
<td>是</td>
<td>商品</td>
</tr>
<tr>
<td>goods[].category_name</td>
<td>string</td>
<td>否</td>
<td>商品分类名称</td>
</tr>
<tr>
<td>goods[].display_order</td>
<td>string</td>
<td>否</td>
<td>排序, 数字越大, 显示越前</td>
</tr>
<tr>
<td>goods[].title</td>
<td>string</td>
<td>是</td>
<td>商品名称 (柬文)</td>
</tr>
<tr>
<td>goods[].alias</td>
<td>string</td>
<td>否</td>
<td>商品简称 (中文)</td>
</tr>
<tr>
<td>goods[].sku</td>
<td>string</td>
<td>是</td>
<td>商品单位 如: 个/件/包</td>
</tr>
<tr>
<td>goods[].is_recommand</td>
<td>string</td>
<td>否</td>
<td>推荐</td>
</tr>
<tr>
<td>goods[].is_new</td>
<td>string</td>
<td>否</td>
<td>新上</td>
</tr>
<tr>
<td>goods[].is_hot</td>
<td>string</td>
<td>否</td>
<td>热卖</td>
</tr>
<tr>
<td>goods[].is_discount</td>
<td>string</td>
<td>否</td>
<td>促销</td>
</tr>
<tr>
<td>goods[].thumb</td>
<td>string</td>
<td>是</td>
<td>图片地址</td>
</tr>
<tr>
<td>goods[].price</td>
<td>string</td>
<td>是</td>
<td>现价</td>
</tr>
<tr>
<td>goods[].market_price</td>
<td>string</td>
<td>是</td>
<td>原价</td>
</tr>
<tr>
<td>goods[].cost_price</td>
<td>string</td>
<td>是</td>
<td>成本价</td>
</tr>
<tr>
<td>goods[].goods_sn</td>
<td>string</td>
<td>是</td>
<td>商品编码 注:ERP对应货号</td>
</tr>
<tr>
<td>goods[].product_sn</td>
<td>string</td>
<td>是</td>
<td>商品条码 注:ERP对应条码</td>
</tr>
<tr>
<td>goods[].weight</td>
<td>string</td>
<td>否</td>
<td>重量</td>
</tr>
<tr>
<td>goods[].volume</td>
<td>string</td>
<td>否</td>
<td>体积</td>
</tr>
<tr>
<td>goods[].virtual_sales</td>
<td>string</td>
<td>否</td>
<td>第三方销量</td>
</tr>
<tr>
<td>goods[].stock</td>
<td>string</td>
<td>是</td>
<td>库存</td>
</tr>
<tr>
<td>goods[].status</td>
<td>string</td>
<td>是</td>
<td>上下架 0下架 1上架</td>
</tr>
</tbody>
</table>
<h3>请求示例</h3>
<pre><code>localhost/addons/yun_shop/api.php?route=plugin.wisely-system.open.goods.push&amp;i=1
{
&quot;body&quot;: {
&quot;notstr&quot;: &quot;kutciyozow64&quot;,
&quot;timestamp&quot;: 1713890387
},
&quot;goods&quot;: [
{
&quot;category&quot;: [
[
{
&quot;id&quot;: 3,
&quot;level&quot;: 1
},
{
&quot;id&quot;: 22,
&quot;level&quot;: 2
}
]
],
&quot;display_order&quot;: &quot;3007&quot;,
&quot;title&quot;: &quot;接口测试商品&quot;,
&quot;alias&quot;: &quot;测试商品&quot;,
&quot;type&quot;: 1,
&quot;need_address&quot;: 0,
&quot;sku&quot;: &quot;个&quot;,
&quot;is_recommand&quot;: 1,
&quot;is_new&quot;: &quot;0&quot;,
&quot;is_hot&quot;: 1,
&quot;is_discount&quot;: 0,
&quot;price&quot;: &quot;11&quot;,
&quot;market_price&quot;: &quot;12&quot;,
&quot;cost_price&quot;: &quot;123&quot;,
&quot;goods_sn&quot;: &quot;SPBM12345&quot;,
&quot;product_sn&quot;: &quot;SPTM12345&quot;,
&quot;weight&quot;: &quot;20&quot;,
&quot;volume&quot;: &quot;30&quot;,
&quot;virtual_sales&quot;: &quot;9999&quot;,
&quot;stock&quot;: &quot;99999&quot;,
&quot;status&quot;: 0
},
{
&quot;category&quot;: [
[
{
&quot;id&quot;: 3,
&quot;level&quot;: 1
},
{
&quot;id&quot;: 22,
&quot;level&quot;: 2
}
]
],
&quot;display_order&quot;: &quot;3007&quot;,
&quot;title&quot;: &quot;接口测试商品&quot;,
&quot;alias&quot;: &quot;测试商品&quot;,
&quot;type&quot;: 1,
&quot;need_address&quot;: 0,
&quot;sku&quot;: &quot;个&quot;,
&quot;is_recommand&quot;: 1,
&quot;is_new&quot;: &quot;0&quot;,
&quot;is_hot&quot;: 1,
&quot;is_discount&quot;: 0,
&quot;price&quot;: &quot;11&quot;,
&quot;market_price&quot;: &quot;12&quot;,
&quot;cost_price&quot;: &quot;123&quot;,
&quot;goods_sn&quot;: &quot;SPBM12345&quot;,
&quot;product_sn&quot;: &quot;SPTM12345&quot;,
&quot;weight&quot;: &quot;20&quot;,
&quot;volume&quot;: &quot;30&quot;,
&quot;virtual_sales&quot;: &quot;9999&quot;,
&quot;stock&quot;: &quot;99999&quot;,
&quot;status&quot;: 0
}
],
&quot;sign&quot;: &quot;83ddacb6f5dd9e738e481c2a3a988686&quot;
}</code></pre>
<h2>响应参数</h2>
<table>
<thead>
<tr>
<th>参数名</th>
<th>类型</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>result</td>
<td>int</td>
<td>结果. 0 = 失败, 1成功</td>
</tr>
<tr>
<td>msg</td>
<td>string</td>
<td>信息。</td>
</tr>
<tr>
<td>data</td>
<td>object</td>
<td>-</td>
</tr>
</tbody>
</table>
<h3>响应成功</h3>
<pre><code class="language-json">{
&quot;result&quot;: 1,
&quot;msg&quot;: &quot;商品创建成功&quot;,
&quot;data&quot;: {
&quot;good_id&quot;: 322
}
}</code></pre>
<h3>响应失败</h3>
<pre><code class="language-json">{
&quot;result&quot;: 0,
&quot;msg&quot;: &quot;请输入图片地址&quot;,
&quot;data&quot;: []
}</code></pre>