This commit is contained in:
aozhiwei 2024-04-07 11:38:10 +08:00
parent 37a20cdc6d
commit 8aca98863e
2 changed files with 9 additions and 0 deletions

View File

@ -9,13 +9,20 @@ import (
"main/constant"
)
type pendingUser struct {
accountId string
reqTime int64
}
type cacheMgr struct {
lock sync.Mutex
userHash map[string]*userProfile
pendingHash map[string]*pendingUser
}
func (this *cacheMgr) Init() {
this.userHash = make(map[string]*userProfile)
this.pendingHash = make(map[string]*pendingUser)
}
func (this *cacheMgr) UnInit() {
@ -67,6 +74,7 @@ func (this *cacheMgr) AsyncSearch(sinceId int64, q string,
u.avatarUrl = pg.Rows.GetByName("avatar")
u.head = pg.Rows.GetByName("head")
u.lastLoginTime = q5.ToInt32(pg.Rows.GetByName("last_login_time"))
u.lastSyncTime = f5.GetApp().GetNowMillis()
this.userHash[u.accountId] = u
*q5.NewSliceElement(&users) = u.accountId

View File

@ -16,6 +16,7 @@ type userProfile struct {
totalWinTimes int32
rank int32
lastLoginTime int32
lastSyncTime int64
}
func (this *userProfile) GetAccountId() string {