|
|
|
|
package common
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"time"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
RedisExpireLock = 10 * time.Second
|
|
|
|
|
RedisExpireToken = 7 * 24 * time.Hour
|
|
|
|
|
RedisExpireCode = 180 * time.Second
|
|
|
|
|
RedisExpireCodeCD = 60 * time.Second
|
|
|
|
|
RedisExpireMail = 3 * time.Second
|
|
|
|
|
RedisExpireControl = 30 * 24 * time.Hour
|
|
|
|
|
RedisExpireActivityRed = 1 * time.Minute // 红包雨活动,给予客户端1分钟去做领取
|
|
|
|
|
RedisExpireGameEnter = 12 * time.Hour // 进入游戏记录玩家币种的超时时间
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
RedisTimeoutTx = 10 * time.Second
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
RedisKeyUser = "user"
|
|
|
|
|
RedisKeyCode = "Code"
|
|
|
|
|
RedisKeyCodeCD = "CodeCD"
|
|
|
|
|
RedisKeyToken = "token"
|
|
|
|
|
RedisKeyPlayerStatus = "playerStatus" // 玩家当前游戏状态, 用于断线重连
|
|
|
|
|
RedisKeyRobotPlaying = "robotPlaying" // 已使用的机器人
|
|
|
|
|
RedisKeyGameFlow = "gameFlow" // 游戏流水总额统计,用于调控
|
|
|
|
|
// RedisKeyPlayerControl = "playerControl" // 玩家幸运值/愤怒值
|
|
|
|
|
RedisKeyWarn = "warn" // 后台预警
|
|
|
|
|
RedisKeyActivityRed = "activityRed" // 红包雨活动
|
|
|
|
|
RedisOnline = "online" // 实时在线
|
|
|
|
|
RedisWaterLevel = "waterLevel" // 水位
|
|
|
|
|
RedisKeyPayWeight = "payWeight" // 支付渠道权重
|
|
|
|
|
RedisKeyWitdhrawWeight = "withrawWeight" // 支付渠道权重
|
|
|
|
|
RedisKeyGamePlay = "gamePlay" // 各游戏玩家游戏局数
|
|
|
|
|
RedisKeyGameResult = "gameResult" // 记录牌局结果,重启时直接拉取恢复
|
|
|
|
|
RedisKeyGameWinner = "gameWinner" // 记录历史牌局大赢家
|
|
|
|
|
RedisKeyCollectCardLottery = "collectCardLottery" // 本次大奖开奖控制
|
|
|
|
|
RedisKeyCollectCardLotteryCards = "collectCardLotteryCards" // 本次大奖结果
|
|
|
|
|
RedisKeyPayStatus = "payStatus" // 支付渠道策略
|
|
|
|
|
RedisKeyRealMail = "realMail" // 给玩家发真实邮件控制
|
|
|
|
|
// RedisKeyPlayerPay = "playerPay" // 玩家10分钟内付费拉起的渠道记录
|
|
|
|
|
RedisKeyPlayerPayInterval = "playerPayInterval" // 玩家拉单间隔限制
|
|
|
|
|
RedisKeyGameCurrency = "gameCurrency" // 玩家进入游戏时选择的币种
|
|
|
|
|
RedisKeyPlayerRTP = "playerRtp"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
RedisLockKeyIP = "lockKeyIP" // 玩家操作频率限制
|
|
|
|
|
RedisLockKeyEnter = "lockKeyEnter" // 玩家进游戏锁
|
|
|
|
|
RedisLockKeyControl = "lockKeyControl" // 玩家更新控制参数锁
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func GetRedisKeyGameCurrency(uid int) string {
|
|
|
|
|
return fmt.Sprintf("%v:%v", RedisKeyGameCurrency, uid)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func GetRedisKeyPlayerPayInterval(uid int) string {
|
|
|
|
|
return fmt.Sprintf("%v:%v", RedisKeyPlayerPayInterval, uid)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// func GetRedisKeyPlayerPay(uid int) string {
|
|
|
|
|
// return fmt.Sprintf("%v:%v", RedisKeyPlayerPay, uid)
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// status 发邮件的模板,0是失败邮件,1是成功邮件
|
|
|
|
|
func GetRedisKeyRealMail(uid int, status int) string {
|
|
|
|
|
desc := "fail"
|
|
|
|
|
if status == 1 {
|
|
|
|
|
desc = "success"
|
|
|
|
|
}
|
|
|
|
|
return fmt.Sprintf("%v:%v:%v", RedisKeyRealMail, desc, uid)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func GetRedisKeyGameWinner(gid int) string {
|
|
|
|
|
return fmt.Sprintf("%v:%v", RedisKeyGameWinner, gid)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func GetRedisKeyGameResult(gid, rid int) string {
|
|
|
|
|
return fmt.Sprintf("%v:%v:%v", RedisKeyGameResult, gid, rid)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func GetRedisKeyWaterLevel(gid, rid int) string {
|
|
|
|
|
return fmt.Sprintf("%v:%v:%v", RedisWaterLevel, gid, rid)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func GetActivityRedKey(uid int) string {
|
|
|
|
|
return fmt.Sprintf("%v:%v", RedisKeyActivityRed, uid)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func GetRedisKeyOnlineKey(field string) string {
|
|
|
|
|
return fmt.Sprintf("%v:%v", RedisOnline, field)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func GetWarnKey(id int) string {
|
|
|
|
|
return fmt.Sprintf("%v:%v", RedisKeyWarn, id)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func GetRedisLockKeyControl(uid int) string {
|
|
|
|
|
return fmt.Sprintf("%v:%v", RedisLockKeyControl, uid)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func GetRedisLockKeyEnter(uid int) string {
|
|
|
|
|
return fmt.Sprintf("%v:%v", RedisLockKeyEnter, uid)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func GetRedisLockKeyIP(ip string) string {
|
|
|
|
|
return fmt.Sprintf("%v:%v", RedisLockKeyIP, ip)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// func GetRedisKeyPlayerControl(uid int) string {
|
|
|
|
|
// return fmt.Sprintf("%v:%v", RedisKeyPlayerControl, uid)
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
func GetRedisKeyRobotPlaying(rid int) string {
|
|
|
|
|
return fmt.Sprintf("%v:%v", RedisKeyRobotPlaying, rid)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func GetRedisKeyCode(content string) string {
|
|
|
|
|
return RedisKeyCode + ":" + content
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func GetRedisKeyCodeCD(content string) string {
|
|
|
|
|
return RedisKeyCodeCD + ":" + content
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func GetRedisKeyUser(uid int) string {
|
|
|
|
|
return fmt.Sprintf("%s:%d", RedisKeyUser, uid)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func GetRedisKeyToken(token string) string {
|
|
|
|
|
return RedisKeyToken + ":" + token
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func GetRedisKeyPlayerStatus(uid int) string {
|
|
|
|
|
return fmt.Sprintf("%v:%v", RedisKeyPlayerStatus, uid)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
EventTrackDataVersion = "EventTrackDataVersion" // 打点数据version存入redis的key hash
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// ==============================================================配置文件
|
|
|
|
|
const (
|
|
|
|
|
RedisKeyConfigRoom = "config:Room"
|
|
|
|
|
RedisKeyConfigMillionRobotBet = "config:MillionRobotBet"
|
|
|
|
|
RedisKeyConfigRoomChat = "config:RoomChat"
|
|
|
|
|
RedisKeyConfigRecharge = "config:Recharge"
|
|
|
|
|
RedisKeyConfigRobotConfig = "config:RobotConfig"
|
|
|
|
|
RedisKeyConfigRobotPlayConfig = "config:RobotPlayConfig"
|
|
|
|
|
RedisKeyConfigTPRobotOperate = "config:TPRobotOperate"
|
|
|
|
|
RedisKeyConfigRobotTeenpatti = "config:RobotTeenpatti"
|
|
|
|
|
RedisKeyConfigRobotAKTeenpatti = "config:RobotAKTeenpatti"
|
|
|
|
|
RedisKeyConfigRobotJTeenpatti = "config:RobotJTeenpatti"
|
|
|
|
|
RedisKeyConfigWithdrawAmount = "config:WithdrawAmount"
|
|
|
|
|
RedisKeyConfigWithdrawCondition = "config:WithdrawCondition"
|
|
|
|
|
RedisKeyConfigActivityConfig = "config:ActivityConfig"
|
|
|
|
|
RedisKeyConfigReportActivityConfig = "config:ReportActivityConfig"
|
|
|
|
|
RedisKeyConfigRecharge1ActivityConfig = "config:Recharge1ActivityConfig"
|
|
|
|
|
RedisKeyConfigGoodsConfig = "config:GoodsConfig"
|
|
|
|
|
RedisKeyConfigMatchingTableConfig = "config:MatchingTableConfig"
|
|
|
|
|
RedisKeyConfigNoticeConfig = "config:NoticeConfig"
|
|
|
|
|
RedisKeyConfigBroadcastConfig = "config:BroadcastConfig"
|
|
|
|
|
RedisKeyConfigHelpConfig = "config:HelpConfig"
|
|
|
|
|
RedisKeyConfigDramaAction = "config:DramaAction"
|
|
|
|
|
RedisKeyConfigDramaDeal = "config:DramaDeal"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func GetRedisKeyTPRobotOperateConfig(gameID, roomID int) string {
|
|
|
|
|
return fmt.Sprintf("%v:%v:%v", RedisKeyConfigTPRobotOperate, gameID, roomID)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ==============================================================后台
|
|
|
|
|
const (
|
|
|
|
|
BackendToken = "backendToken"
|
|
|
|
|
BackendReview = "backendReview"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func GetBackendTokenKey(token string) string {
|
|
|
|
|
return BackendToken + ":" + token
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func GetBackendReviewKey(date string, channel *int) string {
|
|
|
|
|
ret := fmt.Sprintf("%v:%v", BackendReview, date)
|
|
|
|
|
if channel != nil {
|
|
|
|
|
ret += fmt.Sprintf(":%v", *channel)
|
|
|
|
|
}
|
|
|
|
|
return ret
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func GetRedisKeyPlayerRtp(uid int) string {
|
|
|
|
|
return fmt.Sprintf("%v:%v", RedisKeyPlayerRTP, uid)
|
|
|
|
|
}
|