api demo 京东商品详情_jd-demo
一個仿京東的網站:
后端使用java,基本架構:springMVC + spring + mybatis;
前端技術:Html+CSS+JQuery+React+Sass...
后臺接口說明:
####1.統計用戶、商品、訂單數量
/manage/statistic/base_count.do
request
無
response
success
{
"status": 0,
"data": {
userCount: 123,
productCount: 456,
orderCount: 789
}
}
fail
{
"status": 10,
"msg": "用戶未登錄,請登錄"
}
或
{
"status": 1,
"msg": "出錯啦"
}
####1.后臺管理員登錄
/manage/user/login.do
request
String username,
String password
response
success
{
"status": 0,
"data": {
"id": 12,
"username": "aaa",
"email": "aaa@163.com",
"phone": null,
"role": 0,
"createTime": 1479048325000,
"updateTime": 1479048325000
}
}
fail
{
"status": 1,
"msg": "密碼錯誤"
}
####2.用戶列表
/manage/user/list.do
request
pageSize(default=10)
pageNum(default=1)
response
success
{
"status": 0,
"data": {
"pageNum": 1,
"pageSize": 3,
"size": 3,
"orderBy": null,
"startRow": 1,
"endRow": 3,
"total": 16,
"pages": 6,
"list": [
{
"id":17,
"username":"rosen",
"password":"",
"email":"rosen1@happymmall.com",
"phone":"15011111111",
"question":"啊哈哈",
"answer":"服不服",
"role":0,
"createTime":1489719093000,
"updateTime":1513682138000
},
{
"id":17,
"username":"rosen",
"password":"",
"email":"rosen1@happymmall.com",
"phone":"15011111111",
"question":"啊哈哈",
"answer":"服不服",
"role":0,
"createTime":1489719093000,
"updateTime":1513682138000
}
],
"firstPage": 1,
"prePage": 0,
"nextPage": 2,
"lastPage": 6,
"isFirstPage": true,
"isLastPage": false,
"hasPreviousPage": false,
"hasNextPage": true,
"navigatePages": 8,
"navigatepageNums": [
1,
2,
3,
4,
5,
6
]
}
}
fail
{
"status": 10,
"msg": "用戶未登錄,請登錄"
}
或
{
"status": 1,
"msg": "沒有權限"
}
####3.模板
/REPLACE/.do
request
k
response
success
k
fail
k
[MENU]
####1.產品list
/manage/product/list.do
request
pageNum(default=1)
pageSize(default=10)
response
success
{
"status": 0,
"data": {
"pageNum": 1,
"pageSize": 10,
"size": 2,
"orderBy": null,
"startRow": 1,
"endRow": 2,
"total": 2,
"pages": 1,
"list": [
{
"id": 1,
"categoryId": 3,
"name": "iphone7",
"subtitle": "雙十一促銷",
"mainImage": "mainimage.jpg",
"status":1,
"price": 7199.22
},
{
"id": 2,
"categoryId": 2,
"name": "oppo R8",
"subtitle": "oppo促銷進行中",
"mainImage": "mainimage.jpg",
"status":1,
"price": 2999.11
}
],
"firstPage": 1,
"prePage": 0,
"nextPage": 0,
"lastPage": 1,
"isFirstPage": true,
"isLastPage": true,
"hasPreviousPage": false,
"hasNextPage": false,
"navigatePages": 8,
"navigatepageNums": [
1
]
}
}
fail
{
"status": 10,
"msg": "用戶未登錄,請登錄"
}
####2.產品搜索
/manage/product/search.do
request
productName
productId
pageNum(default=1)
pageSize(default=10)
response
success
{
"status": 0,
"data": {
"pageNum": 1,
"pageSize": 10,
"size": 1,
"orderBy": null,
"startRow": 1,
"endRow": 1,
"total": 1,
"pages": 1,
"list": [
{
"id": 1,
"categoryId": 3,
"name": "iphone7",
"subtitle": "雙十一促銷",
"mainImage": "mainimage.jpg",
"price": 7199.22
}
],
"firstPage": 1,
"prePage": 0,
"nextPage": 0,
"lastPage": 1,
"isFirstPage": true,
"isLastPage": true,
"hasPreviousPage": false,
"hasNextPage": false,
"navigatePages": 8,
"navigatepageNums": [
1
]
}
}
fail
{
"status": 10,
"msg": "用戶未登錄,請登錄"
}
####3.圖片上傳
/manage/product/upload.do
request
response
success
{
"status": 0,
"data": {
"uri": "e6604558-c0ff-41b9-b6e1-30787a1e3412.jpg",
"url": "http://img.happymmall.com/e6604558-c0ff-41b9-b6e1-30787a1e3412.jpg"
}
}
fail
status!=0的時候
####4.產品詳情
/manage/product/detail.do
request
productId
response
success
{
"status": 0,
"data": {
"id": 2,
"categoryId": 2,
"parentCategoryId":1,
"name": "oppo R8",
"subtitle": "oppo促銷進行中",
"imageHost": "http://img.happymmall.com/",
"mainImage": "mainimage.jpg",
"subImages": "[\"mmall/aa.jpg\",\"mmall/bb.jpg\",\"mmall/cc.jpg\",\"mmall/dd.jpg\",\"mmall/ee.jpg\"]",
"detail": "richtext",
"price": 2999.11,
"stock": 71,
"status": 1,
"createTime": "2016-11-20 14:21:53",
"updateTime": "2016-11-20 14:21:53"
}
}
fail
{
"status": 1,
"msg": "沒有權限"
}
####5.產品上下架
/manage/product/set_sale_status.do
request
productId
status
response
success
{
"status": 0,
"data": "修改產品狀態成功"
}
fail
{
"status": 1,
"data": "修改產品狀態失敗"
}
####6.新增OR更新產品
新增
/manage/product/save.do
request
categoryId=1&name=三星洗衣機&subtitle=三星大促銷&mainImage=sss.jpg&subImages=test.jpg&detail=detailtext&price=1000&stock=100&status=1&id=3
response
success
{
"status": 0,
"data": "更新產品成功"
}
或
{
"status": 0,
"data": "新增產品成功"
}
fail
{
"status": 1,
"data": "更新產品失敗"
}
####7.富文本上傳圖片
/manage/product/richtext_img_upload.do
request
response
success
{
"file_path": "http://img.happymmall.com/5fb239f2-0007-40c1-b8e6-0dc11b22779c.jpg",
"msg": "上傳成功",
"success": true
}
fail
{
"success": false,
"msg": "error message",
"file_path": "[real file path]"
}
[MENU]
####1.獲取品類子節點(平級)
/manage/category/get_category.do
request
categoryId(default=0)
response
success
{
"status": 0,
"data": [
{
"id": 2,
"parentId": 1,
"name": "手機",
"status": true,
"sortOrder": 3,
"createTime": 1479622913000,
"updateTime": 1479622913000
},
{
"id": 4,
"parentId": 1,
"name": "移動座機",
"status": true,
"sortOrder": 5,
"createTime": 1480059936000,
"updateTime": 1480491941000
}
]
}
fail
{
"status": 10,
"msg": "用戶未登錄,請登錄"
}
或
{
"status": 1,
"msg": "未找到該品類"
}
####2.增加節點
/manage/category/add_category.do
request
parentId(default=0)
categoryName
response
success
{
"status": 0,
"msg": "添加品類成功"
}
fail
{
"status":1,
"msg": "添加品類失敗"
}
####3.修改品類名字
/manage/category/set_category_name.do
request
categoryId
categoryName
response
success
{
"status": 0,
"msg": "更新品類名字成功"
}
fail
{
"status": 1,
"msg": "更新品類名字失敗"
}
####4.獲取當前分類id及遞歸子節點categoryId
/manage/category/get_deep_category.do
request
categoryId
response
success
{
"status": 0,
"data": [
100009,
100010,
100001,
100006,
100007,
100008
]
}
fail
{
"status": 1,
"msg": "無權限"
}
[MENU]
####1.訂單List
/manage/order/list.do
request
pageSize(default=10)
pageNum(default=1)
response
success
{
"status": 0,
"data": {
"pageNum": 1,
"pageSize": 3,
"size": 3,
"orderBy": null,
"startRow": 1,
"endRow": 3,
"total": 16,
"pages": 6,
"list": [
{
"orderNo": 1485158676346,
"payment": 2999.11,
"paymentType": 1,
"paymentTypeDesc": "在線支付",
"postage": 0,
"status": 10,
"statusDesc": "未支付",
"paymentTime": "2017-02-11 12:27:18",
"sendTime": "2017-02-11 12:27:18",
"endTime": "2017-02-11 12:27:18",
"closeTime": "2017-02-11 12:27:18",
"createTime": "2017-01-23 16:04:36",
"orderItemVoList": [
{
"orderNo": 1485158676346,
"productId": 2,
"productName": "oppo R8",
"productImage": "mainimage.jpg",
"currentUnitPrice": 2999.11,
"quantity": 1,
"totalPrice": 2999.11,
"createTime": "2017-01-23 16:04:36"
}
],
"imageHost": "http://img.happymmall.com/",
"shippingId": 5,
"shippingVo": null
},
{
"orderNo": 1485158675516,
"payment": 2999.11,
"paymentType": 1,
"paymentTypeDesc": "在線支付",
"postage": 0,
"status": 10,
"statusDesc": "未支付",
"paymentTime": "2017-02-11 12:27:18",
"sendTime": "2017-02-11 12:27:18",
"endTime": "2017-02-11 12:27:18",
"closeTime": "2017-02-11 12:27:18",
"createTime": "2017-01-23 16:04:35",
"orderItemVoList": [
{
"orderNo": 1485158675516,
"productId": 2,
"productName": "oppo R8",
"productImage": "mainimage.jpg",
"currentUnitPrice": 2999.11,
"quantity": 1,
"totalPrice": 2999.11,
"createTime": "2017-01-23 16:04:35"
}
],
"imageHost": "http://img.happymmall.com/",
"shippingId": 5,
"receiverName": "geely",
"shippingVo": null
},
{
"orderNo": 1485158675316,
"payment": 2999.11,
"paymentType": 1,
"paymentTypeDesc": "在線支付",
"postage": 0,
"status": 10,
"statusDesc": "未支付",
"paymentTime": "2017-02-11 12:27:18",
"sendTime": "2017-02-11 12:27:18",
"endTime": "2017-02-11 12:27:18",
"closeTime": "2017-02-11 12:27:18",
"createTime": "2017-01-23 16:04:35",
"orderItemVoList": [
{
"orderNo": 1485158675316,
"productId": 2,
"productName": "oppo R8",
"productImage": "mainimage.jpg",
"currentUnitPrice": 2999.11,
"quantity": 1,
"totalPrice": 2999.11,
"createTime": "2017-01-23 16:04:35"
}
],
"imageHost": "http://img.happymmall.com/",
"shippingId": 5,
"receiverName": "geely",
"shippingVo": null
}
],
"firstPage": 1,
"prePage": 0,
"nextPage": 2,
"lastPage": 6,
"isFirstPage": true,
"isLastPage": false,
"hasPreviousPage": false,
"hasNextPage": true,
"navigatePages": 8,
"navigatepageNums": [
1,
2,
3,
4,
5,
6
]
}
}
fail
{
"status": 10,
"msg": "用戶未登錄,請登錄"
}
或
{
"status": 1,
"msg": "沒有權限"
}
####2.按訂單號查詢
/manage/order/search.do
request
orderNo
response
success
{
"status": 0,
"data": {
"pageNum": 1,
"pageSize": 3,
"size": 3,
"orderBy": null,
"startRow": 1,
"endRow": 3,
"total": 16,
"pages": 6,
"list": [
{
"orderNo": 1485158676346,
"payment": 2999.11,
"paymentType": 1,
"paymentTypeDesc": "在線支付",
"postage": 0,
"status": 10,
"statusDesc": "未支付",
"paymentTime": "2017-02-11 12:27:18",
"sendTime": "2017-02-11 12:27:18",
"endTime": "2017-02-11 12:27:18",
"closeTime": "2017-02-11 12:27:18",
"createTime": "2017-01-23 16:04:36",
"orderItemVoList": [
{
"orderNo": 1485158676346,
"productId": 2,
"productName": "oppo R8",
"productImage": "mainimage.jpg",
"currentUnitPrice": 2999.11,
"quantity": 1,
"totalPrice": 2999.11,
"createTime": "2017-01-23 16:04:36"
}
],
"imageHost": "http://img.happymmall.com/",
"shippingId": 5,
"shippingVo": null
},
{
"orderNo": 1485158675516,
"payment": 2999.11,
"paymentType": 1,
"paymentTypeDesc": "在線支付",
"postage": 0,
"status": 10,
"statusDesc": "未支付",
"paymentTime": "2017-02-11 12:27:18",
"sendTime": "2017-02-11 12:27:18",
"endTime": "2017-02-11 12:27:18",
"closeTime": "2017-02-11 12:27:18",
"createTime": "2017-01-23 16:04:35",
"orderItemVoList": [
{
"orderNo": 1485158675516,
"productId": 2,
"productName": "oppo R8",
"productImage": "mainimage.jpg",
"currentUnitPrice": 2999.11,
"quantity": 1,
"totalPrice": 2999.11,
"createTime": "2017-01-23 16:04:35"
}
],
"imageHost": "http://img.happymmall.com/",
"shippingId": 5,
"receiverName": "geely",
"shippingVo": null
},
{
"orderNo": 1485158675316,
"payment": 2999.11,
"paymentType": 1,
"paymentTypeDesc": "在線支付",
"postage": 0,
"status": 10,
"statusDesc": "未支付",
"paymentTime": "2017-02-11 12:27:18",
"sendTime": "2017-02-11 12:27:18",
"endTime": "2017-02-11 12:27:18",
"closeTime": "2017-02-11 12:27:18",
"createTime": "2017-01-23 16:04:35",
"orderItemVoList": [
{
"orderNo": 1485158675316,
"productId": 2,
"productName": "oppo R8",
"productImage": "mainimage.jpg",
"currentUnitPrice": 2999.11,
"quantity": 1,
"totalPrice": 2999.11,
"createTime": "2017-01-23 16:04:35"
}
],
"imageHost": "http://img.happymmall.com/",
"shippingId": 5,
"receiverName": "geely",
"shippingVo": null
}
],
"firstPage": 1,
"prePage": 0,
"nextPage": 2,
"lastPage": 6,
"isFirstPage": true,
"isLastPage": false,
"hasPreviousPage": false,
"hasNextPage": true,
"navigatePages": 8,
"navigatepageNums": [
1,
2,
3,
4,
5,
6
]
}
}
fail
{
"status": 1,
"msg": "沒有找到訂單"
}
####3.訂單詳情
/manage/order/detail.do
request
orderNo
response
success
{
"status": 0,
"data": {
"orderNo": 1480515829406,
"payment": 30000.00,
"paymentType": 1,
"paymentTypeDesc": "在線支付",
"postage": 0,
"status": 10,
"statusDesc": "未支付",
"paymentTime": "",
"sendTime": "",
"endTime": "",
"closeTime": "",
"createTime": "2016-11-30 22:23:49",
"orderItemVoList": [
{
"orderNo": 1480515829406,
"productId": 1,
"productName": "iphone7",
"productImage": "mainimage.jpg",
"currentUnitPrice": 10000.00,
"quantity": 1,
"totalPrice": 10000.00,
"createTime": "2016-11-30 22:23:49"
},
{
"orderNo": 1480515829406,
"productId": 2,
"productName": "oppo R8",
"productImage": "mainimage.jpg",
"currentUnitPrice": 20000.00,
"quantity": 1,
"totalPrice": 20000.00,
"createTime": "2016-11-30 22:23:49"
}
],
"imageHost": "http://img.happymmall.com/",
"shippingId": 3,
"receiverName": "geely",
"shippingVo": {
"receiverName": "geely",
"receiverPhone": "0100",
"receiverMobile": "186",
"receiverProvince": "北京",
"receiverCity": "北京",
"receiverDistrict": "昌平區",
"receiverAddress": "矩陣小區",
"receiverZip": "100000"
}
}
}
fail
{
"status": 1,
"msg": "沒有找到訂單"
}
####4.訂單發貨
/manage/order/send_goods.do
request
orderNo
response
success
{
"status": 0,
"data": "發貨成功"
}
fail
{
"status": 1,
"msg": "發貨失敗"
}
[MENU]
####1.產品搜索及動態排序List
/product/list.do
request
categoryId
keyword
pageNum(default=1)
pageSize(default=10)
orderBy(default=""):排序參數:例如price_desc,price_asc
response
success
{
"status": 0,
"data": {
"pageNum": 1,
"pageSize": 10,
"size": 2,
"orderBy": null,
"startRow": 1,
"endRow": 2,
"total": 2,
"pages": 1,
"list": [
{
"id": 1,
"categoryId": 3,
"name": "iphone7",
"subtitle": "雙十一促銷",
"mainImage": "mainimage.jpg",
"status":1,
"price": 7199.22
},
{
"id": 2,
"categoryId": 2,
"name": "oppo R8",
"subtitle": "oppo促銷進行中",
"mainImage": "mainimage.jpg",
"status":1,
"price": 2999.11
}
],
"firstPage": 1,
"prePage": 0,
"nextPage": 0,
"lastPage": 1,
"isFirstPage": true,
"isLastPage": true,
"hasPreviousPage": false,
"hasNextPage": false,
"navigatePages": 8,
"navigatepageNums": [
1
]
}
}
fail
{
"status": 1,
"msg": "參數錯誤"
}
####2.產品detail
/product/detail.do
request
productId
response
success
{
"status": 0,
"data": {
"id": 2,
"categoryId": 2,
"name": "oppo R8",
"subtitle": "oppo促銷進行中",
"mainImage": "mainimage.jpg",
"subImages": "[\"mmall/aa.jpg\",\"mmall/bb.jpg\",\"mmall/cc.jpg\",\"mmall/dd.jpg\",\"mmall/ee.jpg\"]",
"detail": "richtext",
"price": 2999.11,
"stock": 71,
"status": 1,
"createTime": "2016-11-20 14:21:53",
"updateTime": "2016-11-20 14:21:53"
}
}
fail
{
"status": 1,
"msg": "該商品已下架或刪除"
}
####模板
/product/.do
request
k
response
success
k
fail
k
[MENU]
####1.支付
/order/pay.do
request
orderNo
response
success
{
"status": 0,
"data": {
"orderNo": "1485158676346",
"qrPath": "http://img.happymmall.com/qr-1492329044075.png"
}
}
fail
{
"status": 1,
"msg": "支付寶生成訂單失敗"
}
####2.查詢訂單支付狀態
/order/query_order_pay_status.do
request
orderNo
response
success
{
"status": 0,
"data": true
}
fail
{
"status": 1,
"msg": "該用戶并沒有該訂單,查詢無效"
}
####3.支付寶回調
/order/alipay_callback.do
request
HttpServletRequest
response
success
success
fail
failed
####0.模板
/REPLACE/.do
request
k
response
success
k
fail
k
[MENU]
####1.添加地址
/shipping/add.do
request
userId=1
receiverName=geely
receiverPhone=010
receiverMobile=18688888888
receiverProvince=北京
receiverCity=北京市
receiverAddress=中關村
receiverZip=100000
response
success
{
"status": 0,
"msg": "新建地址成功",
"data": {
"shippingId": 28
}
}
fail
{
"status": 1,
"msg": "新建地址失敗"
}
####2.刪除地址
/shipping/del.do
request
shippingId
response
success
{
"status": 0,
"msg": "刪除地址成功"
}
fail
{
"status": 1,
"msg": "刪除地址失敗"
}
####3.登錄狀態更新地址
/shipping/update.do
request
id=1
receiverName=geely
receiverPhone=010
receiverMobile=18688888888
receiverProvince=北京
receiverCity=北京市
receiverAddress=中關村
receiverZip=100000
response
success
{
"status": 0,
"msg": "更新地址成功"
}
fail
{
"status": 1,
"msg": "更新地址失敗"
}
####4.選中查看具體的地址
/shipping/select.do
request
shippingId
response
success
{
"status": 0,
"data": {
"id": 4,
"userId": 13,
"receiverName": "geely",
"receiverPhone": "010",
"receiverMobile": "18688888888",
"receiverProvince": "北京",
"receiverCity": "北京市",
"receiverAddress": "中關村",
"receiverZip": "100000",
"createTime": 1485066385000,
"updateTime": 1485066385000
}
}
fail
{
"status": 1,
"msg": "請登錄之后查詢"
}
####5.地址列表
/shipping/list.do
request
pageNum(默認1),pageSize(默認10)
response
success
{
"status": 0,
"data": {
"pageNum": 1,
"pageSize": 10,
"size": 2,
"orderBy": null,
"startRow": 1,
"endRow": 2,
"total": 2,
"pages": 1,
"list": [
{
"id": 4,
"userId": 13,
"receiverName": "geely",
"receiverPhone": "010",
"receiverMobile": "18688888888",
"receiverProvince": "北京",
"receiverCity": "北京市",
"receiverAddress": "中關村",
"receiverZip": "100000",
"createTime": 1485066385000,
"updateTime": 1485066385000
},
{
"id": 5,
"userId": 13,
"receiverName": "AAA",
"receiverPhone": "010",
"receiverMobile": "18688888888",
"receiverProvince": "北京",
"receiverCity": "北京市",
"receiverAddress": "中關村",
"receiverZip": "100000",
"createTime": 1485066392000,
"updateTime": 1485075875000
}
],
"firstPage": 1,
"prePage": 0,
"nextPage": 0,
"lastPage": 1,
"isFirstPage": true,
"isLastPage": true,
"hasPreviousPage": false,
"hasNextPage": false,
"navigatePages": 8,
"navigatepageNums": [
1
]
}
}
fail
{
"status": 1,
"msg": "請登錄之后查詢"
}
####模板
/product/.do
request
k
response
success
k
fail
k
[MENU]
####1.登錄
/user/login.do post(代碼需要post方式請求),開放get,方便調試
request
username,password
response
fail
{
"status": 1,
"msg": "密碼錯誤"
}
success
{
"status": 0,
"data": {
"id": 12,
"username": "aaa",
"email": "aaa@163.com",
"phone": null,
"role": 0,
"createTime": 1479048325000,
"updateTime": 1479048325000
}
}
####2.注冊
/user/register.do
request
username,password,email,phone,question,answer
response
success
{
"status": 0,
"msg": "校驗成功"
}
fail
{
"status": 1,
"msg": "用戶已存在"
}
####3.檢查用戶名是否有效
/user/check_valid.do
/check_valid.do?str=admin&type=username就是檢查用戶名。
request
str,type
str可以是用戶名也可以是email。對應的type是username和email
response
success
{
"status": 0,
"msg": "校驗成功"
}
fail
{
"status": 1,
"msg": "用戶已存在"
}
####4.獲取登錄用戶信息
/user/get_user_info.do
request
無參數
response
success
{
"status": 0,
"data": {
"id": 12,
"username": "aaa",
"email": "aaa@163.com",
"phone": null,
"role": 0,
"createTime": 1479048325000,
"updateTime": 1479048325000
}
}
fail
{
"status": 1,
"msg": "用戶未登錄,無法獲取當前用戶信息"
}
####5.忘記密碼
/user/forget_get_question.do
localhost:8080/user/forget_get_question.do?username=geely
request
username
response
success
{
"status": 0,
"data": "這里是問題"
}
fail
{
"status": 1,
"msg": "該用戶未設置找回密碼問題"
}
####6.提交問題答案
/user/forget_check_answer.do
localhost:8080/user/forget_check_answer.do?username=aaa&question=aa&answer=sss
request
username,question,answer
response
正確的返回值里面有一個token,修改密碼的時候需要用這個。傳遞給下一個接口
success
{
"status": 0,
"data": "531ef4b4-9663-4e6d-9a20-fb56367446a5"
}
fail
{
"status": 1,
"msg": "問題答案錯誤"
}
####7.忘記密碼的重設密碼
/user/forget_reset_password.do
localhost:8080/user/forget_reset_password.do?username=aaa&passwordNew=xxx&forgetToken=531ef4b4-9663-4e6d-9a20-fb56367446a5
request
username,passwordNew,forgetToken
response
success
{
"status": 0,
"msg": "修改密碼成功"
}
fail
{
"status": 1,
"msg": "修改密碼操作失效"
}
或
{
"status": 1,
"msg": "token已經失效"
}
####8.登錄中狀態重置密碼
/user/reset_password.do
request
passwordOld,passwordNew
response
success
{
"status": 0,
"msg": "修改密碼成功"
}
fail
{
"status": 1,
"msg": "舊密碼輸入錯誤"
}
####9.登錄狀態更新個人信息
/user/update_information.do
request
email,phone,question,answer
response
success
{
"status": 0,
"msg": "更新個人信息成功"
}
fail
{
"status": 1,
"msg": "用戶未登錄"
}
####10.獲取當前登錄用戶的詳細信息,并強制登錄
/user/get_information.do
request
無參數
response
success
{
"status": 0,
"data": {
"id": 1,
"username": "admin",
"password": "",
"email": "admin@163.com",
"phone": "13800138000",
"question": "question",
"answer": "answer",
"role": 1,
"createTime": 1478422605000,
"updateTime": 1491305256000
}
}
fail
{
"status": 10,
"msg": "用戶未登錄,無法獲取當前用戶信息,status=10,強制登錄"
}
####11.退出登錄
/user/logout.do
request
無
response
success
{
"status": 0,
"msg": "退出成功"
}
fail
{
"status": 1,
"msg": "服務端異常"
}
####模板
/user/.do
request
k
response
success
k
fail
k
[MENU]
####1.創建訂單
/order/create.do
request
shippingId
response
success
{
"status": 0,
"data": {
"orderNo": 1485158223095,
"payment": 2999.11,
"paymentType": 1,
"postage": 0,
"status": 10,
"paymentTime": null,
"sendTime": null,
"endTime": null,
"closeTime": null,
"createTime": 1485158223095,
"orderItemVoList": [
{
"orderNo": 1485158223095,
"productId": 2,
"productName": "oppo R8",
"productImage": "mainimage.jpg",
"currentUnitPrice": 2999.11,
"quantity": 1,
"totalPrice": 2999.11,
"createTime": null
}
],
"shippingId": 5,
"shippingVo": null
}
}
fail
{
"status": 1,
"msg": "創建訂單失敗"
}
####2.獲取訂單的商品信息
/order/get_order_cart_product.do
request
無
response
success
{
"status": 0,
"data": {
"orderItemVoList": [
{
"orderNo": null,
"productId": 1,
"productName": "iphone7",
"productImage": "mmall/aa.jpg",
"currentUnitPrice": 7999,
"quantity": 10,
"totalPrice": 79990,
"createTime": ""
}
],
"imageHost": "http://img.happymmall.com/",
"productTotalPrice": 79990
}
}
fail
{
"status": 1,
"msg": "用戶未登錄"
}
####3.訂單List
/order/list.do
request
pageSize(default=10)
pageNum(default=1)
response
success
{
"status": 0,
"data": {
"pageNum": 1,
"pageSize": 3,
"size": 3,
"orderBy": null,
"startRow": 1,
"endRow": 3,
"total": 16,
"pages": 6,
"list": [
{
"orderNo": 1485158676346,
"payment": 2999.11,
"paymentType": 1,
"paymentTypeDesc": "在線支付",
"postage": 0,
"status": 10,
"statusDesc": "未支付",
"paymentTime": "2017-02-11 12:27:18",
"sendTime": "2017-02-11 12:27:18",
"endTime": "2017-02-11 12:27:18",
"closeTime": "2017-02-11 12:27:18",
"createTime": "2017-01-23 16:04:36",
"orderItemVoList": [
{
"orderNo": 1485158676346,
"productId": 2,
"productName": "oppo R8",
"productImage": "mainimage.jpg",
"currentUnitPrice": 2999.11,
"quantity": 1,
"totalPrice": 2999.11,
"createTime": "2017-01-23 16:04:36"
}
],
"imageHost": "http://img.happymmall.com/",
"shippingId": 5,
"receiverName": "geely",
"shippingVo": null
},
{
"orderNo": 1485158675516,
"payment": 2999.11,
"paymentType": 1,
"paymentTypeDesc": "在線支付",
"postage": 0,
"status": 10,
"statusDesc": "未支付",
"paymentTime": "2017-02-11 12:27:18",
"sendTime": "2017-02-11 12:27:18",
"endTime": "2017-02-11 12:27:18",
"closeTime": "2017-02-11 12:27:18",
"createTime": "2017-01-23 16:04:35",
"orderItemVoList": [
{
"orderNo": 1485158675516,
"productId": 2,
"productName": "oppo R8",
"productImage": "mainimage.jpg",
"currentUnitPrice": 2999.11,
"quantity": 1,
"totalPrice": 2999.11,
"createTime": "2017-01-23 16:04:35"
}
],
"imageHost": "http://img.happymmall.com/",
"shippingId": 5,
"receiverName": "geely",
"shippingVo": null
},
{
"orderNo": 1485158675316,
"payment": 2999.11,
"paymentType": 1,
"paymentTypeDesc": "在線支付",
"postage": 0,
"status": 10,
"statusDesc": "未支付",
"paymentTime": "2017-02-11 12:27:18",
"sendTime": "2017-02-11 12:27:18",
"endTime": "2017-02-11 12:27:18",
"closeTime": "2017-02-11 12:27:18",
"createTime": "2017-01-23 16:04:35",
"orderItemVoList": [
{
"orderNo": 1485158675316,
"productId": 2,
"productName": "oppo R8",
"productImage": "mainimage.jpg",
"currentUnitPrice": 2999.11,
"quantity": 1,
"totalPrice": 2999.11,
"createTime": "2017-01-23 16:04:35"
}
],
"imageHost": "http://img.happymmall.com/",
"shippingId": 5,
"receiverName": "geely",
"shippingVo": null
}
],
"firstPage": 1,
"prePage": 0,
"nextPage": 2,
"lastPage": 6,
"isFirstPage": true,
"isLastPage": false,
"hasPreviousPage": false,
"hasNextPage": true,
"navigatePages": 8,
"navigatepageNums": [
1,
2,
3,
4,
5,
6
]
}
}
fail
{
"status": 10,
"msg": "用戶未登錄,請登錄"
}
或
{
"status": 1,
"msg": "沒有權限"
}
####4.訂單詳情detail
/order/detail.do
request
orderNo
response
success
{
"status": 0,
"data": {
"orderNo": 1480515829406,
"payment": 30000.00,
"paymentType": 1,
"paymentTypeDesc": "在線支付",
"postage": 0,
"status": 10,
"statusDesc": "未支付",
"paymentTime": "",
"sendTime": "",
"endTime": "",
"closeTime": "",
"createTime": "2016-11-30 22:23:49",
"orderItemVoList": [
{
"orderNo": 1480515829406,
"productId": 1,
"productName": "iphone7",
"productImage": "mainimage.jpg",
"currentUnitPrice": 10000.00,
"quantity": 1,
"totalPrice": 10000.00,
"createTime": "2016-11-30 22:23:49"
},
{
"orderNo": 1480515829406,
"productId": 2,
"productName": "oppo R8",
"productImage": "mainimage.jpg",
"currentUnitPrice": 20000.00,
"quantity": 1,
"totalPrice": 20000.00,
"createTime": "2016-11-30 22:23:49"
}
],
"imageHost": "http://img.happymmall.com/",
"shippingId": 3,
"receiverName": "geely",
"shippingVo": {
"receiverName": "geely",
"receiverPhone": "0100",
"receiverMobile": "186",
"receiverProvince": "北京",
"receiverCity": "北京",
"receiverDistrict": "昌平區",
"receiverAddress": "矩陣小區",
"receiverZip": "100000"
}
}
}
fail
{
"status": 1,
"msg": "沒有找到訂單"
}
####5.取消訂單
/order/cancel.do
request
orderNo
response
success
{
"status": 0
}
fail
{
"status": 1,
"msg": "該用戶沒有此訂單"
}
或
{
"status": 1,
"msg": "此訂單已付款,無法被取消"
}
####5.模板
/REPLACE/.do
request
k
response
success
k
fail
k
[MENU]
####1.購物車List列表
/cart/list.do
注意點:
需要先登錄,所有的密碼都是123
NEED_LOGIN(10, "NEED_LOGIN"),//需要登錄的錯誤編碼
價格的單位是元,保留小數后2位
request
無參數,需要登錄狀態
response
success
{
"status": 0,
"data": {
"cartProductVoList": [
{
"id": 1,
"userId": 13,
"productId": 1,
"quantity": 1,
"productName": "iphone7",
"productSubtitle": "雙十一促銷",
"productMainImage": "mainimage.jpg",
"productPrice": 7199.22,
"productStatus": 1,
"productTotalPrice": 7199.22,
"productStock": 86,
"productChecked": 1,
"limitQuantity": "LIMIT_NUM_SUCCESS"
},
{
"id": 2,
"userId": 13,
"productId": 2,
"quantity": 1,
"productName": "oppo R8",
"productSubtitle": "oppo促銷進行中",
"productMainImage": "mainimage.jpg",
"productPrice": 2999.11,
"productStatus": 1,
"productTotalPrice": 2999.11,
"productStock": 86,
"productChecked": 1,
"limitQuantity": "LIMIT_NUM_SUCCESS"
}
],
"allChecked": true,
"cartTotalPrice": 10198.33
}
}
fail
{
"status": 10,
"msg": "用戶未登錄,請登錄"
}
####2.購物車添加商品
/cart/add.do
請注意這個字段,超過數量會返回這樣的標識"limitQuantity"
失敗的:LIMIT_NUM_FAIL
成功的:LIMIT_NUM_SUCCESS
request
productId,count
response
success
{
"status": 0,
"data": {
"cartProductVoList": [
{
"id": 1,
"userId": 13,
"productId": 1,
"quantity": 12,
"productName": "iphone7",
"productSubtitle": "雙十一促銷",
"productMainImage": "mainimage.jpg",
"productPrice": 7199.22,
"productStatus": 1,
"productTotalPrice": 86390.64,
"productStock": 86,
"productChecked": 1,
"limitQuantity": "LIMIT_NUM_SUCCESS"
},
{
"id": 2,
"userId": 13,
"productId": 2,
"quantity": 1,
"productName": "oppo R8",
"productSubtitle": "oppo促銷進行中",
"productMainImage": "mainimage.jpg",
"productPrice": 2999.11,
"productStatus": 1,
"productTotalPrice": 2999.11,
"productStock": 86,
"productChecked": 1,
"limitQuantity": "LIMIT_NUM_SUCCESS"
}
],
"allChecked": true,
"cartTotalPrice": 89389.75
}
}
fail
{
"status": 10,
"msg": "用戶未登錄,請登錄"
}
####3.更新購物車某個產品數量
/cart/update.do
request
productId,count
response
響應同2
success
{
"status": 0,
"data": {
"cartProductVoList": [
{
"id": 1,
"userId": 13,
"productId": 1,
"quantity": 12,
"productName": "iphone7",
"productSubtitle": "雙十一促銷",
"productMainImage": "mainimage.jpg",
"productPrice": 7199.22,
"productStatus": 1,
"productTotalPrice": 86390.64,
"productStock": 86,
"productChecked": 1,
"limitQuantity": "LIMIT_NUM_SUCCESS"
},
{
"id": 2,
"userId": 13,
"productId": 2,
"quantity": 1,
"productName": "oppo R8",
"productSubtitle": "oppo促銷進行中",
"productMainImage": "mainimage.jpg",
"productPrice": 2999.11,
"productStatus": 1,
"productTotalPrice": 2999.11,
"productStock": 86,
"productChecked": 1,
"limitQuantity": "LIMIT_NUM_SUCCESS"
}
],
"allChecked": true,
"cartTotalPrice": 89389.75
}
}
fail
{
"status": 10,
"msg": "用戶未登錄,請登錄"
}
####4.移除購物車某個產品
/cart/delete_product.do
request
productIds
response
success
{
"status": 0,
"data": {
"cartProductVoList": [
{
"id": 2,
"userId": 13,
"productId": 2,
"quantity": 1,
"productName": "oppo R8",
"productSubtitle": "oppo促銷進行中",
"productMainImage": "mainimage.jpg",
"productPrice": 2999.11,
"productStatus": 1,
"productTotalPrice": 2999.11,
"productStock": 86,
"productChecked": 1,
"limitQuantity": "LIMIT_NUM_SUCCESS"
}
],
"allChecked": true,
"cartTotalPrice": 2999.11
}
}
fail
{
"status": 10,
"msg": "用戶未登錄,請登錄"
}
####5.購物車選中某個商品
/cart/select.do
request
productId
response
success
{
"status": 0,
"data": {
"cartProductVoList": [
{
"id": 2,
"userId": 13,
"productId": 2,
"quantity": 1,
"productName": "oppo R8",
"productSubtitle": "oppo促銷進行中",
"productMainImage": "mainimage.jpg",
"productPrice": 2999.11,
"productStatus": 1,
"productTotalPrice": 2999.11,
"productStock": 86,
"productChecked": 1,
"limitQuantity": "LIMIT_NUM_SUCCESS"
}
],
"allChecked": true,
"cartTotalPrice": 2999.11
}
}
fail
{
"status": 10,
"msg": "用戶未登錄,請登錄"
}
####6.購物車取消選中某個商品
/cart/un_select.do
注意返回值中的cartTotalPrice,如果反選之后總價的變化
request
productId
response
success
{
"status": 0,
"data": {
"cartProductVoList": [
{
"id": 2,
"userId": 13,
"productId": 2,
"quantity": 1,
"productName": "oppo R8",
"productSubtitle": "oppo促銷進行中",
"productMainImage": "mainimage.jpg",
"productPrice": 2999.11,
"productStatus": 1,
"productTotalPrice": 2999.11,
"productStock": 86,
"productChecked": 0,
"limitQuantity": "LIMIT_NUM_SUCCESS"
}
],
"allChecked": true,
"cartTotalPrice": 0
}
}
fail
{
"status": 10,
"msg": "用戶未登錄,請登錄"
}
####7.查詢在購物車里的產品數量
/cart/get_cart_product_count.do
未登錄返回0
request
無
response
success
{
"status": 0,
"data": 0
}
fail
{
"status": 10,
"msg": "出現異常"
}
####8.購物車全選
/cart/select_all.do
注意返回值中的cartTotalPrice的變化
request
無
response
success
{
"status": 0,
"data": {
"cartProductVoList": [
{
"id": 2,
"userId": 13,
"productId": 2,
"quantity": 1,
"productName": "oppo R8",
"productSubtitle": "oppo促銷進行中",
"productMainImage": "mainimage.jpg",
"productPrice": 2999.11,
"productStatus": 1,
"productTotalPrice": 2999.11,
"productStock": 86,
"productChecked": 0,
"limitQuantity": "LIMIT_NUM_SUCCESS"
}
],
"allChecked": true,
"cartTotalPrice": 2999.11
}
}
fail
{
"status": 10,
"msg": "用戶未登錄,請登錄"
}
####9.購物車取消全選
/cart/un_select_all.do
注意返回值中的cartTotalPrice總價的變化
request
無
response
success
{
"status": 0,
"data": {
"cartProductVoList": [
{
"id": 2,
"userId": 13,
"productId": 2,
"quantity": 1,
"productName": "oppo R8",
"productSubtitle": "oppo促銷進行中",
"productMainImage": "mainimage.jpg",
"productPrice": 2999.11,
"productStatus": 1,
"productTotalPrice": 2999.11,
"productStock": 86,
"productChecked": 0,
"limitQuantity": "LIMIT_NUM_SUCCESS"
}
],
"allChecked": true,
"cartTotalPrice": 0
}
}
fail
{
"status": 10,
"msg": "用戶未登錄,請登錄"
}
總結
以上是生活随笔為你收集整理的api demo 京东商品详情_jd-demo的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: mysql insert 二进制_MYS
- 下一篇: html中表格与字对齐,html – 中