Files
full/apps/ec/order/proto/cart.proto

71 lines
2.6 KiB
Protocol Buffer

syntax = "proto3";
package order;
option go_package = "./order";
import "blocks.proto";
// Order(订单)微服务-购物车
service Cart {
// 获取购物车的商品数据
rpc Fetch(CartGetRequest) returns (CartGetReply) {};
// 将商品增加至购物车
rpc Create(CartAddRequest) returns (StatusReply) {};
// 修改购物车中的商品数量
rpc Modify(CartSetRequest) returns (StatusReply) {};
// 删除购物车中的商品
rpc Delete(CartDelRequest) returns (StatusReply) {};
}
message CartGetRequest {
string car_identity =1 [json_name="car_identity"]; // 购物车唯一码,主要是用于未登录购物
string passport_identity =2 [json_name="passport_identity"]; // 登录后的用户唯一码
string passport = 3;// 用户
}
message CartGetReply {
repeated CartItem data = 1; // 购物车中的商品数据列表
string car_identity = 2 [json_name="car_identity"]; // 当前账号购物车唯一标识
}
message CartItem{
int64 id = 1; // ID
int64 product_id = 2 [json_name="product_id"]; // 商品ID
string title = 3; //商品名称
string cover_image = 4 [json_name="cover_image"]; //商品封面图片
int64 sales_price = 5 [json_name="sales_price"]; //商品销售价格
string product_identity =6 [json_name="product_identity"]; // 产品唯一码
string product_args =7 [json_name="product_args"]; // 商品属性
int32 number = 8; // 数量
int64 unit_price = 9 [json_name="unit_price"]; // 实际单价
int64 total_price = 10 [json_name="total_price"]; // 总价
string identity = 11; // 购物车商品信息唯一标识
}
message CartAddRequest {
string cart_identity =1 [json_name="cart_identity"]; // 购物车唯一码,主要是用于未登录购物
string passport_identity =2 [json_name="passport_identity"]; // 登录后的用户唯一码
string product_identity =3 [json_name="product_identity"]; // 商品唯一码
int64 product_id = 4 [json_name="product_id"]; // 商品ID
string product_args =5 [json_name="product_args"]; // 商品属性
int32 number = 6; // 数量
int64 spec_id = 7 [json_name="spec_id"]; // 规格id
}
message CartSetRequest {
string identity = 1; // 购物车Identity
int32 number = 2; // 数量
int64 unit_price = 3 [json_name="unit_price"]; // 单价
int64 id = 4;// 商品ID
repeated Updates updates = 5;// 批量更新
}
message Updates {
int64 id = 1;// 商品ID
int64 number = 2; // 数量
}
message CartDelRequest {
repeated int64 id = 3; // 购物车ID
}