| 
									
										
										
										
											2024-10-05 06:55:28 +00:00
										 |  |  | syntax = "proto3";
 | 
					
						
							|  |  |  | package tweeting;
 | 
					
						
							|  |  |  | option go_package = "./tweeting";
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // ========== 基本回應 ===========
 | 
					
						
							|  |  |  | message OKResp {}
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // 空的請求
 | 
					
						
							|  |  |  | message NoneReq {}
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // 分頁信息
 | 
					
						
							| 
									
										
										
										
											2024-10-12 09:49:58 +00:00
										 |  |  | message Pager {
 | 
					
						
							|  |  |  |   int64 total = 1;  // 總數量
 | 
					
						
							|  |  |  |   int64 size = 2;   // 每頁數量
 | 
					
						
							|  |  |  |   int64 index = 3;  // 當前頁碼
 | 
					
						
							| 
									
										
										
										
											2024-10-05 06:55:28 +00:00
										 |  |  | }
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-10-12 09:49:58 +00:00
										 |  |  | message CreateOrderReq {
 | 
					
						
							|  |  |  |   string business_id = 1;   // 訂單業務流水號
 | 
					
						
							|  |  |  |   int32 order_type = 2;     // 訂單類型
 | 
					
						
							|  |  |  |   int32 order_status = 3;   // 訂單狀態
 | 
					
						
							|  |  |  |   string brand = 4;         // 下單平台
 | 
					
						
							|  |  |  |   string order_uid = 5;     // 下單用戶 UID
 | 
					
						
							|  |  |  |   string reference_id = 6;  // 訂單來源
 | 
					
						
							|  |  |  |   string count = 7;         // 訂單數量 (decimal to string)
 | 
					
						
							|  |  |  |   string order_fee = 8;     // 訂單手續費 (decimal to string)
 | 
					
						
							|  |  |  |   string amount = 9;        // 單價 (decimal to string)
 | 
					
						
							| 
									
										
										
										
											2024-10-05 06:55:28 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-10-12 09:49:58 +00:00
										 |  |  |   // 以下是可選字段(擴充用)
 | 
					
						
							|  |  |  |   optional string reference_brand = 10;           // 訂單來源平台
 | 
					
						
							|  |  |  |   optional string reference_uid = 11;             // 訂單來源用戶 UID
 | 
					
						
							|  |  |  |   optional int64 wallet_status = 12;              // 交易金額狀態
 | 
					
						
							|  |  |  |   optional int64 three_party_status = 13;         // 三方請求狀態
 | 
					
						
							|  |  |  |   optional int64 direction_type = 14;             // 交易方向
 | 
					
						
							|  |  |  |   optional string crypto_type = 15;               // 交易幣種
 | 
					
						
							|  |  |  |   optional string third_party_fee = 16;           // 第三方手續費 (decimal to string)
 | 
					
						
							|  |  |  |   optional string crypto_to_usdt_rate = 17;       // 交易幣種對 USDT 匯率 (decimal to string)
 | 
					
						
							|  |  |  |   optional string fiat_to_usd_rate = 18;          // 法幣對 USD 匯率 (decimal to string)
 | 
					
						
							|  |  |  |   optional string fee_crypto_to_usdt_rate = 19;   // 手續費幣種對 USDT 匯率 (decimal to string)
 | 
					
						
							|  |  |  |   optional string usdt_to_crypto_type_rate = 20;  // USDT 對交易幣種匯率 (decimal to string)
 | 
					
						
							|  |  |  |   optional string payment_fiat = 21;              // 支付法幣
 | 
					
						
							|  |  |  |   optional string payment_unit_price = 22;        // crypto 單價 (decimal to string)
 | 
					
						
							|  |  |  |   optional string payment_template_id = 23;       // 支付方式配置 ID
 | 
					
						
							|  |  |  |   optional int64 order_arrival_time = 24;         // 訂單到帳時間
 | 
					
						
							|  |  |  |   optional int64 order_payment_time = 25;         // 訂單付款時間
 | 
					
						
							|  |  |  |   optional int64 unpaid_timeout_second = 26;      // 支付期限秒數
 | 
					
						
							|  |  |  |   optional string chain_type = 27;                // 主網類型
 | 
					
						
							|  |  |  |   optional string tx_hash = 28;                   // 交易哈希
 | 
					
						
							|  |  |  |   optional string from_address = 29;              // 來源地址
 | 
					
						
							|  |  |  |   optional string to_address = 30;                // 目標地址
 | 
					
						
							|  |  |  |   optional string chain_fee = 31;                 // 鏈上交易手續費 (decimal to string)
 | 
					
						
							|  |  |  |   optional string chain_fee_crypto = 32;          // 鏈上手續費使用幣別
 | 
					
						
							|  |  |  |   optional string memo = 33;                      // 鏈上備註
 | 
					
						
							|  |  |  |   optional string order_note = 34;                // 訂單交易備註
 | 
					
						
							|  |  |  | }
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | message CancelOrderReq {
 | 
					
						
							|  |  |  |   string business_id = 1;
 | 
					
						
							|  |  |  |   int64 status = 2;
 | 
					
						
							|  |  |  | }
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | message ModifyOrderStatusReq {
 | 
					
						
							|  |  |  |   string business_id = 1;
 | 
					
						
							|  |  |  |   int64 status = 2;
 | 
					
						
							|  |  |  | }
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | message DeleteOrderReq {
 | 
					
						
							|  |  |  |   string business_id = 1;
 | 
					
						
							|  |  |  | }
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | message OrderStatusTimeoutReq {}
 | 
					
						
							| 
									
										
										
										
											2024-10-06 07:02:30 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-10-12 09:49:58 +00:00
										 |  |  | message GetOrderReq {
 | 
					
						
							|  |  |  |   string business_id = 1;  // 訂單業務流水號
 | 
					
						
							|  |  |  | }
 | 
					
						
							|  |  |  | message GetOrderResp {
 | 
					
						
							|  |  |  |   string business_id = 1;   // 訂單業務流水號
 | 
					
						
							|  |  |  |   int32 order_type = 2;     // 訂單類型
 | 
					
						
							|  |  |  |   int32 order_status = 3;   // 訂單狀態
 | 
					
						
							|  |  |  |   string brand = 4;         // 下單平台
 | 
					
						
							|  |  |  |   string order_uid = 5;     // 下單用戶 UID
 | 
					
						
							|  |  |  |   string reference_id = 6;  // 訂單來源
 | 
					
						
							|  |  |  |   string count = 7;         // 訂單數量 (decimal to string)
 | 
					
						
							|  |  |  |   string order_fee = 8;     // 訂單手續費 (decimal to string)
 | 
					
						
							|  |  |  |   string amount = 9;        // 單價 (decimal to string)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // 以下是可選字段(擴充用)
 | 
					
						
							|  |  |  |   optional string reference_brand = 10;           // 訂單來源平台
 | 
					
						
							|  |  |  |   optional string reference_uid = 11;             // 訂單來源用戶 UID
 | 
					
						
							|  |  |  |   optional int64 wallet_status = 12;              // 交易金額狀態
 | 
					
						
							|  |  |  |   optional int64 three_party_status = 13;         // 三方請求狀態
 | 
					
						
							|  |  |  |   optional int64 direction_type = 14;             // 交易方向
 | 
					
						
							|  |  |  |   optional string crypto_type = 15;               // 交易幣種
 | 
					
						
							|  |  |  |   optional string third_party_fee = 16;           // 第三方手續費 (decimal to string)
 | 
					
						
							|  |  |  |   optional string crypto_to_usdt_rate = 17;       // 交易幣種對 USDT 匯率 (decimal to string)
 | 
					
						
							|  |  |  |   optional string fiat_to_usd_rate = 18;          // 法幣對 USD 匯率 (decimal to string)
 | 
					
						
							|  |  |  |   optional string fee_crypto_to_usdt_rate = 19;   // 手續費幣種對 USDT 匯率 (decimal to string)
 | 
					
						
							|  |  |  |   optional string usdt_to_crypto_type_rate = 20;  // USDT 對交易幣種匯率 (decimal to string)
 | 
					
						
							|  |  |  |   optional string payment_fiat = 21;              // 支付法幣
 | 
					
						
							|  |  |  |   optional string payment_unit_price = 22;        // crypto 單價 (decimal to string)
 | 
					
						
							|  |  |  |   optional string payment_template_id = 23;       // 支付方式配置 ID
 | 
					
						
							|  |  |  |   optional int64 order_arrival_time = 24;         // 訂單到帳時間
 | 
					
						
							|  |  |  |   optional int64 order_payment_time = 25;         // 訂單付款時間
 | 
					
						
							|  |  |  |   optional int64 unpaid_timeout_second = 26;      // 支付期限秒數
 | 
					
						
							|  |  |  |   optional string chain_type = 27;                // 主網類型
 | 
					
						
							|  |  |  |   optional string tx_hash = 28;                   // 交易哈希
 | 
					
						
							|  |  |  |   optional string from_address = 29;              // 來源地址
 | 
					
						
							|  |  |  |   optional string to_address = 30;                // 目標地址
 | 
					
						
							|  |  |  |   optional string chain_fee = 31;                 // 鏈上交易手續費 (decimal to string)
 | 
					
						
							|  |  |  |   optional string chain_fee_crypto = 32;          // 鏈上手續費使用幣別
 | 
					
						
							|  |  |  |   optional string memo = 33;                      // 鏈上備註
 | 
					
						
							|  |  |  |   optional string order_note = 34;                // 訂單交易備註
 | 
					
						
							|  |  |  |   int64 create_time = 35;                      // 建立時間
 | 
					
						
							|  |  |  |   int64 update_time = 36;                     // 更新時間
 | 
					
						
							|  |  |  | }
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | message ModifyOrderReq {}
 | 
					
						
							| 
									
										
										
										
											2024-10-06 07:02:30 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-10-12 09:49:58 +00:00
										 |  |  | message ListOrderReq {
 | 
					
						
							|  |  |  |   int64 page_index = 1; // required
 | 
					
						
							|  |  |  |   int64 page_size = 2;  // required
 | 
					
						
							| 
									
										
										
										
											2024-10-06 07:02:30 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-10-12 09:49:58 +00:00
										 |  |  |   string reference_id = 3;
 | 
					
						
							|  |  |  |   string reference_uid = 4;
 | 
					
						
							|  |  |  |   string business_id = 5;
 | 
					
						
							|  |  |  |   string uid = 6;
 | 
					
						
							|  |  |  |   int32 order_type = 7;
 | 
					
						
							|  |  |  |   repeated int32 direction_type = 8;
 | 
					
						
							|  |  |  |   repeated int32 order_status = 9;
 | 
					
						
							| 
									
										
										
										
											2024-10-06 07:02:30 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-10-12 09:49:58 +00:00
										 |  |  |   int64 start_create_time = 10;
 | 
					
						
							|  |  |  |   int64 end_create_time = 11;
 | 
					
						
							|  |  |  |   int64 start_update_time = 12;
 | 
					
						
							|  |  |  |   int64 end_update_time = 13;
 | 
					
						
							|  |  |  |   int64 start_order_arrival_time = 14;
 | 
					
						
							|  |  |  |   int64 end_order_arrival_time = 15;
 | 
					
						
							|  |  |  |   int64 start_order_payment_time = 16;
 | 
					
						
							|  |  |  |   int64 end_order_payment_time = 17;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   string crypto_type = 18;
 | 
					
						
							|  |  |  |   string tx_hash = 19;
 | 
					
						
							|  |  |  | }
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | message ListOrderResp {
 | 
					
						
							|  |  |  |   repeated GetOrderResp data = 1; // 訂單列表
 | 
					
						
							|  |  |  |   Pager page = 2;
 | 
					
						
							|  |  |  | }
 | 
					
						
							| 
									
										
										
										
											2024-10-05 06:55:28 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | // OrderService 訂單服務(業務邏輯在外面組合)
 | 
					
						
							| 
									
										
										
										
											2024-10-12 09:49:58 +00:00
										 |  |  | service OrderService {
 | 
					
						
							| 
									
										
										
										
											2024-10-06 07:02:30 +00:00
										 |  |  |   // CreateOrder 建立訂單
 | 
					
						
							| 
									
										
										
										
											2024-10-12 09:49:58 +00:00
										 |  |  |   rpc CreateOrder(CreateOrderReq) returns (OKResp);
 | 
					
						
							| 
									
										
										
										
											2024-10-06 07:02:30 +00:00
										 |  |  |   // CancelOrder 取消訂單
 | 
					
						
							| 
									
										
										
										
											2024-10-12 09:49:58 +00:00
										 |  |  |   rpc CancelOrder(CancelOrderReq) returns (OKResp);
 | 
					
						
							| 
									
										
										
										
											2024-10-06 07:02:30 +00:00
										 |  |  |   // ModifyOrder 修改訂單
 | 
					
						
							| 
									
										
										
										
											2024-10-12 09:49:58 +00:00
										 |  |  |   rpc ModifyOrder(ModifyOrderReq) returns (OKResp);
 | 
					
						
							| 
									
										
										
										
											2024-10-06 07:02:30 +00:00
										 |  |  |   // ModifyOrderStatus 修改訂單狀態
 | 
					
						
							| 
									
										
										
										
											2024-10-12 09:49:58 +00:00
										 |  |  |   rpc ModifyOrderStatus(ModifyOrderStatusReq) returns (OKResp);
 | 
					
						
							| 
									
										
										
										
											2024-10-06 07:02:30 +00:00
										 |  |  |   // DeleteOrder 刪除訂單(軟刪除)
 | 
					
						
							| 
									
										
										
										
											2024-10-12 09:49:58 +00:00
										 |  |  |   rpc DeleteOrder(DeleteOrderReq) returns (OKResp);
 | 
					
						
							| 
									
										
										
										
											2024-10-06 07:02:30 +00:00
										 |  |  |   // GetOrder 取得訂單詳情
 | 
					
						
							| 
									
										
										
										
											2024-10-12 09:49:58 +00:00
										 |  |  |   rpc GetOrder(GetOrderReq) returns (GetOrderResp);
 | 
					
						
							| 
									
										
										
										
											2024-10-06 07:02:30 +00:00
										 |  |  |   // ListOrder 取得訂單列表
 | 
					
						
							| 
									
										
										
										
											2024-10-12 09:49:58 +00:00
										 |  |  |   rpc ListOrder(ListOrderReq) returns (ListOrderResp);
 | 
					
						
							| 
									
										
										
										
											2024-10-06 07:02:30 +00:00
										 |  |  |   // OrderStatusTimeout 訂單超時任務/cron/order-status/timeout
 | 
					
						
							| 
									
										
										
										
											2024-10-12 09:49:58 +00:00
										 |  |  |   rpc OrderStatusTimeout(OrderStatusTimeoutReq) returns (OKResp);
 | 
					
						
							| 
									
										
										
										
											2024-10-06 07:02:30 +00:00
										 |  |  | }
 |