game2006go/server/imserver/cachedbmgr.go
2023-09-14 13:55:33 +08:00

38 lines
920 B
Go

package main
import (
"f5"
"q5"
)
func (cm *CacheMgr) loadUserProfile(sql string) {
f5.GetJsStyleDb().SelectCustomQuery(
FRIEND_DB,
sql,
func(err error, rows *f5.DataSet) {
if err != nil {
f5.GetSysLog().Info("loadGuildMemberProfile err:%v \n", err)
return
}
for rows.Next() {
accountId := q5.ToString(*rows.GetByIndex(0))
player := playerMgr.GetPlayerByAccountId(accountId)
var onlineStatue int32 = 0
if player != nil {
onlineStatue = 1
}
profile := &PlayerProfile{
AccountId: accountId,
Username: q5.ToString(*rows.GetByIndex(1)),
Avatar: q5.ToInt32(*rows.GetByIndex(2)),
AvatarHead: q5.ToInt32(*rows.GetByIndex(3)),
Rank: q5.ToInt32(*rows.GetByIndex(4)),
LastLoginTime: q5.ToInt32(*rows.GetByIndex(5)),
OnlineStatus: onlineStatue,
}
cacheMgr.SetProfile(accountId, profile)
}
},
)
}