fix:合并

This commit is contained in:
momo
2023-09-15 10:35:13 +08:00
20 changed files with 1183 additions and 187 deletions

View File

@@ -35,190 +35,8 @@ type File {
// 统一分页
type Meta struct {
TotalCount int64 `json:"totalCount"`
PageCount int64 `json:"pageCount"`
CurrentPage int `json:"currentPage"`
PerPage int `json:"perPage"`
}
type ProductLogoResource struct {
ResourceID string `json:"resource_id"`
ResourceType string `json:"resource_type"`
ResourceURL string `json:"resource_url"`
Metadata map[string]int64erface{} `json:"metadata"`
}
type ProductSnapshot struct {
}
type TemplateInfo struct {
TemplateJSON string `json:"template_json"`
TemplateTag string `json:"template_tag"`
}
type ModelInfo struct {
ModelJSON string `json:"model_json"`
}
type FittingInfo struct {
FittingJSON string `json:"fitting_json"`
}
type SizeInfo struct {
Inch string `json:"inch"`
Cm string `json:"cm"`
}
type UserDiyInformation struct {
Phone string `json:"phone"`
Address string `json:"address"`
Website string `json:"website"`
Qrcode string `json:"qrcode"`
Slogan string `json:"slogan"`
}
type Snapshot struct {
Logo string `json:"logo"`
CombineImage string `json:"combine_image"`
RenderImage string `json:"render_image"`
TemplateInfo TemplateInfo `json:"template_info"`
ModelInfo ModelInfo `json:"model_info"`
FittingInfo FittingInfo `json:"fitting_info"`
SizeInfo SizeInfo `json:"size_info"`
UserDiyInformation UserDiyInformation `json:"user_diy_information"`
}
type ShoppingCartSnapshot struct {
ID int64 `json:"id"`
UserID int64 `json:"user_id"`
ProductID int64 `json:"product_id"`
TemplateID int64 `json:"template_id"`
ModelID int64 `json:"model_id"`
SizeID int64 `json:"size_id"`
FittingID int64 `json:"fitting_id"`
PurchaseQuantity int64 `json:"purchase_quantity"`
Snapshot Snapshot `json:"snapshot"`
IsHighlyCustomized int64 `json:"is_highly_customized"`
Ctime string `json:"ctime"`
Utime string `json:"utime"`
}
type OrderProduct struct {
ProductID string `json:"product_id"`
ProductName string `json:"product_name"`
ProductPrice string `json:"product_price"`
ProductLogo string `json:"product_logo"`
ProductLogoResource ProductLogoResource `json:"product_logo_resource"`
ProductSnapshot ProductSnapshot `json:"product_snapshot"`
Number int64 `json:"number"`
Amount string `json:"amount"`
Unit string `json:"unit"`
ExpectedDeliveryTime string `json:"expected_delivery_time"`
ShoppingCartSnapshot ShoppingCartSnapshot `json:"shopping_cart_snapshot"`
}
type Children struct {
}
type Status struct {
StatusCode int64 `json:"status_code"`
StatusTitle string `json:"status_title"`
ExpectedTime string `json:"expected_time"`
Ctime string `json:"ctime"`
Utime string `json:"utime"`
Metadata map[string]int64erface{} `json:"metadata"`
Children []Children `json:"children"`
}
type OrderStatus struct {
StatusCode int64 `json:"status_code"`
StatusTitle string `json:"status_title"`
ExpectedTime string `json:"expected_time"`
Ctime string `json:"ctime"`
Utime string `json:"utime"`
Metadata map[string]int64erface{} `json:"metadata"`
Children []Children `json:"children"`
}
type OrderInfo struct {
OrderNo string `json:"order_no"`
DeliveryMethod int64 `json:"delivery_method"`
Ctime string `json:"ctime"`
Utime string `json:"utime"`
Status OrderStatus `json:"status"`
StatusLink []OrderStatus `json:"status_link"`
Metadata map[string]int64erface{} `json:"metadata"`
}
type Subtotal struct {
Currency string `json:"currency"`
Current string `json:"current"`
Initiate string `json:"initiate"`
Change string `json:"change"`
ChangeRemark string `json:"change_remark"`
Metadata map[string]int64erface{} `json:"metadata"`
}
type ShippingFee struct {
Currency string `json:"currency"`
Current string `json:"current"`
Initiate string `json:"initiate"`
Change string `json:"change"`
ChangeRemark string `json:"change_remark"`
Metadata map[string]int64erface{} `json:"metadata"`
}
type Tax struct {
Currency string `json:"currency"`
Current string `json:"current"`
Initiate string `json:"initiate"`
Change string `json:"change"`
ChangeRemark string `json:"change_remark"`
Metadata map[string]int64erface{} `json:"metadata"`
}
type Discount struct {
Currency string `json:"currency"`
Current string `json:"current"`
Initiate string `json:"initiate"`
Change string `json:"change"`
ChangeRemark string `json:"change_remark"`
Metadata map[string]int64erface{} `json:"metadata"`
}
type Total struct {
Currency string `json:"currency"`
Current string `json:"current"`
Initiate string `json:"initiate"`
Change string `json:"change"`
ChangeRemark string `json:"change_remark"`
Metadata map[string]int64erface{} `json:"metadata"`
}
type PayStatus struct {
StatusCode int64 `json:"status_code"`
StatusTitle string `json:"status_title"`
Metadata map[string]int64erface{} `json:"metadata"`
}
type PayAmount struct {
Currency string `json:"currency"`
Current string `json:"current"`
Initiate string `json:"initiate"`
Change string `json:"change"`
ChangeRemark string `json:"change_remark"`
Metadata map[string]int64erface{} `json:"metadata"`
}
type Deposit struct {
TradeNo string `json:"trade_no"`
Status Status `json:"status"`
StatusLink []PayStatus `json:"status_link"`
PayTime string `json:"pay_time"`
PayAmount PayAmount `json:"pay_amount"`
PayMethod string `json:"pay_method"`
Metadata map[string]int64erface{} `json:"metadata"`
}
type RemainingBalance struct {
TradeNo string `json:"trade_no"`
Status PayStatus `json:"status"`
StatusLink []PayStatus `json:"status_link"`
PayTime string `json:"pay_time"`
PayAmount PayAmount `json:"pay_amount"`
PayMethod string `json:"pay_method"`
Metadata map[string]int64erface{} `json:"metadata"`
}
type OrderAmount struct {
Subtotal Subtotal `json:"subtotal"`
ShippingFee ShippingFee `json:"shipping_fee"`
Tax Tax `json:"tax"`
Discount Discount `json:"discount"`
Total Total `json:"total"`
Deposit Deposit `json:"deposit"`
RemainingBalance RemainingBalance `json:"remaining_balance"`
}
type DeliveryAddres struct {
Address string `json:"address"`
Name string `json:"name"`
Mobile string `json:"mobile"`
TotalCount int64 `json:"total_count"`
PageCount int64 `json:"page_count"`
CurrentPage int `json:"current_page"`
PerPage int `json:"per_page"`
}

View File

@@ -0,0 +1,89 @@
syntax = "v1"
info (
title: "shopping-cart"// TODO: add title
desc: "购物车服务"// TODO: add description
author: ""
email: ""
)
import "basic.api"
service shopping-cart {
//加入购物车
@handler AddToCartHandler
post /api/shopping-cart/add_to_cart(AddToCartReq) returns (response);
//删除购物车
@handler DeleteCartHandler
post /api/shopping-cart/delete_cart(DeleteCartReq) returns (response);
//修改购物车购买数量
@handler ModifyCartPurchaseQuantityHandler
post /api/shopping-cart/modify_cart_purchase_quantity(ModifyCartPurchaseQuantityReq) returns (response);
//获取购物车列表
@handler GetCartsHandler
get /api/shopping-cart/get_carts(GetCartsReq) returns (response);
}
//加入购物车
type AddToCartReq {
ProductId int64 `json:"product_id"` //产品id
TemplateId int64 `json:"template_id,optional"` //模板id(不可定制的不传)
SizeId int64 `json:"size_id"` //尺寸id
FittingId int64 `json:"fitting_id,optional"` //配件id(没有可以不传)
PurchaseQuantity int64 `json:"purchase_quantity"` //购买数量
Logo string `json:"logo,optional"` //logo地址(没有可以不传)
CombineImage string `json:"combine_image,optional"` //合图地址 (没有可以不传)
RenderImage string `json:"render_image,optional"` //渲染结果图 (没有可以不传)
DiyInfo DiyInfo `json:"diy_info,optional"` //用户diy数据可选
}
type DiyInfo {
Phone string `json:"phone,optional"` //电话(可选)
Address string `json:"address,optional"` //地址 (可选)
Website string `json:"website,optional"` //网站 (可选)
Qrcode string `json:"qrcode,optional"` //二维码 (可选)
Slogan string `json:"slogan,optional"` //slogan (可选)
}
//删除购物车
type DeleteCartReq {
Id int64 `json:"id"` //购物车id
}
//修改购物车购买数量
type ModifyCartPurchaseQuantityReq {
Id int64 `json:"id"` //购物车id
PurchaseQuantity int64 `json:"purchase_quantity"` //数量
}
//获取购物车列表
type GetCartsReq {
CurrentPage int `form:"current_page"` //当前页
}
type GetCartsRsp {
Meta Meta `json:"meta"` //分页信息
CartList []CartItem `json:"cart_list"`
}
type CartItem {
ProductId int64 `json:"product_id"` //产品id
SizeInfo SizeInfo `json:"size_info"` //尺寸信息
FittingInfo FittingInfo `json:"fitting_info"` //配件信息
ItemPrice string `json:"item_price"` //单价
TotalPrice string `json:"totalPrice"` //单价X数量=总价
DiyInformation DiyInformation `json:"diy_information"` //diy信息
StepNum []int64 `json:"step_num"` //阶梯数量
}
type SizeInfo {
SizeId int64 `json:"size_id"` //尺寸id
Capacity string `json:"capacity"` //尺寸名称
Title SizeTitle `json:"title"`
}
type FittingInfo {
FittingId int64 `json:"fitting_id"` //配件id
FittingName string `json:"fitting_name"` //配件名称
}
type SizeTitle {
Cm string `json:"cm"`
Inch string `json:"inch"`
}
type DiyInformation {
Phone string `json:"phone"`
Address string `json:"address"`
Website string `json:"website"`
Qrcode string `json:"qrcode"`
}