秒殺商品頁面api(手寫版)

1.商品頁面

/goods/to_list

這個接口是登陸成功之後跳轉到商品頁面的接口,該接口需要將用戶登錄的信息保存下來,然後把所有的商品信息返回到商品頁面(將信息保存到model)。

request(get)

id,nickname,password,salt,head,registerDatelastLoginDate

response

success

{
    "goodsList" : [               
        {
            "id" : "商品id"
            "goodsName" : "商品名稱",
            "goodsImg" : "商品圖片",
            "goodsPrice":"商品原價",                   
            "miaoshaPrice" : "秒殺價",
            "stockCount" : "庫存數量"
        }
    ]
}


2商品詳情

/goods/to_detail/{goodsId}

前端需要傳入用戶信息和單個商品的id,通過商品id查看單個商品的詳細情況。

request(get)

id,nickname,password,salt,head,registerDatelastLoginDate,goodsId

response

success

goods:{
            "id" : "商品id"
            "goodsName" : "商品名稱",
            "goodsImg" : "商品圖片",
            "goodsPrice":"商品原價",                   
            "miaoshaPrice" : "秒殺價",
            "stockCount" : "庫存數量",
    }

fail

{
    goods : null
}

 

3商品秒殺

/miaosha/do_miaosha

前端需要傳入用戶信息和秒殺商品的id,然後將用戶id和商品id加入到秒殺訂單中,

request(get)

id,nickname,password,salt,head,registerDatelastLoginDate,goodsId

response

success

    goods:{
            "id" : "商品id"
            "goodsName" : "商品名稱",
            "goodsImg" : "商品圖片",
            "goodsPrice":"商品原價",                 
            "miaoshaPrice" : "秒殺價",
            "stockCount" : "庫存數量",
    },
    orderInfo:{
            "id" : "秒殺訂單id",
            "goodsPrice" : "訂單價格",
            "createDate" : "下單時間",
            "status" : "訂單狀態",
            "user_id" : "用戶id",
            "delivery_addr_id" : "收穫地址ID",
            "goods_name" : "冗餘過來的商品名稱",
            "goods_count" : "商品數量",
            "goods_price" : "商品價格",
            "order_channel" : "渠道",
            "pay_date" : "支付時間"
    }
​

fail

{ errmsg : "商品已經秒殺完畢" }

{ errmsg : "不能重複秒殺" }

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章