This commit is contained in:
aozhiwei 2024-04-02 08:30:14 +08:00
parent d80ecef43d
commit 87489f09d3
3 changed files with 42 additions and 2 deletions

View File

@ -110,7 +110,7 @@ DROP TABLE IF EXISTS `t_guild`;
CREATE TABLE `t_guild` (
`idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id',
`guild_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '公会id',
`guld_name` varchar(48) NOT NULL,
`guild_name` varchar(48) NOT NULL,
`owner_id` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT '公会长',
`creator_id` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT '公会创始人',
`badge` int(11) DEFAULT '0' COMMENT '公会头像',

View File

@ -1,7 +1,8 @@
package guild
import (
"q5"
"f5"
)
type guild struct {
@ -25,3 +26,17 @@ func (this *guild) GetGuildId() string {
func (this *guild) GetGuildName() string {
return this.guildName
}
func (this *guild) loadFromDb(ds *f5.DataSet) {
this.guildId = ds.GetByName("guild_id")
this.guildName = ds.GetByName("guild_name")
this.ownerId = ds.GetByName("owner_id")
this.creatorId = ds.GetByName("creator_id")
this.badge = q5.ToInt32(ds.GetByName("badge"))
this.notice = ds.GetByName("notice")
this.joinCondType = q5.ToInt32(ds.GetByName("join_cond_type"))
this.joinCondVal = q5.ToInt32(ds.GetByName("join_cond_val"))
this.maxMemberNum = q5.ToInt32(ds.GetByName("max_members"))
this.createTime = q5.ToInt32(ds.GetByName("createtime"))
this.modifyTime = q5.ToInt32(ds.GetByName("modifytime"))
}

View File

@ -25,11 +25,36 @@ func (this *guildMgr) Init() {
this.idHash = make(map[string]*guild)
this.nameHash = make(map[string]*guild)
this.accountIdHash = make(map[string]*guild)
this.loadFromDB()
}
func (this *guildMgr) UnInit() {
}
func (this *guildMgr) loadFromDB() {
/*
f5.GetSysLog().Info("friendMgr.loadFriendships begin")
lastIdx := f5.GetJsStyleDb().SyncBatchLoadFullTable(
constant.FRIEND_DB,
"SELECT * FROM t_guild idx > %d AND deleted = 0",
func (ds *f5.DataSet) {
guildId := ds.GetByName("guild_id")
guildName := ds.GetByName("guild_name")
ownerId := q5.ToInt32(ds.GetByName("owner_id"))
//this.addFriendShip(accountId1, accountId2, addTime)
},
func (err error) {
panic(fmt.Sprintf("friendMgr.loadFriendships dberror:%s", err))
})
*/
/*
f5.GetSysLog().Info("friendMgr.loadFriendships end lastIdx:%d friendNum:%d blackNum:%d",
lastIdx,
len(this.friendHash),
len(this.blackHash))
*/
}
func (this *guildMgr) isNameTooLong(name string, maxNum int) bool {
return len(name) > maxNum
}