diff --git a/server/gameservice/app/app.go b/server/gameservice/app/app.go index adcffc08..a2467967 100644 --- a/server/gameservice/app/app.go +++ b/server/gameservice/app/app.go @@ -1,23 +1,14 @@ package app import ( - "crypto/md5" - "encoding/hex" "f5" - "fmt" "main/constant" - "math/rand" "mt" - "sync" - "time" ) type app struct { initCb func() unInitCb func() - sessionLock sync.Mutex - sessionHash map[string]string - accountIdHash map[string]string } func (this *app) GetPkgName() string { @@ -37,12 +28,7 @@ func (this *app) Run(initCb func(), unInitCb func()) { func (this *app) Init() { f5.LoadMetaTable(mt.Table) this.registerDataSources() - this.sessionHash = make(map[string]string) - this.accountIdHash = make(map[string]string) - //seasonMt := mt.Table.RankSeason.GetCurrentSeason() - //fmt.Println("SeasonMeta =====", seasonMt) - // this.initCb() } @@ -88,48 +74,6 @@ func (this *app) registerDataSources() { ) } -func (this *app) AddSession(accountId string) string { - this.sessionLock.Lock() - defer this.sessionLock.Unlock() - uuid := f5.GetApp().NewNodeUuid() - str := fmt.Sprintf("%s%d%s%d", accountId, uuid, randStringBytes(12), time.Now().Unix()) - md5New := md5.New() - strByte := []byte(str) - md5New.Write(strByte) - md5String := hex.EncodeToString(md5New.Sum(nil)) - token := accountId + "|" + md5String - this.sessionHash[accountId] = token - return token -} - -const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" - -func randStringBytes(n int) string { - b := make([]byte, n) - for i := range b { - b[i] = letterBytes[rand.Intn(len(letterBytes))] - } - return string(b) -} - -func (this *app) GetSessionAccountId(accountId string) string { - this.sessionLock.Lock() - defer this.sessionLock.Unlock() - if session, ok := this.sessionHash[accountId]; ok { - return session - } else { - return "nil" - } -} - -func (this *app) RemoveSession(accountId string) { - this.sessionLock.Lock() - defer this.sessionLock.Unlock() - if _, ok := this.sessionHash[accountId]; ok { - delete(this.sessionHash, accountId) - } -} - func (this *app) HasTask() bool { return false }