This commit is contained in:
aozhiwei 2024-04-08 19:29:16 +08:00
parent 79b9fd3b07
commit 819b2973c4
4 changed files with 66 additions and 20 deletions

View File

@ -97,12 +97,9 @@ type GuildMgr interface {
AsyncLeave(string, func(int32, string, []string))
AsyncKickout(string, string, func(int32, string))
AsyncDisband(string, func(int32, string, []string))
AsyncSetNotice(string, string, func(int32, string))
AsyncSetAvatar(string, string, func(int32, string))
AsyncSetName(string, string, func(int32, string))
AsyncSetJoinCond(string, string, func(int32, string))
AsyncSearch(string, string, func(int32, string))
AsyncGetGuildLogs(string, string, func(int32, string))
AsyncUpdateGuild(string, map[int32]string, func(int32, string))
}
type CacheMgr interface {

View File

@ -35,6 +35,14 @@ const (
GAME_ID = 2006
)
const (
GUILD_UPDATE_FIELD_NOTICE = iota
GUILD_UPDATE_FIELD_AVATAR
GUILD_UPDATE_FIELD_NAME
GUILD_UPDATE_FIELD_COND_TYPE
GUILD_UPDATE_FIELD_COND_VALUE
)
const (
MEMBER_LOCK_KEY = "member:"
GUILD_ID_LOCK_KEY = "guild_id:"

View File

@ -582,22 +582,6 @@ func (this *guildMgr) AsyncDisband(accountId string, cb func(int32, string, []st
})
}
func (this *guildMgr) AsyncSetNotice(string, string, func(int32, string)) {
}
func (this *guildMgr) AsyncSetAvatar(string, string, func(int32, string)) {
}
func (this *guildMgr) AsyncSetName(string, string, func(int32, string)) {
}
func (this *guildMgr) AsyncSetJoinCond(string, string, func(int32, string)) {
}
func (this *guildMgr) AsyncSearch(string, string, func(int32, string)) {
}
@ -606,6 +590,10 @@ func (this *guildMgr) AsyncGetGuildLogs(string, string, func(int32, string)) {
}
func (this *guildMgr) AsyncUpdateGuild(string, map[int32]string, func(int32, string)) {
}
func (this *guildMgr) asyncSetApplyStatus(accountId string, guildId string, status int32,
cb func(error, int64, int64)) {
f5.GetJsStyleDb().Update(

View File

@ -458,15 +458,68 @@ func (this *player) CMDisband(hdr *f5.MsgHdr, msg *cs.CMDisband) {
}
func (this *player) CMSetNotice(hdr *f5.MsgHdr, msg *cs.CMSetNotice) {
rspMsg := new(cs.SMSetNotice)
GetGuildMgr().AsyncUpdateGuild(
this.GetAccountId(),
map[int32]string{
constant.GUILD_UPDATE_FIELD_NOTICE: msg.GetContent(),
},
func (errCode int32, errMsg string) {
if errCode != 0 {
this.SendMsg(rspMsg.Err(errCode, errMsg))
return
}
this.SendMsg(rspMsg)
})
}
func (this *player) CMSetAvatar(hdr *f5.MsgHdr, msg *cs.CMSetAvatar) {
rspMsg := new(cs.SMSetAvatar)
GetGuildMgr().AsyncUpdateGuild(
this.GetAccountId(),
map[int32]string{
constant.GUILD_UPDATE_FIELD_AVATAR: q5.ToString(msg.GetAvatar()),
},
func (errCode int32, errMsg string) {
if errCode != 0 {
this.SendMsg(rspMsg.Err(errCode, errMsg))
return
}
this.SendMsg(rspMsg)
})
}
func (this *player) CMSetName(hdr *f5.MsgHdr, msg *cs.CMSetName) {
rspMsg := new(cs.SMSetName)
GetGuildMgr().AsyncUpdateGuild(
this.GetAccountId(),
map[int32]string{
constant.GUILD_UPDATE_FIELD_NAME: q5.ToString(msg.GetName()),
},
func (errCode int32, errMsg string) {
if errCode != 0 {
this.SendMsg(rspMsg.Err(errCode, errMsg))
return
}
this.SendMsg(rspMsg)
})
}
func (this *player) CMSetJoinCond(hdr *f5.MsgHdr, msg *cs.CMSetJoinCond) {
rspMsg := new(cs.SMSetJoinCond)
GetGuildMgr().AsyncUpdateGuild(
this.GetAccountId(),
map[int32]string{
constant.GUILD_UPDATE_FIELD_COND_TYPE: q5.ToString(msg.GetJoinCond()),
constant.GUILD_UPDATE_FIELD_COND_VALUE: q5.ToString(msg.GetJoinCondValue()),
},
func (errCode int32, errMsg string) {
if errCode != 0 {
this.SendMsg(rspMsg.Err(errCode, errMsg))
return
}
this.SendMsg(rspMsg)
})
}
func (this *player) CMGuildMembersList(hdr *f5.MsgHdr, msg *cs.CMGuildMembersList) {