no message

This commit is contained in:
sk 2024-11-14 15:23:40 +08:00
parent 3bcc944417
commit dfe093b03e
3 changed files with 34 additions and 11 deletions

View File

@ -2,15 +2,17 @@ package main
import ( import (
"fmt" "fmt"
"mongo.games.com/goserver/core/logger"
"time" "time"
"mongo.games.com/game/common"
"mongo.games.com/game/model"
"mongo.games.com/goserver/core/basic" "mongo.games.com/goserver/core/basic"
"mongo.games.com/goserver/core/logger"
"mongo.games.com/goserver/core/module" "mongo.games.com/goserver/core/module"
"mongo.games.com/goserver/core/netlib" "mongo.games.com/goserver/core/netlib"
"mongo.games.com/goserver/core/task" "mongo.games.com/goserver/core/task"
"mongo.games.com/game/common"
"mongo.games.com/game/model"
"mongo.games.com/game/worldsrv/internal"
) )
const ( const (
@ -236,6 +238,7 @@ func (this *LoginStateMgr) LogoutAllBySession(session *netlib.Session) {
p := PlayerMgrSington.GetOnlinePlayer(sid) p := PlayerMgrSington.GetOnlinePlayer(sid)
if p != nil { if p != nil {
p.DropLine() p.DropLine()
internal.FirePlayerDropLine[*Player, *Scene](p)
} }
} }
} }

View File

@ -86,6 +86,7 @@ type Player struct {
changeIconTime time.Time //上次修改头像时间 changeIconTime time.Time //上次修改头像时间
enterts time.Time //进入时间 enterts time.Time //进入时间
lastChangeScene time.Time //上次换桌时间 lastChangeScene time.Time //上次换桌时间
dropTime time.Time // 掉线时间
isAudience bool //是否是观众 isAudience bool //是否是观众
customerToken string //客服会话token customerToken string //客服会话token
isDelete bool //是否已删档用户 isDelete bool //是否已删档用户
@ -1155,6 +1156,7 @@ func (this *Player) Kick(reason int32) {
LoginStateMgrSington.LogoutBySid(this.sid) LoginStateMgrSington.LogoutBySid(this.sid)
this.DropLine() this.DropLine()
internal.FirePlayerDropLine[*Player, *Scene](this)
} }
TournamentMgr.ForceQuit(this.Platform, this.SnId) TournamentMgr.ForceQuit(this.Platform, this.SnId)
} }
@ -1632,11 +1634,20 @@ func (this *Player) OnSecTimer() {
} }
func (this *Player) OnMiniTimer() { func (this *Player) OnMiniTimer() {
if this.IsOnLine() {
TaskSubjectSingleton.Touch(common.TaskTypeOnlineTs, &TaskData{ TaskSubjectSingleton.Touch(common.TaskTypeOnlineTs, &TaskData{
SnId: this.SnId, SnId: this.SnId,
Num: 60, Num: 60,
}) })
} }
// 长时间掉线又没有删除缓存
if !this.dropTime.IsZero() && time.Now().Sub(this.dropTime).Minutes() > 20 {
logger.Logger.Errorf("清除缓存异常玩家 snid:%v dirty:%v lastLogoutTime:%v lastGameId:%v", this.SnId, this.dirty, this.LastLogoutTime, this.LastGameId)
if this.scene != nil {
logger.Logger.Errorf("清除缓存异常玩家 sceneId:%v", this.scene.sceneId)
}
}
}
func (this *Player) OnHourTimer() { func (this *Player) OnHourTimer() {
} }
@ -3887,7 +3898,9 @@ func init() {
ClockFunc: common.ClockFunc{}, ClockFunc: common.ClockFunc{},
OnPlayerLoginedFunc: nil, OnPlayerLoginedFunc: nil,
OnPlayerLogoutedFunc: nil, OnPlayerLogoutedFunc: nil,
OnPlayerDropLineFunc: nil, OnPlayerDropLineFunc: func(p *Player) {
p.dropTime = time.Now()
},
OnPlayerReholdFunc: nil, OnPlayerReholdFunc: nil,
OnPlayerEnterSceneBeforeFunc: nil, OnPlayerEnterSceneBeforeFunc: nil,
OnPlayerEnterSceneAfterFunc: nil, OnPlayerEnterSceneAfterFunc: nil,

View File

@ -21,6 +21,7 @@ import (
serverproto "mongo.games.com/game/protocol/server" serverproto "mongo.games.com/game/protocol/server"
webapiproto "mongo.games.com/game/protocol/webapi" webapiproto "mongo.games.com/game/protocol/webapi"
"mongo.games.com/game/srvdata" "mongo.games.com/game/srvdata"
"mongo.games.com/game/worldsrv/internal"
) )
type PlayerGameCtx struct { type PlayerGameCtx struct {
@ -193,6 +194,9 @@ func (this *Scene) PlayerEnter(p *Player, pos int, ischangeroom bool) bool {
} }
} }
internal.FirePlayerEnterSceneBefore(p, this)
defer internal.FirePlayerEnterSceneAfter(p, this)
// 非百人,设置座位 // 非百人,设置座位
if !this.IsHundredScene() { if !this.IsHundredScene() {
if pos != -1 { if pos != -1 {
@ -515,6 +519,9 @@ func (this *Scene) lastScene(p *Player) {
} }
func (this *Scene) DelPlayer(p *Player) bool { func (this *Scene) DelPlayer(p *Player) bool {
internal.FirePlayerLeaveSceneBefore(p, this)
defer internal.FirePlayerLeaveSceneAfter(p, this)
if p.scene != this { if p.scene != this {
roomId := 0 roomId := 0
if p.scene != nil { if p.scene != nil {