This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"blazing/cool"
|
||||
"blazing/logic/service/common"
|
||||
"fmt"
|
||||
"hash/crc32"
|
||||
|
||||
"blazing/modules/player/model"
|
||||
"context"
|
||||
@@ -18,21 +19,22 @@ type MAIN_LOGIN_IN struct { //这里直接使用组合来实现将传入的原
|
||||
|
||||
}
|
||||
|
||||
func (l *MAIN_LOGIN_IN) CheakSession() bool {
|
||||
func (l *MAIN_LOGIN_IN) CheakSession() (bool, uint32) {
|
||||
// tt, _ := cool.CacheManager.Keys(context.Background())
|
||||
//g.Dump(tt)
|
||||
t1 := hex.EncodeToString(l.Sid)
|
||||
r, err := cool.CacheManager.Get(context.Background(), fmt.Sprintf("session:%d", l.Head.UserID))
|
||||
if err != nil {
|
||||
return false
|
||||
return false, 0
|
||||
}
|
||||
if r.String() != t1 {
|
||||
return false
|
||||
return false, 0
|
||||
}
|
||||
|
||||
crc32Table := crc32.MakeTable(crc32.IEEE)
|
||||
crcValue := crc32.Checksum([]byte(t1), crc32Table)
|
||||
cool.CacheManager.Remove(context.Background(), fmt.Sprintf("session:%d", l.Head.UserID))
|
||||
//glog.Debug(context.Background(), "后端获取", t1, err)
|
||||
return true
|
||||
return true, crcValue
|
||||
}
|
||||
|
||||
type LoginMSInfo struct {
|
||||
|
||||
Reference in New Issue
Block a user