api demo 京东商品详情_jd-demo
一個(gè)仿京東的網(wǎng)站:
后端使用java,基本架構(gòu):springMVC + spring + mybatis;
前端技術(shù):Html+CSS+JQuery+React+Sass...
后臺(tái)接口說(shuō)明:
####1.統(tǒng)計(jì)用戶(hù)、商品、訂單數(shù)量
/manage/statistic/base_count.do
request
無(wú)
response
success
{
"status": 0,
"data": {
userCount: 123,
productCount: 456,
orderCount: 789
}
}
fail
{
"status": 10,
"msg": "用戶(hù)未登錄,請(qǐng)登錄"
}
或
{
"status": 1,
"msg": "出錯(cuò)啦"
}
####1.后臺(tái)管理員登錄
/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": "密碼錯(cuò)誤"
}
####2.用戶(hù)列表
/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": "用戶(hù)未登錄,請(qǐng)登錄"
}
或
{
"status": 1,
"msg": "沒(méi)有權(quán)限"
}
####3.模板
/REPLACE/.do
request
k
response
success
k
fail
k
[MENU]
####1.產(chǎn)品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": "雙十一促銷(xiāo)",
"mainImage": "mainimage.jpg",
"status":1,
"price": 7199.22
},
{
"id": 2,
"categoryId": 2,
"name": "oppo R8",
"subtitle": "oppo促銷(xiāo)進(jìn)行中",
"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": "用戶(hù)未登錄,請(qǐng)登錄"
}
####2.產(chǎn)品搜索
/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": "雙十一促銷(xiāo)",
"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": "用戶(hù)未登錄,請(qǐng)登錄"
}
####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的時(shí)候
####4.產(chǎn)品詳情
/manage/product/detail.do
request
productId
response
success
{
"status": 0,
"data": {
"id": 2,
"categoryId": 2,
"parentCategoryId":1,
"name": "oppo R8",
"subtitle": "oppo促銷(xiāo)進(jìn)行中",
"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": "沒(méi)有權(quán)限"
}
####5.產(chǎn)品上下架
/manage/product/set_sale_status.do
request
productId
status
response
success
{
"status": 0,
"data": "修改產(chǎn)品狀態(tài)成功"
}
fail
{
"status": 1,
"data": "修改產(chǎn)品狀態(tài)失敗"
}
####6.新增OR更新產(chǎn)品
新增
/manage/product/save.do
request
categoryId=1&name=三星洗衣機(jī)&subtitle=三星大促銷(xiāo)&mainImage=sss.jpg&subImages=test.jpg&detail=detailtext&price=1000&stock=100&status=1&id=3
response
success
{
"status": 0,
"data": "更新產(chǎn)品成功"
}
或
{
"status": 0,
"data": "新增產(chǎn)品成功"
}
fail
{
"status": 1,
"data": "更新產(chǎn)品失敗"
}
####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.獲取品類(lèi)子節(jié)點(diǎn)(平級(jí))
/manage/category/get_category.do
request
categoryId(default=0)
response
success
{
"status": 0,
"data": [
{
"id": 2,
"parentId": 1,
"name": "手機(jī)",
"status": true,
"sortOrder": 3,
"createTime": 1479622913000,
"updateTime": 1479622913000
},
{
"id": 4,
"parentId": 1,
"name": "移動(dòng)座機(jī)",
"status": true,
"sortOrder": 5,
"createTime": 1480059936000,
"updateTime": 1480491941000
}
]
}
fail
{
"status": 10,
"msg": "用戶(hù)未登錄,請(qǐng)登錄"
}
或
{
"status": 1,
"msg": "未找到該品類(lèi)"
}
####2.增加節(jié)點(diǎn)
/manage/category/add_category.do
request
parentId(default=0)
categoryName
response
success
{
"status": 0,
"msg": "添加品類(lèi)成功"
}
fail
{
"status":1,
"msg": "添加品類(lèi)失敗"
}
####3.修改品類(lèi)名字
/manage/category/set_category_name.do
request
categoryId
categoryName
response
success
{
"status": 0,
"msg": "更新品類(lèi)名字成功"
}
fail
{
"status": 1,
"msg": "更新品類(lèi)名字失敗"
}
####4.獲取當(dāng)前分類(lèi)id及遞歸子節(jié)點(diǎn)categoryId
/manage/category/get_deep_category.do
request
categoryId
response
success
{
"status": 0,
"data": [
100009,
100010,
100001,
100006,
100007,
100008
]
}
fail
{
"status": 1,
"msg": "無(wú)權(quán)限"
}
[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": "在線(xiàn)支付",
"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": "在線(xiàn)支付",
"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": "在線(xiàn)支付",
"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": "用戶(hù)未登錄,請(qǐng)登錄"
}
或
{
"status": 1,
"msg": "沒(méi)有權(quán)限"
}
####2.按訂單號(hào)查詢(xún)
/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": "在線(xiàn)支付",
"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": "在線(xiàn)支付",
"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": "在線(xiàn)支付",
"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": "沒(méi)有找到訂單"
}
####3.訂單詳情
/manage/order/detail.do
request
orderNo
response
success
{
"status": 0,
"data": {
"orderNo": 1480515829406,
"payment": 30000.00,
"paymentType": 1,
"paymentTypeDesc": "在線(xiàn)支付",
"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": "昌平區(qū)",
"receiverAddress": "矩陣小區(qū)",
"receiverZip": "100000"
}
}
}
fail
{
"status": 1,
"msg": "沒(méi)有找到訂單"
}
####4.訂單發(fā)貨
/manage/order/send_goods.do
request
orderNo
response
success
{
"status": 0,
"data": "發(fā)貨成功"
}
fail
{
"status": 1,
"msg": "發(fā)貨失敗"
}
[MENU]
####1.產(chǎn)品搜索及動(dòng)態(tài)排序List
/product/list.do
request
categoryId
keyword
pageNum(default=1)
pageSize(default=10)
orderBy(default=""):排序參數(shù):例如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": "雙十一促銷(xiāo)",
"mainImage": "mainimage.jpg",
"status":1,
"price": 7199.22
},
{
"id": 2,
"categoryId": 2,
"name": "oppo R8",
"subtitle": "oppo促銷(xiāo)進(jìn)行中",
"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": "參數(shù)錯(cuò)誤"
}
####2.產(chǎn)品detail
/product/detail.do
request
productId
response
success
{
"status": 0,
"data": {
"id": 2,
"categoryId": 2,
"name": "oppo R8",
"subtitle": "oppo促銷(xiāo)進(jìn)行中",
"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.查詢(xún)訂單支付狀態(tài)
/order/query_order_pay_status.do
request
orderNo
response
success
{
"status": 0,
"data": true
}
fail
{
"status": 1,
"msg": "該用戶(hù)并沒(méi)有該訂單,查詢(xún)無(wú)效"
}
####3.支付寶回調(diào)
/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=中關(guān)村
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.登錄狀態(tài)更新地址
/shipping/update.do
request
id=1
receiverName=geely
receiverPhone=010
receiverMobile=18688888888
receiverProvince=北京
receiverCity=北京市
receiverAddress=中關(guān)村
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": "中關(guān)村",
"receiverZip": "100000",
"createTime": 1485066385000,
"updateTime": 1485066385000
}
}
fail
{
"status": 1,
"msg": "請(qǐng)登錄之后查詢(xún)"
}
####5.地址列表
/shipping/list.do
request
pageNum(默認(rèn)1),pageSize(默認(rèn)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": "中關(guān)村",
"receiverZip": "100000",
"createTime": 1485066385000,
"updateTime": 1485066385000
},
{
"id": 5,
"userId": 13,
"receiverName": "AAA",
"receiverPhone": "010",
"receiverMobile": "18688888888",
"receiverProvince": "北京",
"receiverCity": "北京市",
"receiverAddress": "中關(guān)村",
"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": "請(qǐng)登錄之后查詢(xún)"
}
####模板
/product/.do
request
k
response
success
k
fail
k
[MENU]
####1.登錄
/user/login.do post(代碼需要post方式請(qǐng)求),開(kāi)放get,方便調(diào)試
request
username,password
response
fail
{
"status": 1,
"msg": "密碼錯(cuò)誤"
}
success
{
"status": 0,
"data": {
"id": 12,
"username": "aaa",
"email": "aaa@163.com",
"phone": null,
"role": 0,
"createTime": 1479048325000,
"updateTime": 1479048325000
}
}
####2.注冊(cè)
/user/register.do
request
username,password,email,phone,question,answer
response
success
{
"status": 0,
"msg": "校驗(yàn)成功"
}
fail
{
"status": 1,
"msg": "用戶(hù)已存在"
}
####3.檢查用戶(hù)名是否有效
/user/check_valid.do
/check_valid.do?str=admin&type=username就是檢查用戶(hù)名。
request
str,type
str可以是用戶(hù)名也可以是email。對(duì)應(yīng)的type是username和email
response
success
{
"status": 0,
"msg": "校驗(yàn)成功"
}
fail
{
"status": 1,
"msg": "用戶(hù)已存在"
}
####4.獲取登錄用戶(hù)信息
/user/get_user_info.do
request
無(wú)參數(shù)
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": "用戶(hù)未登錄,無(wú)法獲取當(dāng)前用戶(hù)信息"
}
####5.忘記密碼
/user/forget_get_question.do
localhost:8080/user/forget_get_question.do?username=geely
request
username
response
success
{
"status": 0,
"data": "這里是問(wèn)題"
}
fail
{
"status": 1,
"msg": "該用戶(hù)未設(shè)置找回密碼問(wèn)題"
}
####6.提交問(wèn)題答案
/user/forget_check_answer.do
localhost:8080/user/forget_check_answer.do?username=aaa&question=aa&answer=sss
request
username,question,answer
response
正確的返回值里面有一個(gè)token,修改密碼的時(shí)候需要用這個(gè)。傳遞給下一個(gè)接口
success
{
"status": 0,
"data": "531ef4b4-9663-4e6d-9a20-fb56367446a5"
}
fail
{
"status": 1,
"msg": "問(wèn)題答案錯(cuò)誤"
}
####7.忘記密碼的重設(shè)密碼
/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已經(jīng)失效"
}
####8.登錄中狀態(tài)重置密碼
/user/reset_password.do
request
passwordOld,passwordNew
response
success
{
"status": 0,
"msg": "修改密碼成功"
}
fail
{
"status": 1,
"msg": "舊密碼輸入錯(cuò)誤"
}
####9.登錄狀態(tài)更新個(gè)人信息
/user/update_information.do
request
email,phone,question,answer
response
success
{
"status": 0,
"msg": "更新個(gè)人信息成功"
}
fail
{
"status": 1,
"msg": "用戶(hù)未登錄"
}
####10.獲取當(dāng)前登錄用戶(hù)的詳細(xì)信息,并強(qiáng)制登錄
/user/get_information.do
request
無(wú)參數(shù)
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": "用戶(hù)未登錄,無(wú)法獲取當(dāng)前用戶(hù)信息,status=10,強(qiáng)制登錄"
}
####11.退出登錄
/user/logout.do
request
無(wú)
response
success
{
"status": 0,
"msg": "退出成功"
}
fail
{
"status": 1,
"msg": "服務(wù)端異常"
}
####模板
/user/.do
request
k
response
success
k
fail
k
[MENU]
####1.創(chuàng)建訂單
/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": "創(chuàng)建訂單失敗"
}
####2.獲取訂單的商品信息
/order/get_order_cart_product.do
request
無(wú)
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": "用戶(hù)未登錄"
}
####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": "在線(xiàn)支付",
"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": "在線(xiàn)支付",
"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": "在線(xiàn)支付",
"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": "用戶(hù)未登錄,請(qǐng)登錄"
}
或
{
"status": 1,
"msg": "沒(méi)有權(quán)限"
}
####4.訂單詳情detail
/order/detail.do
request
orderNo
response
success
{
"status": 0,
"data": {
"orderNo": 1480515829406,
"payment": 30000.00,
"paymentType": 1,
"paymentTypeDesc": "在線(xiàn)支付",
"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": "昌平區(qū)",
"receiverAddress": "矩陣小區(qū)",
"receiverZip": "100000"
}
}
}
fail
{
"status": 1,
"msg": "沒(méi)有找到訂單"
}
####5.取消訂單
/order/cancel.do
request
orderNo
response
success
{
"status": 0
}
fail
{
"status": 1,
"msg": "該用戶(hù)沒(méi)有此訂單"
}
或
{
"status": 1,
"msg": "此訂單已付款,無(wú)法被取消"
}
####5.模板
/REPLACE/.do
request
k
response
success
k
fail
k
[MENU]
####1.購(gòu)物車(chē)List列表
/cart/list.do
注意點(diǎn):
需要先登錄,所有的密碼都是123
NEED_LOGIN(10, "NEED_LOGIN"),//需要登錄的錯(cuò)誤編碼
價(jià)格的單位是元,保留小數(shù)后2位
request
無(wú)參數(shù),需要登錄狀態(tài)
response
success
{
"status": 0,
"data": {
"cartProductVoList": [
{
"id": 1,
"userId": 13,
"productId": 1,
"quantity": 1,
"productName": "iphone7",
"productSubtitle": "雙十一促銷(xiāo)",
"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促銷(xiāo)進(jìn)行中",
"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": "用戶(hù)未登錄,請(qǐng)登錄"
}
####2.購(gòu)物車(chē)添加商品
/cart/add.do
請(qǐng)注意這個(gè)字段,超過(guò)數(shù)量會(huì)返回這樣的標(biāo)識(shí)"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": "雙十一促銷(xiāo)",
"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促銷(xiāo)進(jìn)行中",
"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": "用戶(hù)未登錄,請(qǐng)登錄"
}
####3.更新購(gòu)物車(chē)某個(gè)產(chǎn)品數(shù)量
/cart/update.do
request
productId,count
response
響應(yīng)同2
success
{
"status": 0,
"data": {
"cartProductVoList": [
{
"id": 1,
"userId": 13,
"productId": 1,
"quantity": 12,
"productName": "iphone7",
"productSubtitle": "雙十一促銷(xiāo)",
"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促銷(xiāo)進(jìn)行中",
"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": "用戶(hù)未登錄,請(qǐng)登錄"
}
####4.移除購(gòu)物車(chē)某個(gè)產(chǎn)品
/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促銷(xiāo)進(jìn)行中",
"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": "用戶(hù)未登錄,請(qǐng)登錄"
}
####5.購(gòu)物車(chē)選中某個(gè)商品
/cart/select.do
request
productId
response
success
{
"status": 0,
"data": {
"cartProductVoList": [
{
"id": 2,
"userId": 13,
"productId": 2,
"quantity": 1,
"productName": "oppo R8",
"productSubtitle": "oppo促銷(xiāo)進(jìn)行中",
"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": "用戶(hù)未登錄,請(qǐng)登錄"
}
####6.購(gòu)物車(chē)取消選中某個(gè)商品
/cart/un_select.do
注意返回值中的cartTotalPrice,如果反選之后總價(jià)的變化
request
productId
response
success
{
"status": 0,
"data": {
"cartProductVoList": [
{
"id": 2,
"userId": 13,
"productId": 2,
"quantity": 1,
"productName": "oppo R8",
"productSubtitle": "oppo促銷(xiāo)進(jìn)行中",
"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": "用戶(hù)未登錄,請(qǐng)登錄"
}
####7.查詢(xún)?cè)谫?gòu)物車(chē)?yán)锏漠a(chǎn)品數(shù)量
/cart/get_cart_product_count.do
未登錄返回0
request
無(wú)
response
success
{
"status": 0,
"data": 0
}
fail
{
"status": 10,
"msg": "出現(xiàn)異常"
}
####8.購(gòu)物車(chē)全選
/cart/select_all.do
注意返回值中的cartTotalPrice的變化
request
無(wú)
response
success
{
"status": 0,
"data": {
"cartProductVoList": [
{
"id": 2,
"userId": 13,
"productId": 2,
"quantity": 1,
"productName": "oppo R8",
"productSubtitle": "oppo促銷(xiāo)進(jìn)行中",
"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": "用戶(hù)未登錄,請(qǐng)登錄"
}
####9.購(gòu)物車(chē)取消全選
/cart/un_select_all.do
注意返回值中的cartTotalPrice總價(jià)的變化
request
無(wú)
response
success
{
"status": 0,
"data": {
"cartProductVoList": [
{
"id": 2,
"userId": 13,
"productId": 2,
"quantity": 1,
"productName": "oppo R8",
"productSubtitle": "oppo促銷(xiāo)進(jìn)行中",
"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": "用戶(hù)未登錄,請(qǐng)登錄"
}
總結(jié)
以上是生活随笔為你收集整理的api demo 京东商品详情_jd-demo的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: mysql insert 二进制_MYS
- 下一篇: axios传数组到后台_我是如何让公司后