72 lines
2.0 KiB
Protocol Buffer
72 lines
2.0 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package hyapp.wallet.v1;
|
|
|
|
option go_package = "hyapp/api/proto/wallet/v1;walletv1";
|
|
|
|
// DebitGiftRequest 是 room-service 送礼同步扣费的最小账务输入。
|
|
message DebitGiftRequest {
|
|
string command_id = 1;
|
|
string room_id = 2;
|
|
int64 sender_user_id = 3;
|
|
int64 target_user_id = 4;
|
|
string gift_id = 5;
|
|
int32 gift_count = 6;
|
|
// price_version 为空时使用当前生效价格;非空时必须命中 active 价格版本。
|
|
string price_version = 7;
|
|
}
|
|
|
|
// DebitGiftResponse 返回扣费流水、服务端结算值和 sender COIN 账后余额。
|
|
message DebitGiftResponse {
|
|
string billing_receipt_id = 1;
|
|
string transaction_id = 2;
|
|
int64 coin_spent = 3;
|
|
int64 gift_point_added = 4;
|
|
int64 heat_value = 5;
|
|
string price_version = 6;
|
|
// balance_after 是 sender COIN available_amount 账后余额。
|
|
int64 balance_after = 7;
|
|
}
|
|
|
|
// AssetBalance 是用户某类资产的余额投影。
|
|
message AssetBalance {
|
|
string asset_type = 1;
|
|
int64 available_amount = 2;
|
|
int64 frozen_amount = 3;
|
|
int64 version = 4;
|
|
}
|
|
|
|
// GetBalancesRequest 查询用户多资产余额;内部调用方负责鉴权和用户范围控制。
|
|
message GetBalancesRequest {
|
|
string request_id = 1;
|
|
int64 user_id = 2;
|
|
repeated string asset_types = 3;
|
|
}
|
|
|
|
message GetBalancesResponse {
|
|
repeated AssetBalance balances = 1;
|
|
}
|
|
|
|
// AdminCreditAssetRequest 是后台手动入账/调账的最小审计命令。
|
|
message AdminCreditAssetRequest {
|
|
string command_id = 1;
|
|
int64 target_user_id = 2;
|
|
string asset_type = 3;
|
|
int64 amount = 4;
|
|
int64 operator_user_id = 5;
|
|
string reason = 6;
|
|
string evidence_ref = 7;
|
|
}
|
|
|
|
message AdminCreditAssetResponse {
|
|
string transaction_id = 1;
|
|
AssetBalance balance = 2;
|
|
}
|
|
|
|
// WalletService 是内部账务 gRPC 边界,外部 HTTP 入口仍由 gateway-service 承载。
|
|
service WalletService {
|
|
rpc DebitGift(DebitGiftRequest) returns (DebitGiftResponse);
|
|
rpc GetBalances(GetBalancesRequest) returns (GetBalancesResponse);
|
|
rpc AdminCreditAsset(AdminCreditAssetRequest) returns (AdminCreditAssetResponse);
|
|
}
|