加入购物车接口
<p><strong>接口说明 </strong></p>
<pre><code>请求接口: /kmall/app/cart/add
请求方式: POST
接口说明: 加入购物车接口(需登录)</code></pre>
<p><strong>请求参数 </strong></p>
<table>
<thead>
<tr>
<th>参数名</th>
<th>必选</th>
<th>长度</th>
<th>类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>productId</td>
<td>int</td>
<td>20</td>
<td>是</td>
<td>商品id</td>
</tr>
<tr>
<td>quantity</td>
<td>int</td>
<td>4</td>
<td>是</td>
<td>商品数量(不大于0执行删除操作)</td>
</tr>
</tbody>
</table>
<p><strong>返回参数</strong></p>
<table>
<thead>
<tr>
<th>参数名</th>
<th>类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>code</td>
<td>string</td>
<td>状态值</td>
</tr>
<tr>
<td>msg</td>
<td>string</td>
<td>返回消息</td>
</tr>
<tr>
<td>id</td>
<td>string</td>
<td>商品id</td>
</tr>
<tr>
<td>shopId</td>
<td>int</td>
<td>店铺id</td>
</tr>
<tr>
<td>shopName</td>
<td>string</td>
<td>店铺名称</td>
</tr>
<tr>
<td>productName</td>
<td>string</td>
<td>商品名称</td>
</tr>
<tr>
<td>mainPic</td>
<td>string</td>
<td>商品主图</td>
</tr>
<tr>
<td>quantity</td>
<td>string</td>
<td>购买数量</td>
</tr>
<tr>
<td>marketPrice</td>
<td>string</td>
<td>商品市场价</td>
</tr>
<tr>
<td>price</td>
<td>string</td>
<td>商品现价</td>
</tr>
<tr>
<td>totalAmount</td>
<td>string</td>
<td>购买总价</td>
</tr>
</tbody>
</table>
<p><strong>返回示例</strong></p>
<pre><code>成功:
{
"code": "0000",
"msg": "操作成功!",
"data":{
"totalNum": 1,
"totalAmount": "50.0",
"item":[{
"shopId": 1,
"shopName": "张三店",
"cart":[
{
"id": 1,
"productName": "测试商品111",
"mainPic": "",
"quantity": 1,
"marketPrice": 90.0,
"price": 50.0,
"totalAmount": 50.0
}
]}
]
}
}
失败:
{
"code": "0001",
"msg": "(悦邻汇)店家正在休息中,请稍后再试!",
"data": null
}</code></pre>