This commit is contained in:
aozhiwei 2024-04-20 17:46:13 +08:00
parent 166ec772b0
commit 2ee50c6d3d
3 changed files with 27 additions and 2 deletions

View File

@ -112,7 +112,7 @@ type GuildMgr interface {
AsyncSetGuildJob(string, string, int32, func(int32, string, string, string)) AsyncSetGuildJob(string, string, int32, func(int32, string, string, string))
AsyncSearch(int64, string, func(int32, string, int64, []string)) AsyncSearch(int64, string, func(int32, string, int64, []string))
AsyncGetGuildLogs(string, string, func(int32, string)) AsyncGetGuildLogs(string, string, func(int32, string))
AsyncUpdateGuild(string, map[int32]string, func(int32, string)) AsyncUpdateGuild(string, string, map[int32]string, func(int32, string))
NotifyGuildMsg(string, proto.Message) NotifyGuildMsg(string, proto.Message)
} }

View File

@ -674,7 +674,8 @@ func (this *guildMgr) AsyncGetGuildLogs(string, string, func(int32, string)) {
} }
func (this *guildMgr) AsyncUpdateGuild(accountId string, kv map[int32]string, cb func(int32, string)) { func (this *guildMgr) AsyncUpdateGuild(accountId string, sessionId string, kv map[int32]string,
cb func(int32, string)) {
guild := this.internalGetGuildByAccountId(accountId) guild := this.internalGetGuildByAccountId(accountId)
if guild == nil { if guild == nil {
cb(1, "You don't have a cube yet") cb(1, "You don't have a cube yet")
@ -744,6 +745,26 @@ func (this *guildMgr) AsyncUpdateGuild(accountId string, kv map[int32]string, cb
}) })
} }
if _, ok := kv[constant.GUILD_UPDATE_FIELD_NAME]; ok { if _, ok := kv[constant.GUILD_UPDATE_FIELD_NAME]; ok {
params := map[string]string{
"c": "Bag",
"a": "useItem",
"account_id": accountId,
"session_id": sessionId,
}
url := fmt.Sprintf("%s/webapp/index.php", mt.Table.Config.GetById(0).GetGameapiUrl())
rspObj := new(common.LoginRsp)
f5.GetHttpCliMgr().SendJsStyleJsonRspRequest(
url,
params,
&rspObj,
func(rsp f5.HttpCliResponse) {
if rsp.GetErr() == nil && rsp.JsonParseOk() {
doFunc()
} else {
cb(4, "cube rename card not enough")
return
}
})
} else { } else {
doFunc() doFunc()
} }

View File

@ -741,6 +741,7 @@ func (this *player) CMSetNotice(hdr *f5.MsgHdr, msg *cs.CMSetNotice) {
rspMsg := new(cs.SMSetNotice) rspMsg := new(cs.SMSetNotice)
GetGuildMgr().AsyncUpdateGuild( GetGuildMgr().AsyncUpdateGuild(
this.GetAccountId(), this.GetAccountId(),
this.GetSessionId(),
map[int32]string{ map[int32]string{
constant.GUILD_UPDATE_FIELD_NOTICE: msg.GetContent(), constant.GUILD_UPDATE_FIELD_NOTICE: msg.GetContent(),
}, },
@ -757,6 +758,7 @@ func (this *player) CMSetAvatar(hdr *f5.MsgHdr, msg *cs.CMSetAvatar) {
rspMsg := new(cs.SMSetAvatar) rspMsg := new(cs.SMSetAvatar)
GetGuildMgr().AsyncUpdateGuild( GetGuildMgr().AsyncUpdateGuild(
this.GetAccountId(), this.GetAccountId(),
this.GetSessionId(),
map[int32]string{ map[int32]string{
constant.GUILD_UPDATE_FIELD_AVATAR: q5.ToString(msg.GetAvatar()), constant.GUILD_UPDATE_FIELD_AVATAR: q5.ToString(msg.GetAvatar()),
}, },
@ -773,6 +775,7 @@ func (this *player) CMSetName(hdr *f5.MsgHdr, msg *cs.CMSetName) {
rspMsg := new(cs.SMSetName) rspMsg := new(cs.SMSetName)
GetGuildMgr().AsyncUpdateGuild( GetGuildMgr().AsyncUpdateGuild(
this.GetAccountId(), this.GetAccountId(),
this.GetSessionId(),
map[int32]string{ map[int32]string{
constant.GUILD_UPDATE_FIELD_NAME: q5.ToString(msg.GetName()), constant.GUILD_UPDATE_FIELD_NAME: q5.ToString(msg.GetName()),
}, },
@ -789,6 +792,7 @@ func (this *player) CMSetJoinCond(hdr *f5.MsgHdr, msg *cs.CMSetJoinCond) {
rspMsg := new(cs.SMSetJoinCond) rspMsg := new(cs.SMSetJoinCond)
GetGuildMgr().AsyncUpdateGuild( GetGuildMgr().AsyncUpdateGuild(
this.GetAccountId(), this.GetAccountId(),
this.GetSessionId(),
map[int32]string{ map[int32]string{
constant.GUILD_UPDATE_FIELD_COND_TYPE: q5.ToString(msg.GetJoinCond()), constant.GUILD_UPDATE_FIELD_COND_TYPE: q5.ToString(msg.GetJoinCond()),
constant.GUILD_UPDATE_FIELD_COND_VALUE: q5.ToString(msg.GetJoinCondValue()), constant.GUILD_UPDATE_FIELD_COND_VALUE: q5.ToString(msg.GetJoinCondValue()),