1. 程式人生 > >聖熙女鞋API設計(一)

聖熙女鞋API設計(一)

mar detail result arch eid api 個人 ext sum

女鞋API

數據結構定義

//Product
//產品數據對象解構
{
    id:101,
    name:‘產品名‘,
    summary:‘產品簡介‘,
    image:‘imageURL‘,
    code:‘產品編碼,例如3014‘,
    price:‘價格‘,
    colors:[
        color,
        ...
    ],
    sizes:[
        size,
        ...
    ]
}
//Color對象
//顏色描述對象
{
    id:‘顏色id,唯一標識‘,
    name:‘顏色名稱,例如紅色‘
}
//Size對象
//尺碼描述對象
{
    id:‘尺碼id,唯一標識‘,
    name:‘尺碼名稱,例如43號‘
}
//PreOrder
//預定信息
{
    id:101,
    date:‘時間‘,
    productID:
    name:‘產品名‘,
    code:‘產品編碼,例如3014‘,
    image:‘圖片鏈接‘,
    price:‘價格‘,
    count:‘數量,

}
//Order
//訂單對象
{
    id:訂單id,
    date:訂單時間,
    totalPrice:總價,
    type:‘0為確認訂單,1已確認訂單,2已發貨訂單‘
}
//OrderDetail
//訂單明細對象
{
    id:訂單明細id,
    productID:商品類型ID,
    productName:商品名稱,
    productCode:商品編碼,
    productColorID:
    productColorName:
    productSizeID:
    productSizeName:
    count:
    price:
    totalPrice:
    type:‘訂單明細類型,0正常,1退貨申請中,2退貨成功,3退貨失敗,4換貨申請中,5換貨成功,6退貨失敗‘
}
//BillDetail
//賬單明細對象
{
    id:
    date:
    totalPrice:
    orderID:
}
//Bill
//對賬單對象
{
    id:
    date:
    orderTotalPrice:訂單總金額
    backTotalPrice:退貨總金額
    money:應付賬款
    type:‘0為確認,1已確認,2已付款‘
}
//notice
//通知對象
{
    id:
    title:
    content:
    date:
    type:‘0為公共,1為個人‘,
}

API接口定義

1,登錄

請求地址:http://host:port/api/login

請求方式:POST

請求參數:

參數名參數說明
name 登錄名
pwd 密碼

返回值:

{
    success:true,
    data:{
        uid:1001
        token:xxxx
    }
}

2,獲取商品

請求地址:http://host:port/api/getProducts

請求方式:GET

請求參數:

參數名參數說明
token 登錄令牌
type 0為全部商品,1為新品,默認為0

返回值:

{
    success:true,
    data:[
        Product對象,
        ...
    ]
}

3,提交預定信息

請求地址:http://host:port/api/postPreOrider

請求方式:POST

請求參數:

參數名參數說明
token 登錄令牌
productID 商品ID
count 預定數量

返回值:

{
    success:true,
}

4,獲取預定記錄

請求地址:http://host:port/api/getPerOrders

請求方式:GET

請求參數:

參數名參數說明
token 登錄令牌

返回值:

{
    success:true,
    data:[
        PreOrder對象,
        ...
    ]
}

5,獲取訂單列表

請求地址:http://host:port/api/getOrders

請求方式:GET

請求參數:

參數名參數說明
token 登錄令牌

返回值:

{
    success:true,
    data:[
        Order對象,
        ...
    ]
}

6,獲取訂單明細

請求地址:http://host:port/api/getOrderDetails

請求方式:GET

請求參數:

參數名參數說明
token 登錄令牌
orderID 訂單ID

返回值:

{
    success:true,
    data:[
        OrderDetail對象,
        ...
    ]
}

7,確認訂單

請求地址:http://host:port/api/confirmOrder

請求方式:POST

請求參數:

參數名參數說明
token 登錄令牌
orderID 確認訂單ID

返回值:

{
    success:true,
}

8,退貨

請求地址:http://host:port/api/backProduct

請求方式:POST

請求參數:

參數名參數說明
token 登錄令牌
orderID 訂單ID
orderDetailID 訂單明細ID
count 退貨數量

返回值:

{
    success:true,
}

9,換貨

請求地址:http://host:port/api/changeProduct

請求方式:POST

請求參數:

參數名參數說明
token 登錄令牌
orderID 訂單ID
orderDetailID 訂單明細ID
count 換貨數量
colorID 換貨顏色ID
sizeID 換貨尺碼ID

返回值:

{
    success:true,
}

10,獲取賬單明細

請求地址:http://host:port/api/getBillDetails

請求方式:GET

請求參數:

參數名參數說明
token 登錄令牌

返回值:

{
    success:true,
    data:[
        賬單明細對象,
        ...
    ]
}

11,獲取對賬單

請求地址:http://host:port/api/getBill

請求方式:GET

請求參數:

參數名參數說明
token 登錄令牌

返回值:

{
    success:true,
    data:對賬單對象,
}

12,確認對賬單

請求地址:http://host:port/api/confirmBill

請求方式:POST

請求參數:

參數名參數說明
token 登錄令牌
billID 對賬單ID

返回值:

{
    success:true,
}

13,獲取歷史對賬單

請求地址:http://host:port/api/getHistoryBills

請求方式:GET

請求參數:

參數名參數說明
token 登錄令牌

返回值:

{
    success:true,
    data:[
        對賬單對象,
        ...
    ],
}

14,獲取通知

請求地址:http://host:port/api/getNotices

請求方式:GET

請求參數:

參數名參數說明
token 登錄令牌

返回值:

{
    success:true,
    data:[
        通知對象,
        ...
    ],
}

15,修改密碼

請求地址:http://host:port/api/user/setPassword

請求方式:POST

請求參數:

參數名參數說明
token 登錄令牌
currentpwd 當前密碼
newpwd 新密碼

返回值:

{
    success:true,
}

聖熙女鞋API設計(一)