锦标赛优化

This commit is contained in:
hahwu 2026-04-16 11:25:40 +08:00
parent dea42c4574
commit 4546bd66cf
2 changed files with 5 additions and 11 deletions

View File

@ -114,7 +114,7 @@ func (c *ChampshipMgr) Init() {
remain1 := 1800 - remain%1800
c.mDispatr.AfterFunc(time.Duration(remain1)*time.Second, func() { // 30分钟后重新分组
c.group(false)
c.group()
})
c.mDispatr.AfterFunc(time.Duration(60)*time.Second, func() {
@ -174,7 +174,6 @@ func (c *ChampshipMgr) ZeroNotifyAll() (interface{}, error) {
}
func (c *ChampshipMgr) ZeroUpdate() (interface{}, error) {
c.group(true)
log.Debug("ChampshipMgr ZeroUpdate")
data := c.getData()
data.mu.Lock()
@ -494,14 +493,9 @@ func (c *ChampshipMgr) GetRankMsg(uid int) *proto.ResChampshipRank {
}
// 分组
func (c *ChampshipMgr) group(iszero bool) (interface{}, error) {
now := GoUtil.Now()
zero := GoUtil.ZeroTimestamp()
if now-zero < 1800 && !iszero { // 0点30分钟内不分组
return nil, nil
}
func (c *ChampshipMgr) group() (interface{}, error) {
c.mDispatr.AfterFunc(time.Duration(1800)*time.Second, func() { // 30分钟后重新分组
c.group(false)
c.group()
})
ChampshipData := c.getData()
ChampshipData.mu.Lock()
@ -1053,7 +1047,7 @@ func (c *ChampshipMgr) Debug() {
H: GoUtil.RandNum(1, 99),
}
}
c.group(true)
c.group()
var i int
for _, v := range ChampshipData.Rank {
for _, v1 := range v {

View File

@ -221,7 +221,7 @@ func NotifyAllPlayerMsg(m *msg.Msg) {
}
func ChampshipGroupHandler(data *msg.Msg) (interface{}, error) {
G_GameLogicPtr.ChampshipMgr.group(true)
G_GameLogicPtr.ChampshipMgr.group()
return nil, nil
}