yumi-golang/internal/model/baishun_models.go
2026-04-28 18:05:13 +08:00

244 lines
27 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 model
import "time"
// SysGameListConfig 是系统游戏列表主表,描述平台可展示的游戏。
type SysGameListConfig struct {
ID int64 `gorm:"column:id;primaryKey"` // 主键
SysOrigin string `gorm:"column:sys_origin;size:32"` // 系统标识
GameOrigin string `gorm:"column:game_origin;size:32"` // 游戏来源
GameID string `gorm:"column:game_id;size:64"` // 内部游戏 ID
Name string `gorm:"column:name;size:128"` // 游戏名称
Category string `gorm:"column:category;size:64"` // 分类
GameCode string `gorm:"column:game_code;size:512"` // 游戏码或入口标识
Cover string `gorm:"column:cover;size:1024"` // 封面图
Amounts string `gorm:"column:amounts;size:512"` // 金额配置
Showcase bool `gorm:"column:is_showcase"` // 是否首页推荐
Sort int64 `gorm:"column:sort"` // 排序值
Height float64 `gorm:"column:height"` // 高度
Width float64 `gorm:"column:width"` // 宽度
FullScreen bool `gorm:"column:full_screen"` // 是否全屏展示
ClientOrigin string `gorm:"column:client_origin;size:32"` // 客户端来源
Regions string `gorm:"column:regions;size:255"` // 可投放地区
GameMode string `gorm:"column:game_mode;size:255"` // 游戏模式配置
}
// TableName 返回系统游戏列表表名。
func (SysGameListConfig) TableName() string { return "sys_game_list_config" }
// SysGameListVendorExt 保存某个厂商在系统游戏表上的扩展信息。
type SysGameListVendorExt struct {
ID int64 `gorm:"column:id;primaryKey"` // 主键
GameListConfigID int64 `gorm:"column:game_list_config_id;uniqueIndex:uk_game_vendor_ext_cfg_vendor,priority:1"` // 关联系统游戏配置 ID
SysOrigin string `gorm:"column:sys_origin;size:32;index:idx_game_vendor_ext_sys_vendor,priority:1;index:idx_game_vendor_ext_sys_profile_vendor,priority:1"` // 系统标识
Profile string `gorm:"column:profile;size:32;default:PROD;index:idx_game_vendor_ext_sys_profile_vendor,priority:2"` // 配置档案PROD/TEST
VendorType string `gorm:"column:vendor_type;size:32;uniqueIndex:uk_game_vendor_ext_cfg_vendor,priority:2;index:idx_game_vendor_ext_sys_vendor,priority:2;index:idx_game_vendor_ext_sys_profile_vendor,priority:3"` // 厂商类型
VendorGameID string `gorm:"column:vendor_game_id;size:64;index:idx_game_vendor_ext_sys_profile_vendor,priority:4"` // 厂商游戏 ID
LaunchMode string `gorm:"column:launch_mode;size:32"` // 启动模式
PackageVersion string `gorm:"column:package_version;size:32"` // 包版本号
PackageURL string `gorm:"column:package_url;size:1024"` // 包下载地址
PreviewURL string `gorm:"column:preview_url;size:1024"` // 预览地址
Orientation *int `gorm:"column:orientation"` // 屏幕方向
SafeHeight int `gorm:"column:safe_height"` // 安全区域高度
GSP string `gorm:"column:gsp;size:64"` // GSP 配置
BridgeSchemaVersion string `gorm:"column:bridge_schema_version;size:16"` // Bridge 协议版本
CurrencyType *int `gorm:"column:currency_type"` // 货币类型
CurrencyIcon string `gorm:"column:currency_icon;size:1024"` // 货币图标
ExtraJSON string `gorm:"column:extra_json;type:text"` // 额外扩展配置
Enabled bool `gorm:"column:enabled;index:idx_game_vendor_ext_sys_vendor,priority:3;index:idx_game_vendor_ext_sys_profile_vendor,priority:5"` // 是否启用
CreateTime time.Time `gorm:"column:create_time"` // 创建时间
UpdateTime time.Time `gorm:"column:update_time"` // 更新时间
}
// TableName 返回游戏厂商扩展表名。
func (SysGameListVendorExt) TableName() string { return "sys_game_list_vendor_ext" }
// BaishunProviderConfig 保存每个系统的百顺接入配置。
type BaishunProviderConfig struct {
ID int64 `gorm:"column:id;primaryKey"` // 主键
SysOrigin string `gorm:"column:sys_origin;size:32;uniqueIndex:uk_baishun_provider_sys_origin_profile,priority:1;index:idx_baishun_provider_active,priority:1"` // 系统标识
Profile string `gorm:"column:profile;size:32;default:PROD;uniqueIndex:uk_baishun_provider_sys_origin_profile,priority:2"` // 配置档案PROD/TEST
Active bool `gorm:"column:active;index:idx_baishun_provider_active,priority:2"` // 是否当前启用
PlatformBaseURL string `gorm:"column:platform_base_url;size:1024"` // 百顺平台基础地址
GameListURL string `gorm:"column:game_list_url;size:1024"` // 百顺游戏列表完整地址
LuckyGiftURL string `gorm:"column:lucky_gift_url;size:1024"` // 幸运礼物完整地址
AppID int64 `gorm:"column:app_id;index:idx_baishun_provider_app,priority:1"` // 百顺应用 ID
AppName string `gorm:"column:app_name;size:128"` // 百顺应用名
AppChannel string `gorm:"column:app_channel;size:64;index:idx_baishun_provider_app,priority:2"` // 百顺渠道
AppKey string `gorm:"column:app_key;size:255"` // 百顺密钥
GSP int `gorm:"column:gsp"` // 默认 GSP
LaunchCodeTTLSeconds int `gorm:"column:launch_code_ttl_seconds"` // 启动码过期秒数
SSTokenTTLSeconds int `gorm:"column:ss_token_ttl_seconds"` // ss_token 过期秒数
CreateTime time.Time `gorm:"column:create_time"` // 创建时间
UpdateTime time.Time `gorm:"column:update_time;index:idx_baishun_provider_active,priority:3"` // 更新时间
}
// TableName 返回百顺配置表名。
func (BaishunProviderConfig) TableName() string { return "baishun_provider_config" }
// BaishunGameCatalog 是百顺平台同步到本地的游戏目录。
type BaishunGameCatalog struct {
ID int64 `gorm:"column:id;primaryKey"` // 主键
SysOrigin string `gorm:"column:sys_origin;size:32;uniqueIndex:uk_baishun_catalog_sys_profile_vendor_game,priority:1;index:idx_baishun_catalog_profile_internal_game,priority:1"` // 系统标识
Profile string `gorm:"column:profile;size:32;default:PROD;uniqueIndex:uk_baishun_catalog_sys_profile_vendor_game,priority:2;index:idx_baishun_catalog_profile_internal_game,priority:2"` // 配置档案PROD/TEST
InternalGameID string `gorm:"column:internal_game_id;size:64;index:idx_baishun_catalog_profile_internal_game,priority:3"` // 内部游戏 ID
VendorGameID int `gorm:"column:vendor_game_id;uniqueIndex:uk_baishun_catalog_sys_profile_vendor_game,priority:3"` // 百顺游戏 ID
Name string `gorm:"column:name;size:128"` // 游戏名称
Cover string `gorm:"column:cover;size:1024"` // 封面图
PreviewURL string `gorm:"column:preview_url;size:1024"` // 预览地址
DownloadURL string `gorm:"column:download_url;size:1024"` // 下载地址
PackageVersion string `gorm:"column:package_version;size:32"` // 包版本
GameModeJSON string `gorm:"column:game_mode_json;size:64"` // 游戏模式原始 JSON
Orientation *int `gorm:"column:orientation"` // 屏幕方向
SafeHeight int `gorm:"column:safe_height"` // 安全区域高度
VenueLevelJSON string `gorm:"column:venue_level_json;size:64"` // 场馆等级 JSON
GSP string `gorm:"column:gsp;size:64"` // GSP 配置
RawJSON string `gorm:"column:raw_json;type:longtext"` // 原始目录数据
Status string `gorm:"column:status;size:32;index:idx_baishun_catalog_profile_internal_game,priority:4"` // 状态
CreateTime time.Time `gorm:"column:create_time"` // 创建时间
UpdateTime time.Time `gorm:"column:update_time"` // 更新时间
}
// TableName 返回百顺目录表名。
func (BaishunGameCatalog) TableName() string { return "baishun_game_catalog" }
// LingxianProviderConfig 保存每个系统的灵仙接入配置。
type LingxianProviderConfig struct {
ID int64 `gorm:"column:id;primaryKey"`
SysOrigin string `gorm:"column:sys_origin;size:32;uniqueIndex:uk_lingxian_provider_sys_origin_profile,priority:1;index:idx_lingxian_provider_active,priority:1"`
Profile string `gorm:"column:profile;size:32;default:PROD;uniqueIndex:uk_lingxian_provider_sys_origin_profile,priority:2"`
Active bool `gorm:"column:active;index:idx_lingxian_provider_active,priority:2"`
GameListURL string `gorm:"column:game_list_url;size:1024"`
AppKey string `gorm:"column:app_key;size:255"`
TestUID string `gorm:"column:test_uid;size:64"`
TestToken string `gorm:"column:test_token;size:1024"`
TestRoomID string `gorm:"column:test_room_id;size:64"`
CreateTime time.Time `gorm:"column:create_time"`
UpdateTime time.Time `gorm:"column:update_time;index:idx_lingxian_provider_active,priority:3"`
}
// TableName 返回灵仙配置表名。
func (LingxianProviderConfig) TableName() string { return "lingxian_provider_config" }
// LingxianGameCatalog 是灵仙平台同步到本地的游戏目录。
type LingxianGameCatalog struct {
ID int64 `gorm:"column:id;primaryKey"`
SysOrigin string `gorm:"column:sys_origin;size:32;uniqueIndex:uk_lingxian_catalog_sys_profile_vendor_game,priority:1;index:idx_lingxian_catalog_profile_internal_game,priority:1"`
Profile string `gorm:"column:profile;size:32;default:PROD;uniqueIndex:uk_lingxian_catalog_sys_profile_vendor_game,priority:2;index:idx_lingxian_catalog_profile_internal_game,priority:2"`
InternalGameID string `gorm:"column:internal_game_id;size:64;index:idx_lingxian_catalog_profile_internal_game,priority:3"`
VendorGameID string `gorm:"column:vendor_game_id;size:64;uniqueIndex:uk_lingxian_catalog_sys_profile_vendor_game,priority:3"`
Name string `gorm:"column:name;size:128"`
Cover string `gorm:"column:cover;size:1024"`
PreviewURL string `gorm:"column:preview_url;size:1024"`
DownloadURL string `gorm:"column:download_url;size:1024"`
PackageVersion string `gorm:"column:package_version;size:32"`
RawJSON string `gorm:"column:raw_json;type:longtext"`
Status string `gorm:"column:status;size:32;index:idx_lingxian_catalog_profile_internal_game,priority:4"`
CreateTime time.Time `gorm:"column:create_time"`
UpdateTime time.Time `gorm:"column:update_time"`
}
// TableName 返回灵仙目录表名。
func (LingxianGameCatalog) TableName() string { return "lingxian_game_catalog" }
// BaishunLaunchSession 保存一次房间内游戏启动会话。
type BaishunLaunchSession struct {
ID int64 `gorm:"column:id;primaryKey"` // 会话主键
SysOrigin string `gorm:"column:sys_origin;size:32;index:idx_baishun_session_room_user,priority:1"` // 系统标识
RoomID string `gorm:"column:room_id;size:64;index:idx_baishun_session_room_user,priority:2"` // 房间 ID
UserID int64 `gorm:"column:user_id;index:idx_baishun_session_room_user,priority:3"` // 发起用户 ID
InternalGameID string `gorm:"column:internal_game_id;size:64"` // 内部游戏 ID
VendorGameID int `gorm:"column:vendor_game_id"` // 厂商游戏 ID
GameSessionID string `gorm:"column:game_session_id;size:64;uniqueIndex:uk_baishun_game_session"` // 业务会话 ID
LaunchCode string `gorm:"column:launch_code;size:128;uniqueIndex:uk_baishun_launch_code"` // 首次启动 code
LaunchCodeExpireTime time.Time `gorm:"column:launch_code_expire_time"` // code 过期时间
SSToken *string `gorm:"column:ss_token;size:255;uniqueIndex:uk_baishun_ss_token"` // 百顺 ss_token
SSTokenExpireTime *time.Time `gorm:"column:ss_token_expire_time;index:idx_baishun_session_token_expire"` // token 过期时间
Language string `gorm:"column:language;size:16"` // 语言
GSP int `gorm:"column:gsp"` // GSP 值
CurrencyType int `gorm:"column:currency_type"` // 货币类型
CurrencyIcon string `gorm:"column:currency_icon;size:1024"` // 货币图标
SceneMode int `gorm:"column:scene_mode"` // 场景模式
GameMode int `gorm:"column:game_mode"` // 游戏模式
PackageVersion string `gorm:"column:package_version;size:32"` // 包版本
ClientIP string `gorm:"column:client_ip;size:64"` // 客户端 IP
ClientOrigin string `gorm:"column:client_origin;size:16"` // 客户端来源
Status string `gorm:"column:status;size:32;index:idx_baishun_session_room_user,priority:4"` // 会话状态
ClosedReason string `gorm:"column:closed_reason;size:64"` // 关闭原因
CreateTime time.Time `gorm:"column:create_time"` // 创建时间
UpdateTime time.Time `gorm:"column:update_time"` // 更新时间
}
// TableName 返回百顺启动会话表名。
func (BaishunLaunchSession) TableName() string { return "baishun_launch_session" }
// BaishunOrderIdempotency 记录百顺扣增币回调的幂等处理结果。
type BaishunOrderIdempotency struct {
ID int64 `gorm:"column:id;primaryKey"` // 主键
SysOrigin string `gorm:"column:sys_origin;size:32;uniqueIndex:uk_baishun_order,priority:1;index:idx_baishun_order_user_time,priority:1"` // 系统标识
OrderID string `gorm:"column:order_id;size:128;uniqueIndex:uk_baishun_order,priority:2"` // 订单 ID
GameRoundID string `gorm:"column:game_round_id;size:128;index:idx_baishun_round"` // 局号
RoomID string `gorm:"column:room_id;size:64"` // 房间 ID
UserID int64 `gorm:"column:user_id;index:idx_baishun_order_user_time,priority:2"` // 用户 ID
VendorGameID int `gorm:"column:vendor_game_id"` // 厂商游戏 ID
CurrencyDiff int64 `gorm:"column:currency_diff"` // 货币变化值
DiffMsg string `gorm:"column:diff_msg;size:32"` // 变化说明
MsgType string `gorm:"column:msg_type;size:64"` // 消息类型
CurrencyType *int `gorm:"column:currency_type"` // 货币类型
WalletEventID string `gorm:"column:wallet_event_id;size:160;uniqueIndex:uk_baishun_wallet_event"` // 钱包事件 ID
WalletAssetRecordID *int64 `gorm:"column:wallet_asset_record_id"` // 钱包资产记录 ID
Status string `gorm:"column:status;size:32"` // 处理状态
RequestJSON string `gorm:"column:request_json;type:longtext"` // 原始请求
ResponseJSON string `gorm:"column:response_json;type:longtext"` // 回包结果
CreateTime time.Time `gorm:"column:create_time;index:idx_baishun_order_user_time,priority:3"` // 创建时间
UpdateTime time.Time `gorm:"column:update_time"` // 更新时间
}
// TableName 返回百顺订单幂等表名。
func (BaishunOrderIdempotency) TableName() string { return "baishun_order_idempotency" }
// BaishunCallbackLog 保存百顺各类回调请求和响应,便于审计排查。
type BaishunCallbackLog struct {
ID int64 `gorm:"column:id;primaryKey"` // 日志主键
SysOrigin string `gorm:"column:sys_origin;size:32"` // 系统标识
RequestType string `gorm:"column:request_type;size:32;index:idx_baishun_log_type_time,priority:1"` // 回调类型
OrderID string `gorm:"column:order_id;size:128;index:idx_baishun_log_order"` // 订单 ID
GameRoundID string `gorm:"column:game_round_id;size:128"` // 局号
RoomID string `gorm:"column:room_id;size:64;index:idx_baishun_log_room_user,priority:1"` // 房间 ID
UserID *int64 `gorm:"column:user_id;index:idx_baishun_log_room_user,priority:2"` // 用户 ID
VendorGameID *int `gorm:"column:vendor_game_id"` // 厂商游戏 ID
RequestJSON string `gorm:"column:request_json;type:longtext"` // 请求报文
ResponseJSON string `gorm:"column:response_json;type:longtext"` // 响应报文
BizCode string `gorm:"column:biz_code;size:32"` // 业务状态码
BizMessage string `gorm:"column:biz_message;type:text"` // 业务描述
Status string `gorm:"column:status;size:32"` // 处理状态
CreateTime time.Time `gorm:"column:create_time;index:idx_baishun_log_type_time,priority:2"` // 创建时间
UpdateTime time.Time `gorm:"column:update_time"` // 更新时间
}
// TableName 返回百顺回调日志表名。
func (BaishunCallbackLog) TableName() string { return "baishun_callback_log" }
// BaishunRoomState 保存房间当前挂载的游戏状态。
type BaishunRoomState struct {
ID int64 `gorm:"column:id;primaryKey"` // 主键
SysOrigin string `gorm:"column:sys_origin;size:32;uniqueIndex:uk_baishun_room_state,priority:1"` // 系统标识
RoomID string `gorm:"column:room_id;size:64;uniqueIndex:uk_baishun_room_state,priority:2"` // 房间 ID
HostUserID int64 `gorm:"column:host_user_id"` // 房主用户 ID
CurrentGameID string `gorm:"column:current_game_id;size:64"` // 当前内部游戏 ID
CurrentVendorGameID *int `gorm:"column:current_vendor_game_id"` // 当前厂商游戏 ID
CurrentGameName string `gorm:"column:current_game_name;size:128"` // 当前游戏名
CurrentGameCover string `gorm:"column:current_game_cover;size:1024"` // 当前游戏封面
GameSessionID string `gorm:"column:game_session_id;size:64;index:idx_baishun_room_state_session"` // 当前会话 ID
LaunchUserID *int64 `gorm:"column:launch_user_id"` // 发起启动的用户 ID
State string `gorm:"column:state;size:32"` // 房间游戏状态
ExtraJSON string `gorm:"column:extra_json;type:text"` // 扩展信息
StartTime *time.Time `gorm:"column:start_time"` // 开始时间
EndTime *time.Time `gorm:"column:end_time"` // 结束时间
CreateTime time.Time `gorm:"column:create_time"` // 创建时间
UpdateTime time.Time `gorm:"column:update_time"` // 更新时间
}
// TableName 返回百顺房间状态表名。
func (BaishunRoomState) TableName() string { return "baishun_room_state" }