2026-06-09 11:04:31 +08:00

214 lines
6.2 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package game
const (
StatusActive = "active"
StatusMaintenance = "maintenance"
StatusDisabled = "disabled"
SceneVoiceRoom = "voice_room"
LaunchModeFullScreen = "full_screen"
LaunchModeHalfScreen = "half_screen"
LaunchModeThreeQuarterScreen = "three_quarter_screen"
LaunchModeH5Popup = "h5_popup"
SessionActive = "active"
AdapterDemo = "demo"
AdapterYomiV4 = "yomi_v4"
AdapterLeaderCCV1 = "leadercc_v1"
AdapterZeeOneV1 = "zeeone_v1"
AdapterBaishunV1 = "baishun_v1"
AdapterVivaGamesV1 = "vivagames_v1"
AdapterReyouV1 = "reyou_v1"
OrderStatusWalletApplying = "wallet_applying"
OrderStatusSucceeded = "succeeded"
OrderStatusFailed = "failed"
OrderStatusConflict = "conflict"
RepairStatusLogged = "logged"
LevelEventStatusPending = "pending"
LevelEventStatusRunning = "running"
LevelEventStatusDelivered = "delivered"
LevelEventStatusFailed = "failed"
)
// Platform 是第三方游戏平台配置事实。
type Platform struct {
AppCode string
PlatformCode string
PlatformName string
Status string
// APIBaseURL 是厂商 H5/Auth 入口,按环境在后台改,不放服务配置文件。
APIBaseURL string
// AdapterType 决定启动参数、签名/解密规则、回包结构和错误码映射。
AdapterType string
// CallbackSecretCiphertext 存放厂商 key/AppSecret后台配置页需要回显回调校验也直接使用它。
CallbackSecretCiphertext string
CallbackSecretConfigured bool
// CallbackIPWhitelist 为空表示不限制;配置后支持单 IP 或 CIDR。
CallbackIPWhitelist []string
// AdapterConfigJSON 存放 uid_mode/default_lang/token_ttl_seconds 等厂商扩展项。
AdapterConfigJSON string
SortOrder int32
CreatedAtMS int64
UpdatedAtMS int64
}
// CatalogItem 是内部稳定 game_id 到第三方 provider_game_id 的映射。
type CatalogItem struct {
AppCode string
GameID string
PlatformCode string
ProviderGameID string
GameName string
Category string
IconURL string
CoverURL string
LaunchMode string
Orientation string
SafeHeight int32
MinCoin int64
Status string
SortOrder int32
Tags []string
CreatedAtMS int64
UpdatedAtMS int64
}
// AppGame 是 App 语音房内看到的跨平台合并游戏卡片。
type AppGame struct {
GameID string
PlatformCode string
NameKey string
Name string
IconURL string
CoverURL string
Category string
LaunchMode string
Orientation string
SafeHeight int32
MinCoin int64
Enabled bool
Maintenance bool
SortOrder int32
}
// LaunchableGame 汇总启动时需要的平台和目录配置。
type LaunchableGame struct {
CatalogItem
PlatformName string
PlatformStatus string
// 以下平台字段随 catalog 一起取出,启动链路不再额外查一次平台配置。
APIBaseURL string
AdapterType string
CallbackSecretCiphertext string
CallbackIPWhitelist []string
AdapterConfigJSON string
}
// LaunchSession 是 H5 启动会话持久事实token 只保存 hash。
type LaunchSession struct {
AppCode string
SessionID string
UserID int64
// DisplayUserID 用于对外 uid_mode避免直接暴露内部数字 ID。
DisplayUserID string
RoomID string
RegionID int64
Scene string
PlatformCode string
GameID string
// ProviderGameID 是厂商侧 gameId/gameUid回调时用它防止跨游戏复用 token。
ProviderGameID string
LaunchTokenHash string
Status string
ExpiresAtMS int64
CreatedAtMS int64
UpdatedAtMS int64
}
// GameOrder 是 provider_order_id 对应的钱包改账事实。
type GameOrder struct {
AppCode string
OrderID string
PlatformCode string
// ProviderOrderID 是厂商幂等键,唯一索引用它挡住重复扣款/返奖。
ProviderOrderID string
// ProviderRoundID 用于关联同一局的投注和返奖。
ProviderRoundID string
GameID string
ProviderGameID string
UserID int64
RoomID string
RegionID int64
// OpType 只允许钱包语义 debit/credit厂商枚举在适配器层转换。
OpType string
CoinAmount int64
Status string
WalletTransactionID string
WalletBalanceAfter int64
RequestHash string
FailureCode string
FailureMessage string
CreatedAtMS int64
UpdatedAtMS int64
}
// LevelEventOutbox 是游戏扣费订单到 activity-service 游戏等级的异步投递事实。
type LevelEventOutbox struct {
AppCode string
EventID string
OrderID string
UserID int64
GameID string
ProviderOrderID string
ProviderRoundID string
CoinAmount int64
WalletTransactionID string
PayloadJSON string
Status string
AttemptCount int32
FailureReason string
OccurredAtMS int64
CreatedAtMS int64
UpdatedAtMS int64
}
// CallbackLog 保存平台回调审计摘要,原始 body 后续可迁移到对象存储。
type CallbackLog struct {
AppCode string
CallbackID string
PlatformCode string
Operation string
RequestID string
ProviderRequestID string
// SignatureValid 用来区分验签失败、业务失败和系统失败,便于联调排错。
SignatureValid bool
// RequestHash/ResponseBodyHash 避免把 token、签名、用户资料等敏感原文直接进日志表。
RequestHash string
ResponseCode string
ResponseBodyHash string
Status string
CreatedAtMS int64
}
// RepairOrder 是三方补单请求的最小审计事实;首版可只落库不改账。
type RepairOrder struct {
AppCode string
RepairID string
PlatformCode string
// ProviderOrderID 唯一约束保证重复补单只产生一条审计事实。
ProviderOrderID string
// Reason 标记来源厂商和接口,后续补偿任务可以按 reason 选择不同策略。
Reason string
Status string
OperatorAdminID int64
Attempts int32
NextRunAtMS int64
LastErrorCode string
CreatedAtMS int64
UpdatedAtMS int64
}