save
This commit is contained in:
parent
9e8ffb5b5b
commit
f8d74b243a
@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"f5"
|
"f5"
|
||||||
|
"fmt"
|
||||||
"q5"
|
"q5"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -12,14 +13,19 @@ func (cm *CacheMgr) LoadFromDB() {
|
|||||||
cm.loadAllGuildUserProfile()
|
cm.loadAllGuildUserProfile()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO 重加载数据,1000 迭代
|
||||||
|
var userTable = "gamedb2006_dev_1.t_user"
|
||||||
|
var friendShipsTable = "frienddb_dev_1.t_friend_ships"
|
||||||
|
var guildMembersTable = "frienddb_dev_1.t_guild_members"
|
||||||
|
|
||||||
func (cm *CacheMgr) loadAllFriendUserProfile() {
|
func (cm *CacheMgr) loadAllFriendUserProfile() {
|
||||||
sql := "SELECT account_id, name, head_id, head_frame, star_num, rank, last_login_time FROM ( SELECT account1_id AS account_id, name, head_id, head_frame, star_num, rank, last_login_time FROM frienddb_dev_1.t_friend_ships AS fs JOIN gamedb2006_dev_1.t_user AS u ON fs.account1_id = u.account_id UNION SELECT account2_id AS account_id, name, head_id, head_frame, star_num, rank, last_login_time FROM frienddb_dev_1.t_friend_ships AS fs JOIN gamedb2006_dev_1.t_user AS u ON fs.account2_id = u.account_id) AS friend_info_table;"
|
sql := fmt.Sprintf("SELECT account_id, name, head_id, head_frame, star_num, rank, last_login_time FROM ( SELECT account1_id AS account_id, name, head_id, head_frame, star_num, rank, last_login_time FROM %s AS fs JOIN %s AS u ON fs.account1_id = u.account_id UNION SELECT account2_id AS account_id, name, head_id, head_frame, star_num, rank, last_login_time FROM %s AS fs JOIN %s AS u ON fs.account2_id = u.account_id) AS friend_info_table;", friendShipsTable, userTable, friendShipsTable, userTable)
|
||||||
cm.loadUsersProfile(sql)
|
cm.loadUsersProfile(sql)
|
||||||
}
|
}
|
||||||
|
|
||||||
// loadGuildFromDB 加载公会成员信息
|
// loadGuildFromDB 加载公会成员信息
|
||||||
func (cm *CacheMgr) loadAllGuildUserProfile() {
|
func (cm *CacheMgr) loadAllGuildUserProfile() {
|
||||||
sql := "select a.account_id, a.name, a.head_id, a.head_frame, a.star_num, a.`rank`, a.last_login_time from gamedb2006_dev_1.t_user a,frienddb_dev_1.t_guild_members b where a.account_id = b.account_id"
|
sql := fmt.Sprintf("select a.account_id, a.name, a.head_id, a.head_frame, a.star_num, a.`rank`, a.last_login_time from %s a,%s b where a.account_id = b.account_id", userTable, guildMembersTable)
|
||||||
cm.loadUsersProfile(sql)
|
cm.loadUsersProfile(sql)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user