update product service proto
This commit is contained in:
		
							parent
							
								
									e01d14ab90
								
							
						
					
					
						commit
						25b422b907
					
				| 
						 | 
				
			
			@ -112,13 +112,13 @@ message GetOrderResp {
 | 
			
		|||
  optional string chain_fee_crypto = 32;          // 鏈上手續費使用幣別
 | 
			
		||||
  optional string memo = 33;                      // 鏈上備註
 | 
			
		||||
  optional string order_note = 34;                // 訂單交易備註
 | 
			
		||||
  int64 create_time = 35;                      // 建立時間
 | 
			
		||||
  int64 update_time = 36;                     // 更新時間
 | 
			
		||||
  int64 create_time = 35;                         // 建立時間
 | 
			
		||||
  int64 update_time = 36;                         // 更新時間
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message ListOrderReq {
 | 
			
		||||
  int64 page_index = 1; // required
 | 
			
		||||
  int64 page_size = 2;  // required
 | 
			
		||||
  int64 page_index = 1;  // required
 | 
			
		||||
  int64 page_size = 2;   // required
 | 
			
		||||
 | 
			
		||||
  string reference_id = 3;
 | 
			
		||||
  string reference_uid = 4;
 | 
			
		||||
| 
						 | 
				
			
			@ -142,7 +142,7 @@ message ListOrderReq {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
message ListOrderResp {
 | 
			
		||||
  repeated GetOrderResp data = 1; // 訂單列表
 | 
			
		||||
  repeated GetOrderResp data = 1;  // 訂單列表
 | 
			
		||||
  Pager page = 2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -165,42 +165,42 @@ service OrderService {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
// ========== 錢包服務 ===========
 | 
			
		||||
message CreateWalletReq{
 | 
			
		||||
  repeated WalletItem item =1;
 | 
			
		||||
message CreateWalletReq {
 | 
			
		||||
  repeated WalletItem item = 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message WalletItem {
 | 
			
		||||
  string source = 1; // 錢包來源
 | 
			
		||||
  string uid = 2; // 錢包擁有者的 UID
 | 
			
		||||
  string currency_type = 3; // 幣別
 | 
			
		||||
  string current_balance = 4; // 當前餘額
 | 
			
		||||
  int64 wallet_type = 5; // 錢包金額種類 1. 可用餘額 2. 凍結餘額 3. 限制餘額
 | 
			
		||||
  string source = 1;           // 錢包來源
 | 
			
		||||
  string uid = 2;              // 錢包擁有者的 UID
 | 
			
		||||
  string currency_type = 3;    // 幣別
 | 
			
		||||
  string current_balance = 4;  // 當前餘額
 | 
			
		||||
  int64 wallet_type = 5;       // 錢包金額種類 1. 可用餘額 2. 凍結餘額 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;// 操作金額種類
 | 
			
		||||
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;     // 操作金額種類
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message QueryBalanceByDateReq{
 | 
			
		||||
  string uid =1; // 錢包擁有者的 UID
 | 
			
		||||
  string currency_type = 2; // 幣別
 | 
			
		||||
message QueryBalanceByDateReq {
 | 
			
		||||
  string uid = 1;            // 錢包擁有者的 UID
 | 
			
		||||
  string currency_type = 2;  // 幣別
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message QueryBalanceByDateResp {
 | 
			
		||||
  string currency_type = 1; // 幣別
 | 
			
		||||
  string available = 2; // 可用餘額
 | 
			
		||||
  UnavailableBalance unavailable = 3; // 不可用餘額
 | 
			
		||||
  int64 update_time=4;
 | 
			
		||||
  string currency_type = 1;            // 幣別
 | 
			
		||||
  string available = 2;                // 可用餘額
 | 
			
		||||
  UnavailableBalance unavailable = 3;  // 不可用餘額
 | 
			
		||||
  int64 update_time = 4;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message UnavailableBalance{
 | 
			
		||||
  string freeze = 1; // 凍結餘額
 | 
			
		||||
  string unconfirmed = 2; // 限制餘額
 | 
			
		||||
message UnavailableBalance {
 | 
			
		||||
  string freeze = 1;       // 凍結餘額
 | 
			
		||||
  string unconfirmed = 2;  // 限制餘額
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// TODO 未來會新增查詢以及同步的功能
 | 
			
		||||
| 
						 | 
				
			
			@ -233,36 +233,43 @@ service WalletService {
 | 
			
		|||
// ========== 庫存服務 ===========
 | 
			
		||||
 | 
			
		||||
message StockAdjustmentReq {
 | 
			
		||||
  string product_id = 1; // 商品ID
 | 
			
		||||
  int64 quantity = 2; // 調整的數量 (正數表示增加,負數表示減少)
 | 
			
		||||
  string product_id = 1;  // 商品ID
 | 
			
		||||
  int64 quantity = 2;     // 調整的數量 (正數表示增加,負數表示減少)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message StockQueryReq {
 | 
			
		||||
  string product_id = 1; // 商品ID
 | 
			
		||||
  string product_id = 1;  // 商品ID
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message StockResp {
 | 
			
		||||
  string product_id = 1; // 商品ID
 | 
			
		||||
  int64 available_quantity = 2; // 可用庫存
 | 
			
		||||
  int64 reserved_quantity = 3; // 預留庫存
 | 
			
		||||
  string product_id = 1;         // 商品ID
 | 
			
		||||
  int64 available_quantity = 2;  // 可用庫存
 | 
			
		||||
  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;
 | 
			
		||||
  repeated StockResp stock_items = 1;  // 所有商品的庫存清單
 | 
			
		||||
  Pager page = 2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message StockReservationReq {
 | 
			
		||||
  string product_id = 1; // 商品ID
 | 
			
		||||
  int64 quantity = 2; // 預留的數量
 | 
			
		||||
  string product_id = 1;  // 商品ID
 | 
			
		||||
  int64 quantity = 2;     // 預留的數量
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message BatchStockAdjustmentReq {
 | 
			
		||||
  repeated StockAdjustmentReq adjustments = 1; // 批次調整庫存
 | 
			
		||||
  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 釋放預留庫存 (取消或失效的訂單)
 | 
			
		||||
| 
						 | 
				
			
			@ -283,53 +290,78 @@ service InventoryService {
 | 
			
		|||
 | 
			
		||||
// 商品請求和回應訊息
 | 
			
		||||
message ProductCreateReq {
 | 
			
		||||
  string name = 1; // 商品名稱
 | 
			
		||||
  string category = 2; // 商品分類
 | 
			
		||||
  string description = 3; // 商品描述
 | 
			
		||||
  double price = 4; // 商品價格
 | 
			
		||||
  string name = 1;                 // 商品名稱
 | 
			
		||||
  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; // 商品價格
 | 
			
		||||
  string product_id = 1;            // 商品ID
 | 
			
		||||
  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 {
 | 
			
		||||
  string product_id = 1; // 商品ID
 | 
			
		||||
  string product_id = 1;  // 商品ID
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message ProductQueryReq {
 | 
			
		||||
  string product_id = 1; // 商品ID
 | 
			
		||||
  string product_id = 1;  // 商品ID
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message ProductResp {
 | 
			
		||||
  string product_id = 1; // 商品ID
 | 
			
		||||
  string name = 2; // 商品名稱
 | 
			
		||||
  string category = 3; // 商品分類
 | 
			
		||||
  string description = 4; // 商品描述
 | 
			
		||||
  double price = 5; // 商品價格
 | 
			
		||||
  bool is_available = 6; // 是否上架
 | 
			
		||||
  string product_id = 1;         // 商品ID
 | 
			
		||||
  string name = 2;               // 商品名稱
 | 
			
		||||
  string description = 3;        // 商品簡述
 | 
			
		||||
  string content = 4;            // 詳細商品內容
 | 
			
		||||
  double price = 5;              // 商品價格
 | 
			
		||||
  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; // 是否上架
 | 
			
		||||
  repeated ProductResp products = 1;  // 所有商品清單
 | 
			
		||||
  Pager page = 2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
service ProductService {
 | 
			
		||||
| 
						 | 
				
			
			@ -342,71 +374,64 @@ 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);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ========== 訂閱服務 ===========
 | 
			
		||||
 | 
			
		||||
// 訂閱請求和回應訊息
 | 
			
		||||
message SubscriptionCreateReq {
 | 
			
		||||
  string user_id = 1; // 使用者ID
 | 
			
		||||
  string plan_id = 2; // 訂閱方案ID
 | 
			
		||||
  string start_date = 3; // 訂閱開始日期
 | 
			
		||||
  string user_id = 1;     // 使用者ID
 | 
			
		||||
  string plan_id = 2;     // 訂閱方案ID
 | 
			
		||||
  string start_date = 3;  // 訂閱開始日期
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message SubscriptionUpdateReq {
 | 
			
		||||
  string subscription_id = 1; // 訂閱ID
 | 
			
		||||
  string plan_id = 2; // 訂閱方案ID
 | 
			
		||||
  string subscription_id = 1;  // 訂閱ID
 | 
			
		||||
  string plan_id = 2;          // 訂閱方案ID
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message SubscriptionCancelReq {
 | 
			
		||||
  string subscription_id = 1; // 訂閱ID
 | 
			
		||||
  string subscription_id = 1;  // 訂閱ID
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message SubscriptionQueryReq {
 | 
			
		||||
  string subscription_id = 1; // 訂閱ID
 | 
			
		||||
  string subscription_id = 1;  // 訂閱ID
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message SubscriptionResp {
 | 
			
		||||
  string subscription_id = 1; // 訂閱ID
 | 
			
		||||
  string user_id = 2; // 使用者ID
 | 
			
		||||
  string plan_id = 3; // 訂閱方案ID
 | 
			
		||||
  string start_date = 4; // 訂閱開始日期
 | 
			
		||||
  string end_date = 5; // 訂閱結束日期
 | 
			
		||||
  string status = 6; // 訂閱狀態 (例如: "active", "expired", "canceled")
 | 
			
		||||
  string subscription_id = 1;  // 訂閱ID
 | 
			
		||||
  string user_id = 2;          // 使用者ID
 | 
			
		||||
  string plan_id = 3;          // 訂閱方案ID
 | 
			
		||||
  string start_date = 4;       // 訂閱開始日期
 | 
			
		||||
  string end_date = 5;         // 訂閱結束日期
 | 
			
		||||
  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 {
 | 
			
		||||
  repeated SubscriptionResp subscriptions = 1; // 訂閱清單
 | 
			
		||||
  repeated SubscriptionResp subscriptions = 1;  // 訂閱清單
 | 
			
		||||
  Pager page = 2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message SubscriptionRenewReq {
 | 
			
		||||
  string subscription_id = 1; // 訂閱ID
 | 
			
		||||
  string renewal_date = 2; // 續訂日期
 | 
			
		||||
  string subscription_id = 1;  // 訂閱ID
 | 
			
		||||
  string renewal_date = 2;     // 續訂日期
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message SubscriptionStatusQueryReq {
 | 
			
		||||
  string subscription_id = 1; // 訂閱ID
 | 
			
		||||
  string subscription_id = 1;  // 訂閱ID
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message SubscriptionStatusResp {
 | 
			
		||||
  string subscription_id = 1; // 訂閱ID
 | 
			
		||||
  string status = 2; // 訂閱狀態
 | 
			
		||||
  string message = 3; // 狀態訊息
 | 
			
		||||
  string subscription_id = 1;  // 訂閱ID
 | 
			
		||||
  string status = 2;           // 訂閱狀態
 | 
			
		||||
  string message = 3;          // 狀態訊息
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
service SubscriptionService {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue