Compare commits

..

No commits in common. "5e0b6139f9a55c5dc1324ef34a6ed94c9f95d325" and "e1812b5ecf860e6dc9f7adcceb6b106ff8ed5f7f" have entirely different histories.

15 changed files with 549 additions and 686 deletions

View File

@ -1632,8 +1632,6 @@ func (this *Scene) NewBigCoinNotice(player *Player, num int64, msgType int64) {
type GameDetailedParam struct { type GameDetailedParam struct {
Trend20Lately string //最近20局开奖结果 Trend20Lately string //最近20局开奖结果
CtrlType int
PlayerPool map[int]int
} }
// 保存详细游戏日志 // 保存详细游戏日志
@ -1653,8 +1651,7 @@ func (this *Scene) SaveGameDetailedLog(logid string, gamedetailednote string, ga
log := model.NewGameDetailedLogEx(logid, int32(this.GameId), int32(this.SceneId), log := model.NewGameDetailedLogEx(logid, int32(this.GameId), int32(this.SceneId),
this.DbGameFree.GetGameMode(), this.DbGameFree.Id, int32(len(this.Players)), this.DbGameFree.GetGameMode(), this.DbGameFree.Id, int32(len(this.Players)),
int32(time.Now().Unix()-this.GameNowTime.Unix()), baseScore, int32(time.Now().Unix()-this.GameNowTime.Unix()), baseScore,
gamedetailednote, p.Platform, this.ClubId, this.RoomId, this.CpCtx, GameDetailedVer[this.GameId], trend20Lately, gamedetailednote, p.Platform, this.ClubId, this.RoomId, this.CpCtx, GameDetailedVer[this.GameId], trend20Lately)
gameDetailedParam.CtrlType, gameDetailedParam.PlayerPool)
if log != nil { if log != nil {
if this.IsMatchScene() { if this.IsMatchScene() {
log.MatchId = this.MatchId log.MatchId = this.MatchId
@ -1667,8 +1664,7 @@ func (this *Scene) SaveGameDetailedLog(logid string, gamedetailednote string, ga
log := model.NewGameDetailedLogEx(logid, int32(this.GameId), int32(this.SceneId), log := model.NewGameDetailedLogEx(logid, int32(this.GameId), int32(this.SceneId),
this.DbGameFree.GetGameMode(), this.DbGameFree.Id, int32(len(this.Players)), this.DbGameFree.GetGameMode(), this.DbGameFree.Id, int32(len(this.Players)),
int32(time.Now().Unix()-this.GameNowTime.Unix()), baseScore, int32(time.Now().Unix()-this.GameNowTime.Unix()), baseScore,
gamedetailednote, this.Platform, this.ClubId, this.RoomId, this.CpCtx, GameDetailedVer[this.GameId], trend20Lately, gamedetailednote, this.Platform, this.ClubId, this.RoomId, this.CpCtx, GameDetailedVer[this.GameId], trend20Lately)
gameDetailedParam.CtrlType, gameDetailedParam.PlayerPool)
if log != nil { if log != nil {
if this.IsMatchScene() { if this.IsMatchScene() {
log.MatchId = this.MatchId log.MatchId = this.MatchId

View File

@ -29,7 +29,6 @@ type TienLenPlayerData struct {
curHandLimitTimeOut time.Duration // 出牌时间上限 curHandLimitTimeOut time.Duration // 出牌时间上限
isNotOverLastHand bool //手牌不能压过上家出牌标志 isNotOverLastHand bool //手牌不能压过上家出牌标志
cardScore int // 手牌评分 cardScore int // 手牌评分
playerPool int // 个人水池分
} }
func (this *TienLenPlayerData) init() { func (this *TienLenPlayerData) init() {
@ -50,7 +49,6 @@ func (this *TienLenPlayerData) init() {
this.curHandLimitTimeOut = rule.TienLenPlayerOpTimeout this.curHandLimitTimeOut = rule.TienLenPlayerOpTimeout
this.isNotOverLastHand = false this.isNotOverLastHand = false
this.cardScore = 0 this.cardScore = 0
this.playerPool = 0
} }
func (this *TienLenPlayerData) Clear() { func (this *TienLenPlayerData) Clear() {
@ -69,7 +67,6 @@ func (this *TienLenPlayerData) Clear() {
this.ThinkLongCnt = 0 this.ThinkLongCnt = 0
this.curHandLimitTimeOut = rule.TienLenPlayerOpTimeout this.curHandLimitTimeOut = rule.TienLenPlayerOpTimeout
this.isNotOverLastHand = false this.isNotOverLastHand = false
this.playerPool = 0
this.MarkFlag(base.PlayerState_WaitNext) this.MarkFlag(base.PlayerState_WaitNext)
this.TestLog = this.TestLog[:0] this.TestLog = this.TestLog[:0]

View File

@ -55,7 +55,6 @@ type TienLenSceneData struct {
cHintCards []int32 //客户端提示出牌记录 cHintCards []int32 //客户端提示出牌记录
isCardsKu bool //是否是牌库 isCardsKu bool //是否是牌库
cardsKuId int32 //牌库ID cardsKuId int32 //牌库ID
ctrlType int // 1控赢 2控输 0不控
} }
func NewTienLenSceneData(s *base.Scene) *TienLenSceneData { func NewTienLenSceneData(s *base.Scene) *TienLenSceneData {
@ -86,7 +85,6 @@ func (this *TienLenSceneData) init() bool {
this.card_play_action_seq_int32 = [][]int32{} this.card_play_action_seq_int32 = [][]int32{}
this.bombToEnd = 0 this.bombToEnd = 0
this.allPlayerCards = [][]int32{} this.allPlayerCards = [][]int32{}
this.ctrlType = 0
this.recordId, _ = model.AutoIncGameLogId() this.recordId, _ = model.AutoIncGameLogId()
if this.GetPlayerNum() == 0 { if this.GetPlayerNum() == 0 {
this.SetPlayerNum(rule.MaxNumOfPlayer) this.SetPlayerNum(rule.MaxNumOfPlayer)
@ -116,7 +114,6 @@ func (this *TienLenSceneData) Clear() {
this.isAllRob = false this.isAllRob = false
this.robotGamingNum = 0 this.robotGamingNum = 0
this.allPlayerCards = [][]int32{} this.allPlayerCards = [][]int32{}
this.ctrlType = 0
this.recordId, _ = model.AutoIncGameLogId() this.recordId, _ = model.AutoIncGameLogId()
for _, player := range this.players { for _, player := range this.players {
if player != nil { if player != nil {
@ -1056,7 +1053,6 @@ func (this *TienLenSceneData) SendHandCardOdds() {
robotPlayers = append(robotPlayers, seat) robotPlayers = append(robotPlayers, seat)
} else { } else {
seat.odds = this.GetPlayerOdds(seat.Player, this.GameId, this.robotGamingNum > 0) seat.odds = this.GetPlayerOdds(seat.Player, this.GameId, this.robotGamingNum > 0)
seat.playerPool = int(this.PlayerPoolOdds(seat.Player))
if seat.odds > 0 { if seat.odds > 0 {
realPlayersGood = append(realPlayersGood, seat) realPlayersGood = append(realPlayersGood, seat)
G += seat.odds G += seat.odds
@ -1237,7 +1233,6 @@ func (this *TienLenSceneData) SendHandCardOdds() {
logger.Logger.Tracef("TienLen SendHandCardOdds Good:%v G:%v Bad:%v B:%v", isGood, G, isBad, B) logger.Logger.Tracef("TienLen SendHandCardOdds Good:%v G:%v Bad:%v B:%v", isGood, G, isBad, B)
if isBad && !isTestPoker && len(robotPlayers) > 0 && !noviceCtrl && !noviceTianHu { if isBad && !isTestPoker && len(robotPlayers) > 0 && !noviceCtrl && !noviceTianHu {
this.ctrlType = 2
gf := base.ConfigMgrInst.GetConfig(this.Platform).GameConfig gf := base.ConfigMgrInst.GetConfig(this.Platform).GameConfig
items := []int32{gf.GetTianHu(), gf.GetPaiKu(), gf.GetFenCha()} items := []int32{gf.GetTianHu(), gf.GetPaiKu(), gf.GetFenCha()}
score := this.RandInt(int(gf.GetTianHu() + gf.GetPaiKu() + gf.GetFenCha())) score := this.RandInt(int(gf.GetTianHu() + gf.GetPaiKu() + gf.GetFenCha()))
@ -1500,8 +1495,7 @@ func (this *TienLenSceneData) SendHandCardOdds() {
} }
if !isBad && !isTestPoker && !noviceCtrl && !noviceTianHu { // 天胡调控没有生效 if !isBad && !isTestPoker && !noviceCtrl && !noviceTianHu { // 天胡调控没有生效
if isGood { if isGood || isBad {
this.ctrlType = 1
// 牌平分,按从大到小排序 // 牌平分,按从大到小排序
// 使用分差配置,最好牌和最差牌的牌型分差大于分差配置 // 使用分差配置,最好牌和最差牌的牌型分差大于分差配置
for i := 0; i < 20; i++ { // 尝试20次如果还不能满足分差配置则直接发牌 for i := 0; i < 20; i++ { // 尝试20次如果还不能满足分差配置则直接发牌

View File

@ -1606,13 +1606,6 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
BaseScore: s.GetBaseScore(), BaseScore: s.GetBaseScore(),
TaxRate: s.DbGameFree.GetTaxRate(), TaxRate: s.DbGameFree.GetTaxRate(),
RoomMode: s.GetSceneMode(), RoomMode: s.GetSceneMode(),
PlayerPool: make(map[int]int),
}
for _, v := range sceneEx.seats {
if v == nil || !v.IsGameing() {
continue
}
tienlenType.PlayerPool[int(v.SnId)] = v.playerPool
} }
nGamingPlayerCount := sceneEx.GetGameingPlayerCnt() nGamingPlayerCount := sceneEx.GetGameingPlayerCnt()
@ -2506,11 +2499,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
} }
if isSave { if isSave {
// 牌局记录 // 牌局记录
sceneEx.SaveGameDetailedLog(sceneEx.recordId, info, &base.GameDetailedParam{ sceneEx.SaveGameDetailedLog(sceneEx.recordId, info, &base.GameDetailedParam{})
Trend20Lately: "",
CtrlType: sceneEx.ctrlType,
PlayerPool: tienlenType.PlayerPool,
})
} }
} }

View File

@ -55,8 +55,6 @@ type GameDetailedLog struct {
Time time.Time //记录时间 Time time.Time //记录时间
Trend20Lately string //最近游戏走势 Trend20Lately string //最近游戏走势
Ts int64 //时间戳 Ts int64 //时间戳
CtrlType int // 1控赢 2控输 0不控
PlayerPool map[int]int // 个人水池分
} }
func NewGameDetailedLog() *GameDetailedLog { func NewGameDetailedLog() *GameDetailedLog {
@ -65,7 +63,7 @@ func NewGameDetailedLog() *GameDetailedLog {
} }
func NewGameDetailedLogEx(logid string, gameid, sceneid, gamemode, gamefreeid, playercount, gametiming, gamebasebet int32, func NewGameDetailedLogEx(logid string, gameid, sceneid, gamemode, gamefreeid, playercount, gametiming, gamebasebet int32,
gamedetailednote string, platform string, clubId int32, clubRoom string, cpCtx CoinPoolCtx, ver int32, trend20Lately string, ctrlType int, playerPool map[int]int) *GameDetailedLog { gamedetailednote string, platform string, clubId int32, clubRoom string, cpCtx CoinPoolCtx, ver int32, trend20Lately string) *GameDetailedLog {
cl := NewGameDetailedLog() cl := NewGameDetailedLog()
cl.LogId = logid cl.LogId = logid
cl.GameId = gameid cl.GameId = gameid
@ -85,8 +83,6 @@ func NewGameDetailedLogEx(logid string, gameid, sceneid, gamemode, gamefreeid, p
cl.GameDetailVer = ver cl.GameDetailVer = ver
cl.Trend20Lately = trend20Lately cl.Trend20Lately = trend20Lately
cl.Ts = time.Now().Unix() cl.Ts = time.Now().Unix()
cl.CtrlType = ctrlType
cl.PlayerPool = playerPool
return cl return cl
} }

View File

@ -1521,8 +1521,6 @@ type TienLenType struct {
TaxRate int32 //税率(万分比) TaxRate int32 //税率(万分比)
PlayerData []TienLenPerson //玩家信息 PlayerData []TienLenPerson //玩家信息
RoomMode int RoomMode int
CtrlType int `json:"-"` // 1控赢 2控输 0不控
PlayerPool map[int]int `json:"-"`
} }
type TienLenAddItem struct { type TienLenAddItem struct {

View File

@ -88,7 +88,6 @@ type GameParam struct {
TestActSwitch bool // 开启所有活动开关 TestActSwitch bool // 开启所有活动开关
RankPlayerLevelMaxNum int //等级榜最大人数 RankPlayerLevelMaxNum int //等级榜最大人数
CloseChannelSwitch bool //关闭渠道开关功能 CloseChannelSwitch bool //关闭渠道开关功能
BackendTimeLocal int //后台时区
} }
var GameParamPath = "../data/gameparam.json" var GameParamPath = "../data/gameparam.json"
@ -239,7 +238,4 @@ func InitGameParam() {
if GameParamData.RankPlayerLevelMaxNum == 0 { if GameParamData.RankPlayerLevelMaxNum == 0 {
GameParamData.RankPlayerLevelMaxNum = 100 GameParamData.RankPlayerLevelMaxNum = 100
} }
if GameParamData.BackendTimeLocal == 0 {
GameParamData.BackendTimeLocal = 8
}
} }

View File

@ -74,11 +74,10 @@ type Message struct {
Params []int32 //额外参数 Params []int32 //额外参数
Platform string //平台信息 Platform string //平台信息
ShowId int64 //区分主子游戏大厅 ShowId int64 //区分主子游戏大厅
Channel []string //渠道
} }
func NewMessage(pid string, srcId int32, srcName string, snid, mType int32, title, content string, coin, diamond int64, func NewMessage(pid string, srcId int32, srcName string, snid, mType int32, title, content string, coin, diamond int64,
state int32, addTime int64, attachState int32, giftId string, params []int32, platform string, showId int64, channel []string) *Message { state int32, addTime int64, attachState int32, giftId string, params []int32, platform string, showId int64) *Message {
if srcName == "" { if srcName == "" {
srcName = "{\"zh\":\"系统\",\"vi\":\"GM\",\"en\":\"GM\",\"kh\":\"GM\"}" srcName = "{\"zh\":\"系统\",\"vi\":\"GM\",\"en\":\"GM\",\"kh\":\"GM\"}"
} }
@ -100,7 +99,6 @@ func NewMessage(pid string, srcId int32, srcName string, snid, mType int32, titl
Platform: platform, Platform: platform,
Diamond: diamond, Diamond: diamond,
ShowId: showId, ShowId: showId,
Channel: channel,
} }
if msg.Pid == "" { if msg.Pid == "" {
msg.Pid = msg.Id.Hex() msg.Pid = msg.Id.Hex()

File diff suppressed because it is too large Load Diff

View File

@ -468,7 +468,6 @@ message ASCreateShortMessage{
int64 Diamond = 8; int64 Diamond = 8;
int64 ShowId = 9; int64 ShowId = 9;
repeated int32 Params = 10; repeated int32 Params = 10;
repeated string OnChannelName = 11;
} }
message SACreateShortMessage{ message SACreateShortMessage{
TagCode Tag = 1; // TagCode Tag = 1; //
@ -914,8 +913,6 @@ message ASAddItemById{
int32 Snid = 1; // id int32 Snid = 1; // id
string Platform = 2; // id string Platform = 2; // id
repeated ItemInfo ItemInfo = 3;// repeated ItemInfo ItemInfo = 3;//
int32 TypeId = 4; //
string Remark = 5; //
} }
message SAAddItemById{ message SAAddItemById{

View File

@ -86,7 +86,7 @@ func (this *CSInviteCodePlayerHandler) Process(s *netlib.Session, packetid int,
//发送邮件 //发送邮件
var otherParams []int32 var otherParams []int32
newMsg := model.NewMessage("", p.SnId, "", p.SnId, model.MSGTYPE_INVITECODE, p.Name, inviteCode, coin, 0, newMsg := model.NewMessage("", p.SnId, "", p.SnId, model.MSGTYPE_INVITECODE, p.Name, inviteCode, coin, 0,
model.MSGSTATE_UNREAD, time.Now().Unix(), 0, "", otherParams, p.Platform, model.HallAll, nil) model.MSGSTATE_UNREAD, time.Now().Unix(), 0, "", otherParams, p.Platform, model.HallAll)
err = model.InsertMessage(p.Platform, newMsg) err = model.InsertMessage(p.Platform, newMsg)
if err == nil { if err == nil {

View File

@ -561,21 +561,22 @@ func (this *Player) SendGameConfig(gameId int32, plf, chl string) {
} }
func (this *Player) LoadMessage(lastLogoutTime int64, isFirstLogin, isSkipWeek bool) { func (this *Player) LoadMessage(lastLogoutTime int64, isFirstLogin, isSkipWeek bool) {
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { task.New(nil,
//msgs, err := model.GetMessageByNotState(this.SnId, model.MSGSTATE_REMOVEED) task.CallableWrapper(func(o *basic.Object) interface{} {
//if err == nil { //msgs, err := model.GetMessageByNotState(this.SnId, model.MSGSTATE_REMOVEED)
// return msgs //if err == nil {
//} else { // return msgs
// logger.Logger.Warnf("[%v] LoadMessage err:%v", this.Name, err) //} else {
//} // logger.Logger.Warnf("[%v] LoadMessage err:%v", this.Name, err)
msgs, err := model.GetMessage(this.Platform, this.SnId) // model.GetNotDelMessage(this.Platform, this.SnId) //}
if err == nil { msgs, err := model.GetMessage(this.Platform, this.SnId) // model.GetNotDelMessage(this.Platform, this.SnId)
return msgs if err == nil {
} else { return msgs
logger.Logger.Warnf("[%v] LoadMessage err:%v", this.Name, err) } else {
} logger.Logger.Warnf("[%v] LoadMessage err:%v", this.Name, err)
return nil }
}), return nil
}),
task.CompleteNotifyWrapper(func(data interface{}, tt task.Task) { task.CompleteNotifyWrapper(func(data interface{}, tt task.Task) {
if data != nil { if data != nil {
if msgs, ok := data.([]model.Message); ok { if msgs, ok := data.([]model.Message); ok {
@ -611,7 +612,7 @@ func (this *Player) LoadMessage(lastLogoutTime int64, isFirstLogin, isSkipWeek b
if bHasAddToPlayer == false { if bHasAddToPlayer == false {
newMsg := model.NewMessage(msg.Id.Hex(), msg.SrcId, "", this.SnId, msg.MType, msg.Title, newMsg := model.NewMessage(msg.Id.Hex(), msg.SrcId, "", this.SnId, msg.MType, msg.Title,
msg.Content, msg.Coin, msg.Diamond, model.MSGSTATE_UNREAD, msg.CreatTs, msg.AttachState, msg.Content, msg.Coin, msg.Diamond, model.MSGSTATE_UNREAD, msg.CreatTs, msg.AttachState,
msg.GiftId, msg.Params, msg.Platform, msg.ShowId, msg.Channel) msg.GiftId, msg.Params, msg.Platform, msg.ShowId)
dbMsgs = append(dbMsgs, newMsg) dbMsgs = append(dbMsgs, newMsg)
} }
} }
@ -660,9 +661,6 @@ func (this *Player) SendMessage(showId int64) {
for _, msg := range this.msgs { for _, msg := range this.msgs {
if msg.State != model.MSGSTATE_REMOVEED && (msg.ShowId == model.HallAll || msg.ShowId&showId != 0) { if msg.State != model.MSGSTATE_REMOVEED && (msg.ShowId == model.HallAll || msg.ShowId&showId != 0) {
if len(msg.Channel) > 0 && !common.InSliceString(msg.Channel, this.LastChannel) {
continue
}
giftState := int32(0) giftState := int32(0)
//if len(msg.GiftId) > 0 { //if len(msg.GiftId) > 0 {
@ -848,10 +846,6 @@ func (this *Player) AddMessage(msg *model.Message) {
return return
} }
if len(msg.Channel) > 0 && !common.InSliceString(msg.Channel, this.LastChannel) {
return
}
if _, exist := this.msgs[msg.Id.Hex()]; !exist { if _, exist := this.msgs[msg.Id.Hex()]; !exist {
this.msgs[msg.Id.Hex()] = msg this.msgs[msg.Id.Hex()] = msg
@ -1042,7 +1036,7 @@ func (this *Player) SendIosInstallStableMail() {
var newMsg *model.Message var newMsg *model.Message
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
newMsg = model.NewMessage("", 0, "", this.SnId, model.MSGTYPE_IOSINSTALLSTABLE, "系统通知", fmt.Sprintf("感谢您下载稳定版本,额外奖励%d元请查收", int(model.GameParamData.IosStableInstallPrize/100)), newMsg = model.NewMessage("", 0, "", this.SnId, model.MSGTYPE_IOSINSTALLSTABLE, "系统通知", fmt.Sprintf("感谢您下载稳定版本,额外奖励%d元请查收", int(model.GameParamData.IosStableInstallPrize/100)),
int64(model.GameParamData.IosStableInstallPrize), 0, 0, time.Now().Unix(), 0, "", nil, this.Platform, model.HallAll, nil) int64(model.GameParamData.IosStableInstallPrize), 0, 0, time.Now().Unix(), 0, "", nil, this.Platform, model.HallAll)
return model.InsertMessage(this.Platform, newMsg) return model.InsertMessage(this.Platform, newMsg)
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) { }), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
if data == nil { if data == nil {
@ -1061,7 +1055,7 @@ func (this *Player) TestMail() {
otherParams = append(otherParams, 20001, 3) otherParams = append(otherParams, 20001, 3)
otherParams = append(otherParams, 20002, 3) otherParams = append(otherParams, 20002, 3)
newMsg = model.NewMessage("", 0, "", this.SnId, model.MSGTYPE_ITEM, "系统通知道具test", "测试", newMsg = model.NewMessage("", 0, "", this.SnId, model.MSGTYPE_ITEM, "系统通知道具test", "测试",
100000, 100, model.MSGSTATE_UNREAD, time.Now().Unix(), 0, "", otherParams, this.Platform, 0, nil) 100000, 100, model.MSGSTATE_UNREAD, time.Now().Unix(), 0, "", otherParams, this.Platform, 0)
return model.InsertMessage(this.Platform, newMsg) return model.InsertMessage(this.Platform, newMsg)
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) { }), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
if data == nil { if data == nil {
@ -1081,7 +1075,7 @@ func (this *Player) TestSubMail() {
otherParams = append(otherParams, 20001, 3) otherParams = append(otherParams, 20001, 3)
otherParams = append(otherParams, 20002, 3) otherParams = append(otherParams, 20002, 3)
newMsg = model.NewMessage("", 0, "", 0, model.MSGTYPE_ITEM, "系统", "测试", newMsg = model.NewMessage("", 0, "", 0, model.MSGTYPE_ITEM, "系统", "测试",
100000, 100, model.MSGSTATE_UNREAD, time.Now().Unix(), 0, "", otherParams, this.Platform, model.HallTienlen, nil) 100000, 100, model.MSGSTATE_UNREAD, time.Now().Unix(), 0, "", otherParams, this.Platform, model.HallTienlen)
return model.InsertMessage(this.Platform, newMsg) return model.InsertMessage(this.Platform, newMsg)
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) { }), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
if data == nil { if data == nil {

View File

@ -84,7 +84,7 @@ func (this *PlayerRankSeason) sendEmailAward(rankType int32) {
content := i18n.Tr("languages", "RankAward") content := i18n.Tr("languages", "RankAward")
newMsg = model.NewMessage("", 0, "", this.SnId, model.MSGTYPE_RANK_REWARD, newMsg = model.NewMessage("", 0, "", this.SnId, model.MSGTYPE_RANK_REWARD,
title, content, coin, diamond, model.MSGSTATE_UNREAD, time.Now().Unix(), 0, "", otherParams, this.Platform, model.HallTienlen, nil) title, content, coin, diamond, model.MSGSTATE_UNREAD, time.Now().Unix(), 0, "", otherParams, this.Platform, model.HallTienlen)
return model.InsertMessage(this.Platform, newMsg) return model.InsertMessage(this.Platform, newMsg)
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) { }), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {

View File

@ -7,7 +7,6 @@ import (
"sync" "sync"
"time" "time"
nowtool "github.com/jinzhu/now"
"mongo.games.com/goserver/core/basic" "mongo.games.com/goserver/core/basic"
"mongo.games.com/goserver/core/i18n" "mongo.games.com/goserver/core/i18n"
"mongo.games.com/goserver/core/logger" "mongo.games.com/goserver/core/logger"
@ -26,7 +25,6 @@ import (
func init() { func init() {
module.RegisteModule(TournamentMgr, time.Second, 0) module.RegisteModule(TournamentMgr, time.Second, 0)
ClockMgrSington.RegisteSinker(TournamentMgr)
} }
const ( const (
@ -80,7 +78,6 @@ type PlayerRoundInfo struct {
} }
type Tournament struct { type Tournament struct {
BaseClockSinker
GameMatchDateList map[string]map[int32]*webapiproto.GameMatchDate // 比赛配置platform:比赛场配置id:比赛配置 GameMatchDateList map[string]map[int32]*webapiproto.GameMatchDate // 比赛配置platform:比赛场配置id:比赛配置
singleSignupPlayers map[int32]*SignupInfo // 开启机器人时报名的玩家玩家Id:报名信息 singleSignupPlayers map[int32]*SignupInfo // 开启机器人时报名的玩家玩家Id:报名信息
signupPlayers map[string]map[int32]*SignInfo // 报名的玩家 platform:比赛配置id:报名人 signupPlayers map[string]map[int32]*SignInfo // 报名的玩家 platform:比赛配置id:报名人
@ -185,7 +182,6 @@ func (this *Tournament) UpdateData(init bool, data *webapiproto.GameMatchDateLis
configs := make(map[int32]*webapiproto.GameMatchDate) configs := make(map[int32]*webapiproto.GameMatchDate)
for _, v := range data.List { for _, v := range data.List {
if this.checkData(v) { if this.checkData(v) {
this.FixMatchTimeStamp(v)
configs[v.Id] = v configs[v.Id] = v
} else { } else {
logger.Logger.Error("GameMatchDate error: ", v) logger.Logger.Error("GameMatchDate error: ", v)
@ -278,6 +274,17 @@ func (this *Tournament) IsRobotOn(match *webapiproto.GameMatchDate) bool {
// IsTimeRange 判断是否在比赛时间段内 // IsTimeRange 判断是否在比赛时间段内
// 在时间段内才能报名 // 在时间段内才能报名
func (this *Tournament) IsTimeRange(gmd *webapiproto.GameMatchDate) bool { func (this *Tournament) IsTimeRange(gmd *webapiproto.GameMatchDate) bool {
getWeekNum := func(t time.Time) int {
strWeek := []string{"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}
week := t.Weekday()
for i, s := range strWeek {
if week.String() == s {
return i
}
}
return 0
}
if gmd == nil { if gmd == nil {
return false return false
} }
@ -292,21 +299,17 @@ func (this *Tournament) IsTimeRange(gmd *webapiproto.GameMatchDate) bool {
case 0: case 0:
return true return true
case 1: case 1:
week := this.getWeekDay() nowWeek := getWeekNum(tNow)
for _, v := range gmd.MatchTimeWeek { hms := int32(tNow.Hour()*10000 + tNow.Minute()*100 + tNow.Second())
if week == int(v) { if gmd.MatchTimeWeek != nil && len(gmd.MatchTimeWeek) > 0 {
if gmd.MatchTimeStamp != nil && len(gmd.MatchTimeStamp) > 1 { for _, week := range gmd.MatchTimeWeek {
this.FixMatchTimeStamp(gmd) if nowWeek == int(week) {
startStamp := gmd.MatchTimeStamp[0] if hms >= gmd.MatchTimeStartHMS && hms <= gmd.MatchTimeEndHMS {
endStamp := gmd.MatchTimeStamp[1]
if tNow.Unix() >= startStamp && tNow.Unix() <= endStamp {
return true return true
} }
} }
return false
} }
} }
case 2: case 2:
if gmd.MatchTimeStamp != nil && len(gmd.MatchTimeStamp) > 1 { if gmd.MatchTimeStamp != nil && len(gmd.MatchTimeStamp) > 1 {
startStamp := gmd.MatchTimeStamp[0] startStamp := gmd.MatchTimeStamp[0]
@ -1198,7 +1201,7 @@ func (this *Tournament) sendPromotionInfo(mc *PlayerMatchContext, sortId int64,
title := i18n.Tr("languages", "MatchAwardTitle") title := i18n.Tr("languages", "MatchAwardTitle")
content := i18n.Tr("languages", "MatchAward", params) content := i18n.Tr("languages", "MatchAward", params)
newMsg = model.NewMessage("", 0, "", mc.p.SnId, model.MSGTYPE_RANK_REWARD, newMsg = model.NewMessage("", 0, "", mc.p.SnId, model.MSGTYPE_RANK_REWARD,
title, content, 0, 0, model.MSGSTATE_UNREAD, time.Now().Unix(), 0, "", nil, mc.p.Platform, model.HallTienlen, nil) title, content, 0, 0, model.MSGSTATE_UNREAD, time.Now().Unix(), 0, "", nil, mc.p.Platform, model.HallTienlen)
err := model.InsertMessage(mc.p.Platform, newMsg) err := model.InsertMessage(mc.p.Platform, newMsg)
if err != nil { if err != nil {
logger.Logger.Errorf("发送邮件失败 snid:%v itemID:%v err:%v", mc.p.SnId, data.Id, err) logger.Logger.Errorf("发送邮件失败 snid:%v itemID:%v err:%v", mc.p.SnId, data.Id, err)
@ -1531,61 +1534,3 @@ func (this *Tournament) Update() {
} }
func (this *Tournament) Shutdown() {} func (this *Tournament) Shutdown() {}
func (this *Tournament) getWeekDay() int {
getWeekNum := func(t time.Time) int {
strWeek := []string{"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}
week := t.Weekday()
for i, s := range strWeek {
if week.String() == s {
return i
}
}
return 0
}
l := time.FixedZone("CST", model.GameParamData.BackendTimeLocal*3600)
bTs := time.Now().In(l)
week := getWeekNum(bTs)
return week
}
func (this *Tournament) FixMatchTimeStamp(d *webapiproto.GameMatchDate) {
// 更新比赛时间
if d == nil || d.MatchTimeType != 1 {
return
}
if len(d.MatchTimeStamp) != 2 {
return
}
l := time.FixedZone("CST", model.GameParamData.BackendTimeLocal*3600)
bTs := time.Now().In(l)
week := this.getWeekDay()
st := time.Unix(d.MatchTimeStamp[0], 0).In(l)
et := time.Unix(d.MatchTimeStamp[1], 0).In(l)
logger.Logger.Tracef("FixMatchTimeStamp 1 id:%v now:%v week:%v start:%v end:%v", d.Id, bTs, bTs.Weekday(), st, et)
// 重复时间段比赛时间
for _, v := range d.MatchTimeWeek {
if v == int32(week) {
stSub := st.Unix() - nowtool.New(st).BeginningOfDay().Unix()
sub := d.MatchTimeStamp[1] - d.MatchTimeStamp[0]
d.MatchTimeStamp[0] = nowtool.New(bTs).BeginningOfDay().Add(time.Duration(stSub) * time.Second).Unix()
d.MatchTimeStamp[1] = d.MatchTimeStamp[0] + sub
st = time.Unix(d.MatchTimeStamp[0], 0).In(l)
et = time.Unix(d.MatchTimeStamp[1], 0).In(l)
logger.Logger.Tracef("FixMatchTimeStamp 2 id:%v now:%v week:%v start:%v end:%v", d.Id, bTs, bTs.Weekday(), st, et)
break
}
}
}
func (this *Tournament) OnHourTimer() {
for _, v := range this.GameMatchDateList {
for _, vv := range v {
this.FixMatchTimeStamp(vv)
}
}
}

View File

@ -3229,10 +3229,6 @@ func init() {
diamond := msg.GetDiamond() diamond := msg.GetDiamond()
otherParams := msg.GetParams() otherParams := msg.GetParams()
showId := msg.GetShowId() showId := msg.GetShowId()
channel := msg.GetOnChannelName()
if destSnid > 0 {
channel = []string{}
}
if messageType == model.MSGTYPE_ITEM && len(otherParams) != 0 && len(otherParams)%2 != 0 { if messageType == model.MSGTYPE_ITEM && len(otherParams) != 0 && len(otherParams)%2 != 0 {
pack.Tag = webapiproto.TagCode_FAILED pack.Tag = webapiproto.TagCode_FAILED
@ -3247,9 +3243,6 @@ func init() {
if p.IsRob == true { //排除掉机器人 if p.IsRob == true { //排除掉机器人
continue continue
} }
if len(channel) > 0 && !common.InSliceString(channel, p.LastChannel) { // 渠道过滤
continue
}
if platform == "" || p.Platform == platform { if platform == "" || p.Platform == platform {
onlinePlayerSnid = append(onlinePlayerSnid, p.SnId) onlinePlayerSnid = append(onlinePlayerSnid, p.SnId)
} }
@ -3272,7 +3265,7 @@ func init() {
// var otherParams []int32 // var otherParams []int32
newMsg = model.NewMessage("", int32(srcSnid), "", int32(destSnid), int32(messageType), title, content, coin, diamond, newMsg = model.NewMessage("", int32(srcSnid), "", int32(destSnid), int32(messageType), title, content, coin, diamond,
model.MSGSTATE_UNREAD, time.Now().Unix(), model.MSGATTACHSTATE_DEFAULT, "", otherParams, platform, showId, channel) model.MSGSTATE_UNREAD, time.Now().Unix(), model.MSGATTACHSTATE_DEFAULT, "", otherParams, platform, showId)
if newMsg != nil { if newMsg != nil {
err := model.InsertMessage(platform, newMsg) err := model.InsertMessage(platform, newMsg)
if err != nil { if err != nil {
@ -3285,7 +3278,7 @@ func init() {
if destSnid == 0 { if destSnid == 0 {
for _, psnid := range onlinePlayerSnid { for _, psnid := range onlinePlayerSnid {
newMsg := model.NewMessage(newMsg.Id.Hex(), newMsg.SrcId, "", psnid, newMsg.MType, newMsg.Title, newMsg.Content, newMsg.Coin, newMsg.Diamond, newMsg := model.NewMessage(newMsg.Id.Hex(), newMsg.SrcId, "", psnid, newMsg.MType, newMsg.Title, newMsg.Content, newMsg.Coin, newMsg.Diamond,
newMsg.State, newMsg.CreatTs, newMsg.AttachState, newMsg.GiftId, otherParams, platform, newMsg.ShowId, channel) newMsg.State, newMsg.CreatTs, newMsg.AttachState, newMsg.GiftId, otherParams, platform, newMsg.ShowId)
if newMsg != nil { if newMsg != nil {
dbMsgs = append(dbMsgs, newMsg) dbMsgs = append(dbMsgs, newMsg)
} }
@ -4367,13 +4360,13 @@ func init() {
p := PlayerMgrSington.GetPlayerBySnId(msg.GetSnid()) p := PlayerMgrSington.GetPlayerBySnId(msg.GetSnid())
if p != nil { if p != nil {
//获取道具Id //获取道具Id
BagMgrSingleton.AddItems(p, items, 0, msg.GetTypeId(), "system", msg.GetRemark(), 0, 0, false) BagMgrSingleton.AddItems(p, items, 0, common.GainWayBackend, "system", "后台操作", 0, 0, false)
pack.Tag = webapiproto.TagCode_SUCCESS pack.Tag = webapiproto.TagCode_SUCCESS
pack.Msg = "AddItem success" pack.Msg = "AddItem success"
return common.ResponseTag_Ok, pack return common.ResponseTag_Ok, pack
} else { } else {
BagMgrSingleton.AddItemsOffline(msg.Platform, msg.Snid, items, msg.GetTypeId(), BagMgrSingleton.AddItemsOffline(msg.Platform, msg.Snid, items, common.GainWayBackend,
"system", msg.GetRemark(), 0, 0, false, func(err error) { "system", "后台操作", 0, 0, false, func(err error) {
if err != nil { if err != nil {
pack.Tag = webapiproto.TagCode_FAILED pack.Tag = webapiproto.TagCode_FAILED
pack.Msg = "AddItem failed:" + err.Error() pack.Msg = "AddItem failed:" + err.Error()