conf

package
v0.0.0-...-cd1bf01 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

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/"
	GlobalShareDir    = "/GlobalShare/"  //分享参数目录
	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 GetAccountPrefix

func GetAccountPrefix(methodID int32) string

GetAccountPrefix 保证前缀为3个字母

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 GetEtcdPrefix

func GetEtcdPrefix() string

GetEtcdPrefix 相对集群根目录的子前缀

func GetFullEtcdPrefix

func GetFullEtcdPrefix() string

GetEtcdPrefix 获取本系统配置全路径前缀

func GetGiftList

func GetGiftList() map[int32]GlobalGiftConfig

GetGiftList 获取礼包列表

func GetGlobalParameter

func GetGlobalParameter() map[int32]GlobalParameterInfo

func JsonConf2Struct

func JsonConf2Struct(action string, key string, value string)

func SafeCtrlQuery

func SafeCtrlQuery(ctrlFunc string, playercond SafeCtrlInput) bool

SafeCtrlQuery ctrlFunc:openlobby 开启大厅

func StartEtcd

func StartEtcd()

func UpdateRoomAIMoney

func UpdateRoomAIMoney()

func WriteRoomInfo2Etcd

func WriteRoomInfo2Etcd(roominfo interface{})

创建静态节点信息,致后台管理

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 ActivityAdrewardInfo struct {
	ID       int32       `json:"id"`       /*活动id */
	Adid     interface{} `json:"adid"`     /*广告id */
	Channel  []int32     `json:"channel"`  /*渠道号 */
	Adwards  [][2]int32  `json:"prize"`    /*奖励内容*/
	Sourceid int32       `json:"sourceid"` /*来源ID*/
}

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采集信息表

func GetAiCollectInfo

func GetAiCollectInfo() []AiCollectResult

GetVipList 获取vip列表

type BacktendInfo

type BacktendInfo struct {
	ServerName string //
	ServerAddr string //
}

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 ChannelInfoInf struct {
	AppID        interface{} //
	ChannelID    int32       //
	ChannelName  string
	GuideGameID  int32   //新手引导进入游戏
	AppPushID    []int32 `json:"PushID"` //应用推广列表ID
	UpLoadMethod string  //数据上传方法 sigmob
}

type CurrencyDog

type CurrencyDog struct {
	PropID      int32    //货币ID
	DangerValue int32    //危险值
	RecvPeoples []string //接收人
}

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 EtcdChildConfig struct {
	Action string
	Key    string
	Value  string
}

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 全局礼包配置

func GetGiftInfo

func GetGiftInfo(giftID int32) (GlobalGiftConfig, bool)

GetGiftInfo 获取礼包信息

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 GlobalPropConf struct {
	PropID     int32  `json:"id"` //
	PropName   string `json:"name"`
	BigIcon    string `json:"iconb"`
	SamllIcon  string `json:"icons"`
	NameID     string `json:"nameid"`
	PropDesc   string `json:"descid"`
	CanTimeOut int8   `json:"cantimeout"` //是否可以过期
	DateDiff   int8   `json:"datediff"`   //是否跨天
}

func GetPropConf

func GetPropConf(propID int32) (GlobalPropConf, bool)

GetPropConf 获取道具信息

type GlobalShareDef

type GlobalShareDef struct {
	ShareID      int32  //分享ID即活动ID
	ShareType    int32  //分享类型
	ShareURL     string //分享地址
	ShareGift    int32  //分享礼包
	URLLiftTime  int32  //分享生命周期
	ValidUsers   int32  //链接有效人数 -1:不限制
	TimesPerUser int32  //人均有效次数 -1:不限制
	ShareDesc    string //分享描述
}

分享配置

func GetShareInfo

func GetShareInfo(shareID int32) GlobalShareDef

GetShareInfo 读取相应shareID的分享内容

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"`
}

func GetVipLevel

func GetVipLevel(vipExp int32) GlobalVIP

GetVipLevel 根据用户vip经验获取相关vip信息GlobalVIP

func GetVipList

func GetVipList() []GlobalVIP

GetVipList 获取vip列表

type IPDetailInfo

type IPDetailInfo struct {
	Province string
	City     string
}

func GetIPDetail

func GetIPDetail(ipaddress string) IPDetailInfo

GetIPDetail 根据IP获取IP详细信息

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 LoginMethodIntf struct {
	MethodID         int32       //
	LoginType        int8        //0:快速登录 1:渠道登录 2:微信登录
	ThirdAppID       interface{} //第三方appid
	ThirdAppKey      string      //第三方秘钥
	AccountPrefix    string      //账号生成前缀
	ThirdAuthenClass string      //第三方验证方法类名
	BtnName          string      //支付按钮名
	MethodDesc       string      //登录方式描述
}

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 //应用秘钥(后台自动生成)
}

应用推广信息

func GetPushAppInfo

func GetPushAppInfo(pushID int32) PushAppInfo

GetPushAppInfo 读取相应PushID的内容

type RedisInfo

type RedisInfo struct {
	Addr      string
	Passwd    string
	Slot      int32
	RedisName string
	MinUID    int64 //分库用户ID起始
	MaxUID    int64 //分库用户ID截止
}

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 风控输入参数

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL