##購物車接口 ###1商品列表:商品信息(手機,配件,贈品),數量 ####Request:shell
GET /cart/{userId}
json
curl -X GET --header 'Accept: application/json' 'http://localhost:8080/cart/4613154'
userId:用戶名 ####Response: 返回類型:json; 無分頁要求;數組
key | value | 其餘 |
---|---|---|
totalCount | 商品總數 | 大於小於0 |
items | 商品列表 (全部商品) | 數組,可無元素 |
goods | 商品信息 | json對象 |
gift | 贈品信息 | 數組結構,可無元素 |
id | 商品主鍵 | 通用字段 |
goodsId | 商品主鍵 | 通用字段 |
type | 商品類型 | 通用字段 |
name | 商品名稱 | 通用字段 |
picUrl | 圖片地址 | 通用字段 |
price | 價格或積分 | 通用字段,根據goodsType判斷是錢數仍是積分數 |
url | 商品url | 通用字段 |
enable | 是否可結算 | true可結算;false不可結算 |
point | 每項商品的積分總和 | 通用字段,可爲0 |
totalPrice | 該商品總錢數 | 通用字段,可爲0 |
attrs | 商品詳情 | 通用字段,數組類型,可無元素 |
goodsType商品類型(預留)網絡
Key | value |
---|---|
code | 類型編號(待定) |
name | 類型名稱(待定) |
{ "items": [ { "goods": { "id": "12", "type": "手機", "name": "測試", "picUrl": "urlllllll", "price": 100, "attrs": [ "網絡類型:4G", "顏色: 白色", "規格: 32G", ], "enable": true }, "count": 4, "point":400, "price":160, "gifts": [ { "name": "ceshi", "goodsId": "12", "count": 3 } ] } ], "totalCount": 4 }
活動信息待定app
若是服務端異常,則告之其異常curl
####request測試
POST /cart
url
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' 'http://localhost:8080/cart?userId=4513244&goodsId=1&count=1'
請求參數code
key | value |
---|---|
userId | 用戶id |
goodId | 商品id |
count | 商品數量,正負皆可 |
####Reponse:對象
若是購物項實際已刪除,則不返回數據;購物車項存在,返回該購物車項的數據
{ "goods": { "id": "2", "type": "手機", "name": "測試", "picUrl": "urlllllll", "price": 100, "attrs": [ "規格:64G", "顏色:綠色" ], "enable": true }, "count": 1, "gifts": [ { "name": "ceshi", "goodsId": "2", "count": 3 } ], "point": 200 }
key | value | 其餘 |
---|---|---|
totalCount | 商品總數 | 大於小於0 |
items | 商品列表 (全部商品) | 數組,可無元素 |
goods | 商品信息 | json對象 |
gift | 贈品信息 | 數組結構,可無元素 |
id | 商品主鍵 | 通用字段 |
goodsId | 商品主鍵 | 通用字段 |
type | 商品類型 | 通用字段 |
name | 商品名稱 | 通用字段 |
picUrl | 圖片地址 | 通用字段 |
price | 價格或積分 | 通用字段,根據goodsType判斷是錢數仍是積分數 |
enable | 是否可結算 | true可結算;false不可結算 |
point | 每項商品的積分總和 | 通用字段,可爲0 |
totalPrice | 該商品總錢數 | 通用字段,可爲0 |
attrs | 商品詳情 | 通用字段,數組類型,可無元素 |
若是服務端異常,則返回異常狀態