update product service proto

This commit is contained in:
daniel.w 2024-10-25 16:21:12 +08:00
parent e01d14ab90
commit 25b422b907
1 changed files with 130 additions and 105 deletions

View File

@ -165,8 +165,8 @@ service OrderService {
}
// ========== 錢包服務 ===========
message CreateWalletReq{
repeated WalletItem item =1;
message CreateWalletReq {
repeated WalletItem item = 1;
}
message WalletItem {
@ -177,17 +177,17 @@ message WalletItem {
int64 wallet_type = 5; // 錢包金額種類 1. 可用餘額 2. 凍結餘額 3. 限制餘額
}
message WalletTransactionReq{
string uid =1; // 錢包擁有者的 UID
optional string order_id =2; // 訂單編號
optional string business_type =3; // 業務種類
message WalletTransactionReq {
string uid = 1; // 錢包擁有者的 UID
optional string order_id = 2; // 訂單編號
optional string business_type = 3; // 業務種類
optional string currency_type = 4; // 幣別
optional string amount = 5; // 轉帳金額
optional int64 wallet_type = 6;// 操作金額種類
optional int64 wallet_type = 6; // 操作金額種類
}
message QueryBalanceByDateReq{
string uid =1; // 錢包擁有者的 UID
message QueryBalanceByDateReq {
string uid = 1; // 錢包擁有者的 UID
string currency_type = 2; // 幣別
}
@ -195,10 +195,10 @@ message QueryBalanceByDateResp {
string currency_type = 1; // 幣別
string available = 2; // 可用餘額
UnavailableBalance unavailable = 3; // 不可用餘額
int64 update_time=4;
int64 update_time = 4;
}
message UnavailableBalance{
message UnavailableBalance {
string freeze = 1; // 凍結餘額
string unconfirmed = 2; // 限制餘額
}
@ -247,9 +247,15 @@ message StockResp {
int64 reserved_quantity = 3; // 預留庫存
}
message StockListReq {
int64 page_index = 1; // required
int64 page_size = 2; // required
repeated string product_id = 3; // 一次查多筆
}
message StockListResp {
repeated StockResp stock_items = 1; // 所有商品的庫存清單
Pager page =2;
Pager page = 2;
}
message StockReservationReq {
@ -261,8 +267,9 @@ message BatchStockAdjustmentReq {
repeated StockAdjustmentReq adjustments = 1; // 批次調整庫存
}
service InventoryService {
// CreateStock 建立庫存品項
rpc CreateStock(StockAdjustmentReq) returns (OKResp);
// AddStock 增加庫存
rpc AddStock(StockAdjustmentReq) returns (OKResp);
// ReduceStock 減少庫存
@ -270,7 +277,7 @@ service InventoryService {
// QueryStock 查詢單一商品的庫存
rpc QueryStock(StockQueryReq) returns (StockResp);
// ListAllStock 查詢所有商品的庫存狀況
rpc ListAllStock(NoneReq) returns (StockListResp);
rpc ListAllStock(StockListReq) returns (StockListResp);
// ReserveStock 預留庫存 (用於未完成的訂單)
rpc ReserveStock(StockReservationReq) returns (OKResp);
// ReleaseReservedStock 釋放預留庫存 (取消或失效的訂單)
@ -284,17 +291,34 @@ service InventoryService {
// 商品請求和回應訊息
message ProductCreateReq {
string name = 1; // 商品名稱
string category = 2; // 商品分類
string description = 3; // 商品描述
string description = 2; // 商品簡述
string content = 3; // 詳細商品內容
double price = 4; // 商品價格
int64 amount_type = 5; // 1 有限數量 2 無限數量
string currency = 6; // 貨幣類型 (如 USD, TWD)
repeated string brand = 7; // 產品品牌,可以看成channel_id or uid 就是誰得商品,用品牌比較通用
repeated string category = 8; // 商品分類
repeated string tags = 9; // 產品標籤(方便篩選)
string sku = 10; // 庫存單位(Stock Keeping Unit)
repeated string images = 11; // 商品照片網址
optional string coupon_id = 12; // 本商品專屬折扣碼 id
}
message ProductUpdateReq {
string product_id = 1; // 商品ID
string name = 2; // 商品名稱
string category = 3; // 商品分類
string description = 4; // 商品描述
double price = 5; // 商品價格
optional string name = 2; // 商品名稱
optional string description = 3; // 商品簡述
optional string content = 4; // 詳細商品內容
optional double price = 5; // 商品價格
optional int64 amount_type = 6; // 1 有限數量 2 無限數量
optional string currency = 7; // 貨幣類型 (如 USD, TWD)
repeated string brand = 8; // 產品品牌,可以看成channel_id or uid 就是誰得商品,用品牌比較通用
repeated string category = 9; // 商品分類
repeated string tags = 10; // 產品標籤(方便篩選)
optional string sku = 11; // 庫存單位(Stock Keeping Unit)
repeated string images = 12; // 商品照片網址
optional string coupon_id = 13; // 本商品專屬折扣碼 id
optional bool is_available = 14; // 是否上架
}
message ProductDeleteReq {
@ -308,28 +332,36 @@ message ProductQueryReq {
message ProductResp {
string product_id = 1; // 商品ID
string name = 2; // 商品名稱
string category = 3; // 商品分類
string description = 4; // 商品描述
string description = 3; // 商品簡述
string content = 4; // 詳細商品內容
double price = 5; // 商品價格
bool is_available = 6; // 是否上架
int64 amount_type = 6; // 1 有限數量 2 無限數量
repeated string currency = 7; // 貨幣類型 (如 USD, TWD)
repeated string brand = 8; // 產品品牌,可以看成channel_id or uid 就是誰得商品,用品牌比較通用
string category = 9; // 商品分類
repeated string tags = 10; // 產品標籤(方便篩選)
string sku = 11; // 庫存單位(Stock Keeping Unit)
repeated string images = 12; // 商品照片網址
string coupon_id = 13; // 本商品專屬折扣碼 id
bool is_available = 14; // 是否上架
}
message ProductListReq {
int64 page_index = 1;
int64 page_size = 2;
repeated string product_id = 3; // 商品ID
optional bool is_available = 4; // 是否上架
repeated string tags = 5; // 產品標籤(方便篩選)
optional int64 amount_type = 6; // 1 有限數量 2 無限數量
repeated string currency = 7; // 貨幣類型 (如 USD, TWD)
repeated string brand = 8; // 產品品牌,可以看成channel_id or uid 就是誰得商品,用品牌比較通用
repeated string category = 9; // 商品分類
}
message ProductListResp {
repeated ProductResp products = 1; // 所有商品清單
}
message CategoryQueryReq {
string category = 1; // 商品分類
}
message ProductPriceUpdateReq {
string product_id = 1; // 商品ID
double new_price = 2; // 新價格
}
message ProductStatusUpdateReq {
string product_id = 1; // 商品ID
bool is_available = 2; // 是否上架
Pager page = 2;
}
service ProductService {
@ -342,13 +374,7 @@ service ProductService {
// QueryProduct 查詢單一商品資訊
rpc QueryProduct(ProductQueryReq) returns (ProductResp);
// ListAllProducts 查詢所有商品資訊
rpc ListAllProducts(NoneReq) returns (ProductListResp);
// ListProductsByCategory 根據分類查詢商品
rpc ListProductsByCategory(CategoryQueryReq) returns (ProductListResp);
// UpdateProductPrice 更新商品價格
rpc UpdateProductPrice(ProductPriceUpdateReq) returns (OKResp);
// UpdateProductStatus 更新商品狀態 (上架/下架)
rpc UpdateProductStatus(ProductStatusUpdateReq) returns (OKResp);
rpc ListAllProducts(ProductListReq) returns (ProductListResp);
}
// ========== 訂閱服務 ===========
@ -382,11 +408,10 @@ message SubscriptionResp {
string status = 6; // 訂閱狀態 (例如: "active", "expired", "canceled")
}
message ListSubscriptionsReq {
int64 page_index=1;
int64 page_size=2;
optional string uid=3;
int64 page_index = 1;
int64 page_size = 2;
optional string uid = 3;
}
message SubscriptionListResp {