Documentation
¶
Index ¶
- Constants
- Variables
- func GetAccountPrefix(methodID int32) string
- func GetAllLoginMethods() map[int32]LoginMethod
- func GetChannelList(appid string) (map[int32]ChannelInfo, bool)
- func GetChannelPushInfo(channleMaster string, channelID int32) (map[int32]PushAppInfo, bool)
- func GetEtcdPrefix() string
- func GetFullEtcdPrefix() string
- func GetGiftList() map[int32]GlobalGiftConfig
- func GetGlobalParameter() map[int32]GlobalParameterInfo
- func JsonConf2Struct(action string, key string, value string)
- func SafeCtrlQuery(ctrlFunc string, playercond SafeCtrlInput) bool
- func StartEtcd()
- func UpdateRoomAIMoney()
- func WriteRoomInfo2Etcd(roominfo interface{})
- type ActivityAdrewardCfg
- type ActivityAdrewardInfo
- type ActivityConfig
- type AdRoundConfig
- type AiCollectResult
- type BacktendInfo
- type ChannelInfo
- type ChannelInfoInf
- type CurrencyDog
- type CurrencyReflect
- type DatabaseInfo
- type DayTaskInfo
- type EtcdChildConfig
- type GameTableInfoDef
- type GlobalExchangeDef
- type GlobalGiftConfig
- type GlobalParameterInfo
- type GlobalPropConf
- type GlobalShareDef
- type GlobalVIP
- type IPDetailInfo
- type LoginMethod
- type LoginMethodIntf
- type Node2EtcdInfo
- type OpenLobbyCtrl
- type PlatBranchConfig
- type ProxyNodeInfo
- type PushAppInfo
- type RedisInfo
- type RoomInfoDef
- type SafeCtrlInput
Constants ¶
View Source
const ( GrayPathPrefix = "/GrayConfig/" PathPrefix = "/PlatGlobalConfig/" DBEtcdDir = "/DBConf/" RedisEtcdDir = "/RedisConf/" FrontendDir = "/Frontend/" //前台目录 MiddlePlatDir = "/MiddlePlat/" //中台目录 ServerEtcdDir = "/ServerList/" BalanceDir = "/BalanceServer/" ConnectDir = "/ConnectorServer/" APPEtcdDir = "/APPCfgList/" GlobalGiftDir = "/GlobalGift/" ChannelConfDir = "/ChannelList/" PushAppConfDir = "/PushAppList/" GlobalPropDir = "/GlobalPropConf/" GlobalVIPDir = "/GlobalVIP/" GlobalTableDir = "/GlobalTable/" //桌子的信息 ServerTableCfg AppLoginKeyDir = "/ThirdLoginKey/" AllPlatGlobalDir = "AllPlatGlobal/" BranchListDir = "BranchList" //产品线列表 GlobalExchangeDir = "/GlobalExchange/" GlobalActListDir = "/ActivityList/" //活动管理目录 GlobalSafeCtrl = "/PlatSafeCtrl/" FrontConnectDir = ServerEtcdDir + FrontendDir + ConnectDir MiddleConnectDir = ServerEtcdDir + MiddlePlatDir + BalanceDir )
全平台统一,应用层无需修改
View Source
const ( Ctrl_OpenLobby = "openlobby" Ctrl_GreenGame = "greengame" )
View Source
const (
CurrencyDogDir = "CurrencyDog"
)
Variables ¶
View Source
var ( // log conf LogFlag = log.LstdFlags // gate conf PendingWriteNum = 2000 MaxMsgLen uint32 = 10240 HTTPTimeout = 10 * time.Second KeepAliveTimeOut = 120 * time.Second LenMsgLen = 2 LittleEndian = false // skeleton conf GoLen = 10000 TimerDispatcherLen = 10000 AsynCallLen = 10000 ChanRPCLen = 10000 ConsolePort = 3657 // //标记是否为前台服务节点 FrontentNode = true //是否需要连接中台,需要用到中台公共服时为true MiddlePlatNeed = true //自定义控制DB访问,true CustomDBControl = false //需要基本配置 NeedBasicConfig = true //需要MQ生产 NeedMQPServer = false //消息使用多协程模式 MsgNeedGo = false )
View Source
var ( MapFrontConnServer map[string]ProxyNodeInfo MapMiddlePlatConnServer map[string]ProxyNodeInfo NewTCPAgent func(*network.TCPConn) network.Agent ChanRoomFlag chan bool ChanDataBase chan DatabaseInfo ChanRedisInfo chan RedisInfo ChanChildConf chan EtcdChildConfig GameRoomInfo map[int32]map[int32]GameTableInfoDef //游戏桌子信息配置 GlobalParameter map[int32]GlobalParameterInfo //全局参数表 GlobalExchange map[int32]GlobalExchangeDef )
View Source
var Server struct { NoCheckDependcies bool //是否强检测服务依赖 LogLevel string LogPath string BuringPointLogPath string LogSplitHour int32 WSAddr string CertFile string KeyFile string TCPAddr string RPCAddr string MaxConnNum int32 ConsolePort int32 ProfilePath string PropIdList []int32 SysClusterName string //本应用所属系统集群名称 ServerName string // IsGray int8 //是否灰度 NodeName string //gamename_gameid_roomlevel NodeID string //pcid_roomserialid CfgDir string CustomDBName []string //除平台公共库,自定义数据存储库名 MapDBName map[string]bool //除平台公共库,自定义数据存储库名 //平台库 DbList []DatabaseInfo //redis 列表 RedisList []RedisInfo //后台服务列表 BindServerList []BacktendInfo //etcd配置 EtcdAddr string EtcdKey []string EtcdAllPlatKey []string }
View Source
var Server2Etcd struct { // contains filtered or unexported fields }
Functions ¶
func GetAllLoginMethods ¶
func GetAllLoginMethods() map[int32]LoginMethod
func GetChannelList ¶
func GetChannelList(appid string) (map[int32]ChannelInfo, bool)
GetChannelList 获取短渠道列表
func GetChannelPushInfo ¶
func GetChannelPushInfo(channleMaster string, channelID int32) (map[int32]PushAppInfo, bool)
GetChannelPushInfo 获取指定渠道的应用推广信息
func GetGlobalParameter ¶
func GetGlobalParameter() map[int32]GlobalParameterInfo
func JsonConf2Struct ¶
func SafeCtrlQuery ¶
func SafeCtrlQuery(ctrlFunc string, playercond SafeCtrlInput) bool
SafeCtrlQuery ctrlFunc:openlobby 开启大厅
func UpdateRoomAIMoney ¶
func UpdateRoomAIMoney()
Types ¶
type ActivityAdrewardCfg ¶
type ActivityAdrewardCfg struct {
ID int32 `json:"id"` /*活动id */
Adid string `json:"adid"` /*广告id */
Channel []int32 `json:"channel"` /*渠道号 */
Adwards [][2]int32 `json:"prize"` /*奖励内容*/
Sourceid int32 `json:"sourceid"` /*来源ID*/
}
广告参数配置
func GetAdReward ¶
func GetAdReward(activityid int32, channel int32) ActivityAdrewardCfg
type ActivityAdrewardInfo ¶
type ActivityConfig ¶
type ActivityConfig struct {
ActivityID int32 //活动id
GameIDs []int32 //参与游戏
CreateTime int32 //创建时间
ActivityName string //活动描述
IsOpen int8 //是否开启
ShowLevel int32 //处理等级
SwitchType int32 //渠道控制类型 0 全开 1黑名单 2白名单
ChanelIDs []int32 //渠道
AskAllRound int32 //要求开放局数
AskRedPacket int32 //要求拆红包数
QuickLogins []int32 //快速登录强补渠道
TimeLimit int64 //限时 分
VipExpLimit [2]int32 //vip经验值限制区间
CoinLimit [3]int64 //积分限制区间
DayTimes int32 //日次数
DayReset int32 //是否重置
}
ActivityConfig 活动配置
func GetActivityControlCfg ¶
func GetActivityControlCfg(activityid int32) ActivityConfig
根据活动ID来获取全局活动管理表选项
type AdRoundConfig ¶
type AdRoundConfig struct {
RoundID int32 `json:"id"` //局数ID
AdID []int32 `json:"adid"` //广告ID
RegDays [2]int32 `json:"days"` //注册天数区间
}
局数广告配置
func GetAdRoundCfg ¶
func GetAdRoundCfg(roundid int32, datediff int32) AdRoundConfig
type AiCollectResult ¶
type AiCollectResult struct {
UserID int32 `json:"user_id"`
NickName string `json:"nick_name"`
HeadUrl string `json:"head_url"`
}
AI采集信息表
type BacktendInfo ¶
type ChannelInfo ¶
type ChannelInfo struct {
AppID string //
ChannelID int32 //
ChannelName string
GuideGameID int32 //新手引导进入游戏
AppPushID []int32 `json:"PushID"` //应用推广列表ID
UpLoadMethod string //数据上传方法 sigmob
}
func GetChannelInfo ¶
func GetChannelInfo(appid string, channelID int32) ChannelInfo
type ChannelInfoInf ¶
type CurrencyDog ¶
func GetCurrencyDog ¶
func GetCurrencyDog(propID int32) CurrencyDog
type CurrencyReflect ¶
type CurrencyReflect struct {
GameID int32 `json:"GameID"` //游戏ID 0暂时表示大厅
TableLevel int32 `json:"TableLevel"` //桌子等级
CurrencyTypeID int32 `json:"CurrencyTypeID"` //货币ID
PropID int32 `json:"PropID"` //道具ID
CurrencyDesc string `json:"CurrencyDesc"` //货币描述
}
货币映射表
func GetCurrencyReflectByID ¶
func GetCurrencyReflectByID(gameid int32, tablelevel int32, propid int32) CurrencyReflect
func GetCurrencyReflectByTable ¶
func GetCurrencyReflectByTable(gameid int32, tablelevel int32) []CurrencyReflect
type DatabaseInfo ¶
type DatabaseInfo struct {
MinUID int64 //分库用户ID起始
MaxUID int64 //分库用户ID截止
Host string
Port uint16
UserName string
Passwd string
DataBase string
DbType string // mysql,mssql等等
IsMaster int8 //1:master 0:slave
DbRWFlag string //write|read,readonly
}
DatabaseInfo 数据库部署采用M(应用主写)-M(应用主读)-S(后台读)模式
type DayTaskInfo ¶
type DayTaskInfo struct {
ID int32 `json:"ID"` //
Name string `json:"name"`
Desc string `json:"desc"` //描述
Questid [2]int32 `json:"questid"` //任务id和数量
Order int32 `json:"order"` //任务序列
Reward [2]int32 `json:"reward"` //奖励
RewardDesc string `json:"rewardDesc"` //奖励描述
SourceID int32 `json:"sourceid"` //来源ID
Days [2]int32 `json:"days"` //注册天数区间,在此区间内才可领取任务
}
日常任务表
func GetAllDayTask ¶
func GetAllDayTask() []DayTaskInfo
func GetDayTaskInfo ¶
func GetDayTaskInfo(taskid int32) DayTaskInfo
type EtcdChildConfig ¶
type GameTableInfoDef ¶
type GameTableInfoDef struct {
GameID int32
TableLevel int32
Name string
ServerLevel int32
LimitDown int64
LimitUp int64
KickoutCoin int64
TableFee int64
BasePoint int64
RoomWinLimimt int64
RewardCount string //纯显示用,没有什么作用
PersonalWinLimit int64
KickOutTurn int32
PropID int32 //对局货币ID
ConsumePropID int32 `json:"itemid"` //消耗体力ID
}
func GetGameTableInfo ¶
func GetGameTableInfo(gameid int32, tablelevel int32) GameTableInfoDef
type GlobalExchangeDef ¶
type GlobalExchangeDef struct {
ID int32 `json:"id"`
Name string `json:"name"`
Tag int32 `json:"tag"` //1 推荐,2红包
Index int32 `json:"index"` //值越小越前
Main int32 `json:"main"` //是否主推
Cost int32 `json:"cost"` //消费红包券
Yuan string `json:"yuan"` //消费金额
GiftID int32 `json:"gift"` //礼包id
SeeVip []int32 `json:"seeVIP"` //可见VIP
BuyVip []int32 `json:"buyVIP"` //可兑VIP
DayLimit []int32 `json:"dailyLimit"` //每日限购次数
AllLimit []int32 `json:"allLimit"` //终身限购次数
SourceID int32 `json:"sourceid"`
}
兑换信息
type GlobalGiftConfig ¶
type GlobalGiftConfig struct {
GiftID int32 //
PropList []msg.PropInfo
GiftName string
GiftDesc string
}
GlobalGiftConfig 全局礼包配置
type GlobalParameterInfo ¶
type GlobalParameterInfo struct {
ID int32 `json:"ID"`
Value interface{} `json:"Value"`
DescribeTxt string `json:"Desc"`
}
全局参数表
func GetGlobalParameterByID ¶
func GetGlobalParameterByID(id int32) (GlobalParameterInfo, bool)
type GlobalPropConf ¶
type GlobalShareDef ¶
type GlobalShareDef struct {
}
分享配置
func GetShareList ¶
func GetShareList(channelID int32) []GlobalShareDef
type GlobalVIP ¶
type GlobalVIP struct {
VipLevel int32 `json:"viplv"`
VipChargeExp int32 `json:"vipChargeEXP"`
VipExp int32 `json:"vipEXP"`
SourceID []int32 `json:"sourceid"`
VipDailyPack int32 `json:"vipDailyPack"`
VipPack int32 `json:"vipPack"`
VipLuckLimit int32 `json:"vipLuckLimit"`
VipLuckGlod int32 `json:"vipLuckGlod"`
VipRedpackPlus int32 `json:"vipRedpackPlus"`
VipNoAd int32 `json:"vipNoAd"`
VipQWin int32 `json:"vipQWin"`
VipKickProp int32 `json:"vipKickProp"`
VipHuLimit int32 `json:"vipHuLimit"`
}
type IPDetailInfo ¶
type LoginMethod ¶
type LoginMethod struct {
MethodID int32 //
LoginType int8 //0:快速登录 1:渠道登录 2:微信登录
ThirdAppID string //第三方appid
ThirdAppKey string //第三方秘钥
AccountPrefix string //账号生成前缀
ThirdAuthenClass string //第三方验证方法类名
BtnName string //支付按钮名
MethodDesc string //登录方式描述
}
func GetLoginMethod ¶
func GetLoginMethod(methodID int32) (LoginMethod, bool)
func GetThirdAppInfo ¶
func GetThirdAppInfo(loginType int8, appid string) LoginMethod
type LoginMethodIntf ¶
type Node2EtcdInfo ¶
type Node2EtcdInfo struct {
NodeName string //gamename_gameid_roomlevel
RouterName string //对外路由路径
NodeID string //pcid_roomserialid
WSAddr string
TCPAddr string
CertFile string
KeyFile string
MaxConnNum int32
CurOnlineNum int32
}
Node2EtcdInfo 写入etcd本身信息
type OpenLobbyCtrl ¶
type OpenLobbyCtrl struct {
LongChannel int64
ChannelID []int32
VisitLock []int32
AddrNameLock string
AddrNumLock []int32
NormalLock []int32
Hegui int32
}
OpenLobbyCtrl 大厅开启风控
func GetSafeCtrl ¶
func GetSafeCtrl(longchannel string) (OpenLobbyCtrl, bool)
type PlatBranchConfig ¶
type PlatBranchConfig struct {
ClusterID string `gorm:"column:branch_id;primary_key" json:"branch_id"`
CluterName string `gorm:"column:branch_name" json:"branch_name"`
}
var ClusterInfo PlatBranchConfig
func GetBranchInfo ¶
func GetBranchInfo(branchID string) PlatBranchConfig
type ProxyNodeInfo ¶
type ProxyNodeInfo struct {
NodeName string //gamename_gameid_roomlevel
NodeID string //pcid_roomserialid
LocalAddr string
RemoteAddr string
BindRoutes []string
CertFile string
KeyFile string
MaxConnNum int32
}
ProxyNodeInfo 代理服务器信息
type PushAppInfo ¶
type PushAppInfo struct {
PushID int32 //推广ID
OpenType int32 //打开方式
AppAddr string //应用地址
AppPackName string //应用包名
AppName string //应用名
UIResName string //UI显示资源名
AppID string //应用AppID(后台根据包名自动生成)
AppSecret string //应用秘钥(后台自动生成)
}
应用推广信息
type RoomInfoDef ¶
type RoomInfoDef struct {
NodeName string //gamename_gameid_roomlevel
NodeID string //pcid_roomserialid
GameID int32
RoomLevel int32
MaxTableNum int32 //最大桌子数
MaxOnlineNum int32 //最大在线人数
MaxTableChair int32 //一桌最多人数
RoomCoinDownLimit int64
RoomCoinUpLimit int64
GameStartPlayer int32 //满多少人开局
GameStartCheckTime int32 //检查开局间隔时长
SitNoHandUpCheckTime int32 //入座未举手检测时长
CanWatchGame int8 //是否可以旁观游戏
BasePoint int32
TaxRate int32 //千分比
TableTax int32 //固定桌费
ServerStatus int32
GameName string
ServerName string
PropIdList []int32
CurOnlineNum int32
InfoPath string //配置中心地址
AIWinOrLoseMoney int64 //AI本服务器的输赢情况
ConsumePropID int32 //游戏消耗道具ID
PropId int32 //游戏对局货币ID
IfAdPlay int32 //是否广告场
}
var RoomInfo RoomInfoDef
type SafeCtrlInput ¶
type SafeCtrlInput struct {
AcType int8 //账号类型 0:官方游客 1:sdk账号 2:微信账号 3:支付宝账号 4:QQ 5:手机
AcIsVisit bool //
UserID int64
RegDate int32
RegIP string
RegProvince string
RegCity string
RegChannelInfo string
RegChannelID int32
LgnChannelInfo string //
LgnChannelID int32
LgnIP string //登录IP
PlayGameTimes int32 //游戏局数
PlayTime int64 //游戏时长
GameID int32
ServerLevel int32
}
SafeCtrlInput 风控输入参数
Click to show internal directories.
Click to hide internal directories.