Merge branch 'feature/mhw-v1.01' of gitee.com:fusenpack/fusenapi into feature/mhw-v1.01

This commit is contained in:
momo 2023-09-15 17:59:59 +08:00
commit 86450d3c9d
3 changed files with 44 additions and 0 deletions

View File

@ -32,6 +32,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Path: "/api/shopping-cart/get_carts",
Handler: GetCartsHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/api/shopping-cart/calculate_cart_price",
Handler: CalculateCartPriceHandler(serverCtx),
},
},
)
}

View File

@ -80,6 +80,25 @@ type DiyInformation struct {
Slogan string `json:"slogan"`
}
type CalculateCartPriceReq struct {
CalculateList []CalculateItem `json:"calculate_list"`
}
type CalculateItem struct {
CartId int64 `json:"cart_id"` //购物车id
PurchaseQuantity int64 `json:"purchase_quantity"` //数量
}
type CalculateCartPriceRsp struct {
CalculateResultList []CalculateResultItem `json:"calculate_result_list"`
}
type CalculateResultItem struct {
CartId int64 `json:"cart_id"` //购物车id
ItemPrice string `json:"item_price"` //单价
TotalPrice string `json:"total_price"` //总价
}
type Request struct {
}

View File

@ -21,6 +21,9 @@ service shopping-cart {
//获取购物车列表
@handler GetCartsHandler
get /api/shopping-cart/get_carts(GetCartsReq) returns (response);
//计算购物车价格
@handler CalculateCartPriceHandler
post /api/shopping-cart/calculate_cart_price(CalculateCartPriceReq) returns (response);
}
//加入购物车
@ -90,4 +93,21 @@ type DiyInformation {
Website string `json:"website"`
Qrcode string `json:"qrcode"`
Slogan string `json:"slogan"`
}
//计算购物车价格
type CalculateCartPriceReq {
CalculateList []CalculateItem `json:"calculate_list"`
}
type CalculateItem {
CartId int64 `json:"cart_id"` //购物车id
PurchaseQuantity int64 `json:"purchase_quantity"` //数量
}
type CalculateCartPriceRsp {
CalculateResultList []CalculateResultItem `json:"calculate_result_list"`
}
type CalculateResultItem {
CartId int64 `json:"cart_id"` //购物车id
ItemPrice string `json:"item_price"` //单价
TotalPrice string `json:"total_price"` //总价
}