Files
bl/logic/service/user/Login.go

48 lines
1.0 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package user
import (
"blazing/common/data/share"
"blazing/logic/service/player"
"blazing/modules/blazing/model"
"context"
"encoding/hex"
"github.com/gogf/gf/v2/os/glog"
)
// LoginSidInfo 登录携带的凭证结构体
type MAIN_LOGIN_IN struct { //这里直接使用组合来实现将传入的原始头部数据和结构体参数序列化
Head player.TomeeHeader `cmd:"1001" struc:"[0]pad"` //玩家登录
Sid []byte `struc:"[16]byte"` // 登录会话ID固定长度16字节
}
func (l *MAIN_LOGIN_IN) CheakSession() bool {
// tt, _ := cool.CacheManager.Keys(context.Background())
//g.Dump(tt)
t1 := hex.EncodeToString(l.Sid)
t, err := share.ShareManager.GetSession(t1)
if err != nil {
return false
}
share.ShareManager.DeleteSession(t1)
glog.Debug(context.Background(), "后端获取", t1, t, err)
return t == l.Head.UserID
}
type LoginMSInfo struct {
model.PlayerInfo
}
func NewOutInfo() *LoginMSInfo {
l := &LoginMSInfo{
PlayerInfo: *model.NewPlayerInfo(),
}
return l
}