将会话保存时长从24小时调整为1小时,以提高会话安全性。 feat(socket): 添加强制踢出功能 在QuitSelf方法中增加强制踢出参数,当参数不为0时强制踢出所有玩家。
31 lines
529 B
Go
31 lines
529 B
Go
package socket
|
|
|
|
import (
|
|
"blazing/cool"
|
|
"blazing/logic/service/player"
|
|
"context"
|
|
"fmt"
|
|
)
|
|
|
|
func (h *Server) KickPerson(a int) error {
|
|
cool.Loger.Info(context.TODO(), "检测到踢人请求", a)
|
|
|
|
return player.KickPlayer(uint32(a))
|
|
}
|
|
|
|
// 参数不为0是强制踢出
|
|
func (h *Server) QuitSelf(a int) error {
|
|
//TODO 这里待退出
|
|
fmt.Println("检测到退出请求")
|
|
|
|
h.quit = true
|
|
if a != 0 {
|
|
player.Mainplayer.Range(func(key uint32, value *player.Player) bool {
|
|
value.Kick()
|
|
return true
|
|
})
|
|
}
|
|
|
|
return nil
|
|
}
|