2026-06-23 11:53:00 +08:00

43 lines
925 B
Go

package ledger
import (
"strings"
)
// GameCoinChangeCommand 是 game-service 对钱包发起的游戏专用金币改账命令。
type GameCoinChangeCommand struct {
AppCode string
CommandID string
UserID int64
PlatformCode string
GameID string
ProviderOrderID string
ProviderRoundID string
OpType string
CoinAmount int64
RoomID string
RequestHash string
}
// GameCoinChangeReceipt 是游戏改账成功或幂等重放后的稳定回执。
type GameCoinChangeReceipt struct {
TransactionID string
BalanceAfter int64
IdempotentReplay bool
}
func NormalizeGameOpType(opType string) string {
switch strings.ToLower(strings.TrimSpace(opType)) {
case GameOpDebit:
return GameOpDebit
case GameOpCredit:
return GameOpCredit
case GameOpRefund:
return GameOpRefund
case GameOpReverse:
return GameOpReverse
default:
return ""
}
}