修复imserver数据库问题
This commit is contained in:
parent
68d2a07d51
commit
5c85db77f9
@ -27,8 +27,8 @@ func (cm *CacheMgr) LoadFromDB() {
|
||||
empty := true
|
||||
for rows.Next() {
|
||||
empty = false
|
||||
account1Id := q5.ToString(*rows.GetByName("account1_id"))
|
||||
account2Id := q5.ToString(*rows.GetByName("account2_id"))
|
||||
account1Id := q5.ToString(rows.GetByName("account1_id"))
|
||||
account2Id := q5.ToString(rows.GetByName("account2_id"))
|
||||
|
||||
if !uniAccountIds.Has(account1Id) {
|
||||
cm.loadUserProfile(account1Id)
|
||||
@ -40,7 +40,7 @@ func (cm *CacheMgr) LoadFromDB() {
|
||||
}
|
||||
uniAccountIds.Add(account2Id)
|
||||
|
||||
lastIdx = q5.ToInt64(*rows.GetByName("idx"))
|
||||
lastIdx = q5.ToInt64(rows.GetByName("idx"))
|
||||
}
|
||||
if empty {
|
||||
done = true
|
||||
@ -66,14 +66,14 @@ func (cm *CacheMgr) LoadFromDB() {
|
||||
empty := true
|
||||
for rows.Next() {
|
||||
empty = false
|
||||
accountId := q5.ToString(*rows.GetByName("account_id"))
|
||||
accountId := q5.ToString(rows.GetByName("account_id"))
|
||||
|
||||
if !uniAccountIds.Has(accountId) {
|
||||
cm.loadUserProfile(accountId)
|
||||
}
|
||||
uniAccountIds.Add(accountId)
|
||||
|
||||
lastIdx = q5.ToInt64(*rows.GetByName("idx"))
|
||||
lastIdx = q5.ToInt64(rows.GetByName("idx"))
|
||||
}
|
||||
if empty {
|
||||
done = true
|
||||
@ -98,16 +98,16 @@ func (cm *CacheMgr) loadUserProfile(accountId string) {
|
||||
panic(err)
|
||||
}
|
||||
for rows.Next() {
|
||||
aId := q5.ToString(*rows.GetByName("account_id"))
|
||||
aId := q5.ToString(rows.GetByName("account_id"))
|
||||
onlineStatus := playerMgr.GetOnlineStatus(accountId)
|
||||
profile := &PlayerProfile{
|
||||
AccountId: aId,
|
||||
Username: q5.ToString(*rows.GetByName("name")),
|
||||
Avatar: q5.ToInt32(*rows.GetByName("head_id")),
|
||||
AvatarHead: q5.ToInt32(*rows.GetByName("head_frame")),
|
||||
Star: q5.ToInt32(*rows.GetByName("star_num")),
|
||||
Rank: q5.ToInt32(*rows.GetByName("rank")),
|
||||
LastLoginTime: q5.ToInt32(*rows.GetByName("last_login_time")),
|
||||
Username: q5.ToString(rows.GetByName("name")),
|
||||
Avatar: q5.ToInt32(rows.GetByName("head_id")),
|
||||
AvatarHead: q5.ToInt32(rows.GetByName("head_frame")),
|
||||
Star: q5.ToInt32(rows.GetByName("star_num")),
|
||||
Rank: q5.ToInt32(rows.GetByName("rank")),
|
||||
LastLoginTime: q5.ToInt32(rows.GetByName("last_login_time")),
|
||||
OnlineStatus: onlineStatus,
|
||||
}
|
||||
cm.AddPlayerProfile(cm.getCacheVersion(), profile)
|
||||
|
@ -501,8 +501,9 @@ var file_cs_msgid_proto_rawDesc = []byte{
|
||||
0x66, 0x79, 0x10, 0xf4, 0x07, 0x12, 0x1a, 0x0a, 0x15, 0x5f, 0x53, 0x4d, 0x41, 0x70, 0x70, 0x6c,
|
||||
0x79, 0x54, 0x6f, 0x47, 0x75, 0x69, 0x6c, 0x64, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x10, 0xf5,
|
||||
0x07, 0x12, 0x18, 0x0a, 0x13, 0x5f, 0x53, 0x4d, 0x4c, 0x65, 0x61, 0x76, 0x65, 0x47, 0x75, 0x69,
|
||||
0x6c, 0x64, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x10, 0xf6, 0x07, 0x42, 0x06, 0x5a, 0x04, 0x2e,
|
||||
0x3b, 0x63, 0x73,
|
||||
0x6c, 0x64, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x10, 0xf6, 0x07, 0x42, 0x1a, 0x0a, 0x12, 0x63,
|
||||
0x73, 0x5f, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x5f, 0x6d, 0x73, 0x67, 0x69, 0x64, 0x5f, 0x70,
|
||||
0x62, 0x5a, 0x04, 0x2e, 0x3b, 0x63, 0x73,
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -6161,7 +6161,8 @@ var file_cs_proto_proto_rawDesc = []byte{
|
||||
0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x73, 0x74, 0x61, 0x72, 0x2a, 0x22, 0x0a, 0x0a, 0x43,
|
||||
0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x5f, 0x65, 0x12, 0x14, 0x0a, 0x0c, 0x50, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x10, 0xd1, 0xa2, 0xd5, 0xc4, 0x07, 0x42,
|
||||
0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x63, 0x73,
|
||||
0x1a, 0x0a, 0x12, 0x63, 0x73, 0x5f, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x5f, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x5f, 0x70, 0x62, 0x5a, 0x04, 0x2e, 0x3b, 0x63, 0x73,
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -106,20 +106,20 @@ func (fm *FriendsMgr) findUsersByUsername(username string, sinceId int64, cb fun
|
||||
lastId := sinceId
|
||||
profiles := make([]*PlayerProfile, 0, MaxSearchResults)
|
||||
for rows.Next() {
|
||||
autoId := q5.ToInt64(*rows.GetByIndex(0))
|
||||
autoId := q5.ToInt64(rows.GetByIndex(0))
|
||||
if autoId > lastId {
|
||||
lastId = autoId
|
||||
}
|
||||
accountId := q5.ToString(*rows.GetByIndex(1))
|
||||
accountId := q5.ToString(rows.GetByIndex(1))
|
||||
onlineStatus := playerMgr.GetOnlineStatus(accountId)
|
||||
profile := &PlayerProfile{
|
||||
AccountId: q5.ToString(*rows.GetByIndex(1)),
|
||||
Username: q5.ToString(*rows.GetByIndex(2)),
|
||||
Avatar: q5.ToInt32(*rows.GetByIndex(3)),
|
||||
AvatarHead: q5.ToInt32(*rows.GetByIndex(4)),
|
||||
Star: q5.ToInt32(*rows.GetByIndex(5)),
|
||||
Rank: q5.ToInt32(*rows.GetByIndex(6)),
|
||||
LastLoginTime: q5.ToInt32(*rows.GetByIndex(7)),
|
||||
AccountId: q5.ToString(rows.GetByIndex(1)),
|
||||
Username: q5.ToString(rows.GetByIndex(2)),
|
||||
Avatar: q5.ToInt32(rows.GetByIndex(3)),
|
||||
AvatarHead: q5.ToInt32(rows.GetByIndex(4)),
|
||||
Star: q5.ToInt32(rows.GetByIndex(5)),
|
||||
Rank: q5.ToInt32(rows.GetByIndex(6)),
|
||||
LastLoginTime: q5.ToInt32(rows.GetByIndex(7)),
|
||||
OnlineStatus: onlineStatus,
|
||||
}
|
||||
profiles = append(profiles, profile)
|
||||
@ -144,10 +144,10 @@ func (fm *FriendsMgr) loadFriendships() {
|
||||
}
|
||||
userMap := make(map[string]*User)
|
||||
for rows.Next() {
|
||||
account1Id := q5.ToString(*rows.GetByIndex(0))
|
||||
account2Id := q5.ToString(*rows.GetByIndex(1))
|
||||
isFriendship := q5.ToInt32(*rows.GetByIndex(2))
|
||||
requestTime := q5.ToInt64(*rows.GetByIndex(3))
|
||||
account1Id := q5.ToString(rows.GetByIndex(0))
|
||||
account2Id := q5.ToString(rows.GetByIndex(1))
|
||||
isFriendship := q5.ToInt32(rows.GetByIndex(2))
|
||||
requestTime := q5.ToInt64(rows.GetByIndex(3))
|
||||
// 检查用户是否已经存在,如果不存在则创建
|
||||
user1, exists1 := userMap[account1Id]
|
||||
if !exists1 {
|
||||
@ -192,10 +192,10 @@ func (fm *FriendsMgr) loadUserFriendships(user *User, where [][]string) {
|
||||
return
|
||||
}
|
||||
for rows.Next() {
|
||||
account1Id := q5.ToString(*rows.GetByIndex(0))
|
||||
account2Id := q5.ToString(*rows.GetByIndex(1))
|
||||
isFriendship := q5.ToInt32(*rows.GetByIndex(2))
|
||||
requestTime := q5.ToInt64(*rows.GetByIndex(3))
|
||||
account1Id := q5.ToString(rows.GetByIndex(0))
|
||||
account2Id := q5.ToString(rows.GetByIndex(1))
|
||||
isFriendship := q5.ToInt32(rows.GetByIndex(2))
|
||||
requestTime := q5.ToInt64(rows.GetByIndex(3))
|
||||
if user.AccountId == account1Id {
|
||||
friendship1 := &Friendship{
|
||||
FriendAccountId: account2Id,
|
||||
@ -247,8 +247,8 @@ func (fm *FriendsMgr) loadBlacklist() {
|
||||
return
|
||||
}
|
||||
for rows.Next() {
|
||||
account1Id := q5.ToString(*rows.GetByIndex(0))
|
||||
account2Id := q5.ToString(*rows.GetByIndex(1))
|
||||
account1Id := q5.ToString(rows.GetByIndex(0))
|
||||
account2Id := q5.ToString(rows.GetByIndex(1))
|
||||
friendBlackList := &FriendBlackList{
|
||||
AccountId: account2Id,
|
||||
IsRemoved: 0,
|
||||
|
@ -40,20 +40,20 @@ func (gm *GuildMgr) loadGuildFromDBResult(err error, rows *f5.DataSet) {
|
||||
panic(err)
|
||||
}
|
||||
for rows.Next() {
|
||||
guildId := q5.ToInt64(*rows.GetByIndex(1))
|
||||
guildId := q5.ToInt64(rows.GetByIndex(1))
|
||||
guild := &Guild{
|
||||
AutoId: q5.ToInt64(*rows.GetByIndex(0)),
|
||||
AutoId: q5.ToInt64(rows.GetByIndex(0)),
|
||||
GuildId: guildId,
|
||||
Name: q5.ToString(*rows.GetByIndex(2)),
|
||||
LeaderId: q5.ToString(*rows.GetByIndex(3)),
|
||||
Avatar: q5.ToInt32(*rows.GetByIndex(4)),
|
||||
Notice: q5.ToString(*rows.GetByIndex(5)),
|
||||
JoinCond: q5.ToInt32(*rows.GetByIndex(6)),
|
||||
JoinCondValue: q5.ToInt32(*rows.GetByIndex(7)),
|
||||
TotalStars: q5.ToInt32(*rows.GetByIndex(8)),
|
||||
TotalKills: q5.ToInt32(*rows.GetByIndex(9)),
|
||||
ChickenDinners: q5.ToInt32(*rows.GetByIndex(10)),
|
||||
MaxMembers: q5.ToInt32(*rows.GetByIndex(11)),
|
||||
Name: q5.ToString(rows.GetByIndex(2)),
|
||||
LeaderId: q5.ToString(rows.GetByIndex(3)),
|
||||
Avatar: q5.ToInt32(rows.GetByIndex(4)),
|
||||
Notice: q5.ToString(rows.GetByIndex(5)),
|
||||
JoinCond: q5.ToInt32(rows.GetByIndex(6)),
|
||||
JoinCondValue: q5.ToInt32(rows.GetByIndex(7)),
|
||||
TotalStars: q5.ToInt32(rows.GetByIndex(8)),
|
||||
TotalKills: q5.ToInt32(rows.GetByIndex(9)),
|
||||
ChickenDinners: q5.ToInt32(rows.GetByIndex(10)),
|
||||
MaxMembers: q5.ToInt32(rows.GetByIndex(11)),
|
||||
Members: make(map[string]*GuildMember, MaxMembers),
|
||||
PendingReqs: make(map[string]int32, MaxPendingReqs),
|
||||
}
|
||||
@ -88,9 +88,9 @@ func (gm *GuildMgr) loadGuildMemberFromDBResult(err error, rows *f5.DataSet) {
|
||||
accountId string
|
||||
level int32
|
||||
)
|
||||
guildId = q5.ToInt64(*rows.GetByIndex(0))
|
||||
accountId = q5.ToString(*rows.GetByIndex(1))
|
||||
level = q5.ToInt32(*rows.GetByIndex(2))
|
||||
guildId = q5.ToInt64(rows.GetByIndex(0))
|
||||
accountId = q5.ToString(rows.GetByIndex(1))
|
||||
level = q5.ToInt32(rows.GetByIndex(2))
|
||||
|
||||
guildMember := &GuildMember{
|
||||
AccountId: accountId,
|
||||
@ -128,8 +128,8 @@ func (gm *GuildMgr) loadPendingReqsFromDBResult(err error, rows *f5.DataSet) {
|
||||
guildId int64
|
||||
accountId string
|
||||
)
|
||||
guildId = q5.ToInt64(*rows.GetByIndex(0))
|
||||
accountId = q5.ToString(*rows.GetByIndex(1))
|
||||
guildId = q5.ToInt64(rows.GetByIndex(0))
|
||||
accountId = q5.ToString(rows.GetByIndex(1))
|
||||
|
||||
pendingReq := &PendingReq{
|
||||
AccountId: accountId,
|
||||
@ -176,10 +176,10 @@ func (gm *GuildMgr) loadGuildLogsFromDBResult(err error, pagination *f5.Paginati
|
||||
gm.guildLogs[guildId] = make([]*GuildLog, DefaultLogs)
|
||||
|
||||
for pagination.Rows.Next() {
|
||||
guildId = q5.ToInt64(*pagination.Rows.GetByIndex(0))
|
||||
accountId = q5.ToString(*pagination.Rows.GetByIndex(1))
|
||||
logType = q5.ToInt32(*pagination.Rows.GetByIndex(2))
|
||||
content = q5.ToString(*pagination.Rows.GetByIndex(3))
|
||||
guildId = q5.ToInt64(pagination.Rows.GetByIndex(0))
|
||||
accountId = q5.ToString(pagination.Rows.GetByIndex(1))
|
||||
logType = q5.ToInt32(pagination.Rows.GetByIndex(2))
|
||||
content = q5.ToString(pagination.Rows.GetByIndex(3))
|
||||
|
||||
guildLog := &GuildLog{
|
||||
GuildId: guildId,
|
||||
@ -414,11 +414,11 @@ func (gm *GuildMgr) findGuildIdsByName(sinceId int64, name string, cb func(err e
|
||||
lastId := sinceId
|
||||
ids := make([]int64, 0, MaxSearchResults)
|
||||
for rows.Next() {
|
||||
autoId := q5.ToInt64(*rows.GetByIndex(0))
|
||||
autoId := q5.ToInt64(rows.GetByIndex(0))
|
||||
if lastId < autoId {
|
||||
lastId = autoId
|
||||
}
|
||||
guildId := q5.ToInt64(*rows.GetByIndex(1))
|
||||
guildId := q5.ToInt64(rows.GetByIndex(1))
|
||||
ids = append(ids, guildId)
|
||||
}
|
||||
cb(nil, lastId, ids)
|
||||
|
@ -49,7 +49,7 @@ func (this *PlayerMgr) init() {
|
||||
f5.GetSysLog().Info(
|
||||
"%s:%s",
|
||||
columns[i],
|
||||
*dataSet.GetByName(columns[i]))
|
||||
dataSet.GetByName(columns[i]))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user