2023-09-13 08:44:23 +00:00
|
|
|
|
syntax = "v1"
|
|
|
|
|
|
|
|
|
|
info (
|
|
|
|
|
title: "shopping-cart"// TODO: add title
|
|
|
|
|
desc: "购物车服务"// TODO: add description
|
|
|
|
|
author: ""
|
|
|
|
|
email: ""
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
import "basic.api"
|
|
|
|
|
service shopping-cart {
|
|
|
|
|
//加入购物车
|
|
|
|
|
@handler AddToCartHandler
|
2023-09-15 06:52:36 +00:00
|
|
|
|
post /api/shopping-cart/add(AddToCartReq) returns (response);
|
2023-09-13 08:44:23 +00:00
|
|
|
|
//删除购物车
|
|
|
|
|
@handler DeleteCartHandler
|
2023-09-15 06:52:36 +00:00
|
|
|
|
post /api/shopping-cart/delete(DeleteCartReq) returns (response);
|
2023-09-13 08:44:23 +00:00
|
|
|
|
//获取购物车列表
|
|
|
|
|
@handler GetCartsHandler
|
|
|
|
|
get /api/shopping-cart/get_carts(GetCartsReq) returns (response);
|
2023-09-15 09:59:33 +00:00
|
|
|
|
//计算购物车价格
|
|
|
|
|
@handler CalculateCartPriceHandler
|
|
|
|
|
post /api/shopping-cart/calculate_cart_price(CalculateCartPriceReq) returns (response);
|
2023-10-19 10:42:28 +00:00
|
|
|
|
//获取购物车数量
|
|
|
|
|
@handler GetCartNumHandler
|
|
|
|
|
get /api/shopping-cart/get_cart_num(request) returns (response);
|
2023-09-13 08:44:23 +00:00
|
|
|
|
}
|
2023-09-13 09:27:16 +00:00
|
|
|
|
|
2023-09-13 08:44:23 +00:00
|
|
|
|
//加入购物车
|
2023-09-13 09:27:16 +00:00
|
|
|
|
type AddToCartReq {
|
2023-11-01 09:10:53 +00:00
|
|
|
|
ProductId int64 `json:"product_id"` //产品id
|
2023-11-08 09:04:01 +00:00
|
|
|
|
ProductWebsiteUnit ProductWebsiteUnit `json:"product_website_unit,optional"` //产品单位
|
2023-11-01 09:10:53 +00:00
|
|
|
|
TemplateId int64 `json:"template_id,optional"` //模板id(不可定制的不传)
|
|
|
|
|
IsHighlyCustomized int64 `json:"is_highly_customized"` //是否高度定制
|
|
|
|
|
SelectColorIndex int64 `json:"select_color_index"` //选择的颜色索引
|
|
|
|
|
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"` //渲染结果图 (没有可以不传)
|
|
|
|
|
SwitchInfo map[string]interface{} `json:"switch_info,optional"` //开关信息
|
|
|
|
|
DiyInfo DiyInfo `json:"diy_info,optional"` //用户diy数据(可选)
|
2023-09-14 06:11:22 +00:00
|
|
|
|
}
|
2023-11-08 09:04:01 +00:00
|
|
|
|
type ProductWebsiteUnit {
|
|
|
|
|
Singular string `json:"singular"`
|
|
|
|
|
Complex string `json:"complex"`
|
|
|
|
|
}
|
2023-09-14 06:11:22 +00:00
|
|
|
|
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 (可选)
|
2023-09-13 08:44:23 +00:00
|
|
|
|
}
|
|
|
|
|
//删除购物车
|
2023-09-13 09:27:16 +00:00
|
|
|
|
type DeleteCartReq {
|
2023-11-10 08:04:45 +00:00
|
|
|
|
IdList []int64 `json:"id_list"` //购物车id
|
2023-09-13 08:44:23 +00:00
|
|
|
|
}
|
2023-09-20 03:05:59 +00:00
|
|
|
|
|
2023-09-13 08:44:23 +00:00
|
|
|
|
//获取购物车列表
|
2023-09-13 09:27:16 +00:00
|
|
|
|
type GetCartsReq {
|
2023-09-22 09:21:40 +00:00
|
|
|
|
CartId int64 `form:"cart_id,optional"` //购物车ids可选
|
2023-09-13 08:44:23 +00:00
|
|
|
|
}
|
2023-09-13 09:20:39 +00:00
|
|
|
|
type GetCartsRsp {
|
2023-09-21 06:41:20 +00:00
|
|
|
|
Meta Meta `json:"meta"` //分页信息
|
|
|
|
|
CartList []CartItem `json:"cart_list"`
|
2023-09-13 09:20:39 +00:00
|
|
|
|
}
|
2023-09-13 09:27:16 +00:00
|
|
|
|
type CartItem {
|
2023-09-21 07:40:56 +00:00
|
|
|
|
CartId int64 `json:"cart_id"`
|
|
|
|
|
ProductInfo ProductInfo `json:"product_info"` //产品信息
|
|
|
|
|
SizeInfo SizeInfo `json:"size_info"` //尺寸信息
|
|
|
|
|
FittingInfo FittingInfo `json:"fitting_info"` //配件信息
|
|
|
|
|
ItemPrice string `json:"item_price"` //单价
|
|
|
|
|
TotalPrice string `json:"total_price"` //单价X数量=总价
|
|
|
|
|
DiyInformation DiyInformation `json:"diy_information"` //diy信息
|
|
|
|
|
PurchaseQuantity int64 `json:"purchase_quantity"` //当前购买数量
|
|
|
|
|
MinPurchaseQuantity int64 `json:"min_purchase_quantity"` //起购数量
|
|
|
|
|
StepPurchaseQuantity int64 `json:"step_purchase_quantity"` //购买加或者减少步进量
|
2023-10-08 10:00:21 +00:00
|
|
|
|
IsHighlyCustomized int64 `json:"is_highly_customized"` //是否高度定制
|
2023-09-21 07:40:56 +00:00
|
|
|
|
IsInvalid bool `json:"is_invalid"` //是否无效
|
|
|
|
|
InvalidDescription string `json:"invalid_description"` //无效原因
|
|
|
|
|
IsSelected bool `json:"is_selected"` //是否选中
|
2023-09-26 07:28:17 +00:00
|
|
|
|
TemplateTag string `json:"template_tag"` //模板标签
|
2023-10-07 09:07:53 +00:00
|
|
|
|
SelectColorIndex int64 `json:"select_color_index"` //选择的颜色索引
|
2023-09-26 07:28:17 +00:00
|
|
|
|
Logo string `json:"logo"`
|
2023-10-07 02:43:33 +00:00
|
|
|
|
RenderImage string `json:"render_image"` //渲染结果图
|
2023-09-13 09:20:39 +00:00
|
|
|
|
}
|
2023-09-18 03:45:29 +00:00
|
|
|
|
type ProductInfo {
|
|
|
|
|
ProductId int64 `json:"product_id"` //产品id
|
|
|
|
|
ProductName string `json:"product_name"`
|
|
|
|
|
ProductSn string `json:"product_sn"`
|
|
|
|
|
ProductCover string `json:"product_cover"` //产品图
|
|
|
|
|
ProductCoverMetadata interface{} `json:"product_cover_metadata"` //产品图元数据
|
|
|
|
|
}
|
2023-09-13 09:27:16 +00:00
|
|
|
|
type SizeInfo {
|
|
|
|
|
SizeId int64 `json:"size_id"` //尺寸id
|
|
|
|
|
Capacity string `json:"capacity"` //尺寸名称
|
2023-09-13 09:20:39 +00:00
|
|
|
|
Title SizeTitle `json:"title"`
|
|
|
|
|
}
|
2023-09-13 09:27:16 +00:00
|
|
|
|
type FittingInfo {
|
|
|
|
|
FittingId int64 `json:"fitting_id"` //配件id
|
2023-09-13 09:20:39 +00:00
|
|
|
|
FittingName string `json:"fitting_name"` //配件名称
|
|
|
|
|
}
|
2023-09-13 09:27:16 +00:00
|
|
|
|
type SizeTitle {
|
|
|
|
|
Cm string `json:"cm"`
|
2023-09-13 09:20:39 +00:00
|
|
|
|
Inch string `json:"inch"`
|
|
|
|
|
}
|
2023-09-13 09:27:16 +00:00
|
|
|
|
type DiyInformation {
|
|
|
|
|
Phone string `json:"phone"`
|
2023-09-13 09:20:39 +00:00
|
|
|
|
Address string `json:"address"`
|
|
|
|
|
Website string `json:"website"`
|
2023-09-13 09:27:16 +00:00
|
|
|
|
Qrcode string `json:"qrcode"`
|
2023-09-15 06:19:14 +00:00
|
|
|
|
Slogan string `json:"slogan"`
|
2023-09-15 09:59:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//计算购物车价格
|
|
|
|
|
type CalculateCartPriceReq {
|
|
|
|
|
CalculateList []CalculateItem `json:"calculate_list"`
|
|
|
|
|
}
|
|
|
|
|
type CalculateItem {
|
|
|
|
|
CartId int64 `json:"cart_id"` //购物车id
|
|
|
|
|
PurchaseQuantity int64 `json:"purchase_quantity"` //数量
|
2023-09-20 03:02:46 +00:00
|
|
|
|
IsSelected bool `json:"is_selected"` //是否是选中的,选中的会统计到总价中
|
2023-09-15 09:59:33 +00:00
|
|
|
|
}
|
|
|
|
|
type CalculateCartPriceRsp {
|
2023-09-18 07:18:55 +00:00
|
|
|
|
SubTotalPrice string `json:"sub_total_price"`
|
2023-09-15 09:59:33 +00:00
|
|
|
|
CalculateResultList []CalculateResultItem `json:"calculate_result_list"`
|
|
|
|
|
}
|
|
|
|
|
type CalculateResultItem {
|
|
|
|
|
CartId int64 `json:"cart_id"` //购物车id
|
|
|
|
|
ItemPrice string `json:"item_price"` //单价
|
|
|
|
|
TotalPrice string `json:"total_price"` //总价
|
2023-10-19 10:42:28 +00:00
|
|
|
|
}
|
|
|
|
|
//获取购物车数量
|
|
|
|
|
type GetCartNumRsp {
|
|
|
|
|
TotalCount int64 `json:"total_count"`
|
2023-09-13 09:20:39 +00:00
|
|
|
|
}
|