Add 解散公会
This commit is contained in:
parent
5f4c6ffe63
commit
449e9f9df3
@ -2359,7 +2359,7 @@ type CMPromoteMember struct {
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
GuildId *int64 `protobuf:"varint,1,opt,name=guild_id,json=guildId" json:"guild_id,omitempty"`
|
||||
PromoteAccountId *string `protobuf:"bytes,2,opt,name=PromoteAccountId" json:"PromoteAccountId,omitempty"`
|
||||
PromoteAccountId *string `protobuf:"bytes,2,opt,name=promoteAccountId" json:"promoteAccountId,omitempty"`
|
||||
}
|
||||
|
||||
func (x *CMPromoteMember) Reset() {
|
||||
@ -2463,7 +2463,7 @@ type CMDemoteMember struct {
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
GuildId *int64 `protobuf:"varint,1,opt,name=guild_id,json=guildId" json:"guild_id,omitempty"`
|
||||
DemoteAccountId *string `protobuf:"bytes,2,opt,name=DemoteAccountId" json:"DemoteAccountId,omitempty"`
|
||||
DemoteAccountId *string `protobuf:"bytes,2,opt,name=demoteAccountId" json:"demoteAccountId,omitempty"`
|
||||
}
|
||||
|
||||
func (x *CMDemoteMember) Reset() {
|
||||
@ -3019,16 +3019,16 @@ var file_cs_proto_proto_rawDesc = []byte{
|
||||
0x22, 0x58, 0x0a, 0x0f, 0x43, 0x4d, 0x50, 0x72, 0x6f, 0x6d, 0x6f, 0x74, 0x65, 0x4d, 0x65, 0x6d,
|
||||
0x62, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x67, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x69, 0x64, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x67, 0x75, 0x69, 0x6c, 0x64, 0x49, 0x64, 0x12, 0x2a,
|
||||
0x0a, 0x10, 0x50, 0x72, 0x6f, 0x6d, 0x6f, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74,
|
||||
0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x50, 0x72, 0x6f, 0x6d, 0x6f, 0x74,
|
||||
0x0a, 0x10, 0x70, 0x72, 0x6f, 0x6d, 0x6f, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74,
|
||||
0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x70, 0x72, 0x6f, 0x6d, 0x6f, 0x74,
|
||||
0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, 0x22, 0x2a, 0x0a, 0x0f, 0x53, 0x4d,
|
||||
0x50, 0x72, 0x6f, 0x6d, 0x6f, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x17, 0x0a,
|
||||
0x07, 0x65, 0x72, 0x72, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06,
|
||||
0x65, 0x72, 0x72, 0x4d, 0x73, 0x67, 0x22, 0x55, 0x0a, 0x0e, 0x43, 0x4d, 0x44, 0x65, 0x6d, 0x6f,
|
||||
0x74, 0x65, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x67, 0x75, 0x69, 0x6c,
|
||||
0x64, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x67, 0x75, 0x69, 0x6c,
|
||||
0x64, 0x49, 0x64, 0x12, 0x28, 0x0a, 0x0f, 0x44, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x41, 0x63, 0x63,
|
||||
0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x44, 0x65,
|
||||
0x64, 0x49, 0x64, 0x12, 0x28, 0x0a, 0x0f, 0x64, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x41, 0x63, 0x63,
|
||||
0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x64, 0x65,
|
||||
0x6d, 0x6f, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, 0x22, 0x29, 0x0a,
|
||||
0x0e, 0x53, 0x4d, 0x44, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x12,
|
||||
0x17, 0x0a, 0x07, 0x65, 0x72, 0x72, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||
|
@ -48,9 +48,7 @@ func (gm *GuildMgr) loadGuildFromDBResult(err error, rows *f5.DataSet) {
|
||||
// init pendingReqs
|
||||
gm.pendingReqs[guildId] = make(map[string]bool)
|
||||
}
|
||||
|
||||
fmt.Printf("loadGuildFromDB %v, len:%d\n", gm.Guilds, len(gm.Guilds))
|
||||
fmt.Printf("loadGuildFromDB Finished")
|
||||
fmt.Printf("loadGuildFromDB finished guilds:%d\n", len(gm.Guilds))
|
||||
}
|
||||
|
||||
// loadGuildMemberFromDB 加载公会成员
|
||||
@ -99,7 +97,7 @@ func (gm *GuildMgr) loadGuildMemberFromDBResult(err error, rows *f5.DataSet) {
|
||||
func (gm *GuildMgr) loadPendingReqsFromDB() {
|
||||
fields := []string{"guild_id", "account_id"}
|
||||
where := [][]string{
|
||||
{"flag", "0"},
|
||||
{"is_join_guild", "0"},
|
||||
}
|
||||
f5.GetJsStyleDb().Select(
|
||||
FRIEND_DB,
|
||||
@ -176,6 +174,29 @@ func (gm *GuildMgr) insertPendingReqs(guildId int64, applicantAccountId string)
|
||||
)
|
||||
}
|
||||
|
||||
// updatePendingReqs 更新所有申请加入公会记录
|
||||
func (gm *GuildMgr) updateAllPendingReqs(guildId int64, isJoinGuild int) {
|
||||
fields := [][]string{
|
||||
{"is_join_guild", q5.ToString(isJoinGuild)},
|
||||
}
|
||||
where := [][]string{
|
||||
{"guild_id", q5.ToString(guildId)},
|
||||
}
|
||||
f5.GetJsStyleDb().Update(
|
||||
FRIEND_DB,
|
||||
"t_guild_pending_request",
|
||||
fields,
|
||||
where,
|
||||
func(err error, lastInsertId int64, rowsAffected int64) {
|
||||
if err != nil {
|
||||
fmt.Printf("error:%v\n", err)
|
||||
}
|
||||
fmt.Printf("lastInsertId:%d\n", lastInsertId)
|
||||
fmt.Printf("rowsAffected:%d\n", rowsAffected)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
// updatePendingReqs 更新申请加入公会记录
|
||||
func (gm *GuildMgr) updatePendingReqs(guildId int64, applicantAccountId string, isJoinGuild int) {
|
||||
fields := [][]string{
|
||||
@ -222,16 +243,32 @@ func (gm *GuildMgr) insertGuildMember(guildId int64, member *GuildMember) {
|
||||
)
|
||||
}
|
||||
|
||||
// updateGuildMember 更新成员信息
|
||||
func (gm *GuildMgr) updateGuildMember(g *Guild, fields [][]string, newWhere []string) {
|
||||
func (gm *GuildMgr) updateGuildMembers(g *Guild, fields [][]string) {
|
||||
where := [][]string{
|
||||
{"guild_id", q5.ToString(g.GuildId)},
|
||||
}
|
||||
if len(newWhere) > 0 {
|
||||
where = append(where, newWhere)
|
||||
}
|
||||
f5.GetJsStyleDb().Update(
|
||||
FRIEND_DB,
|
||||
"t_guild_members",
|
||||
fields,
|
||||
where,
|
||||
func(err error, lastInsertId int64, rowsAffected int64) {
|
||||
if err != nil {
|
||||
fmt.Printf("error:%v\n", err)
|
||||
}
|
||||
fmt.Printf("lastInsertId:%d\n", lastInsertId)
|
||||
fmt.Printf("rowsAffected:%d\n", rowsAffected)
|
||||
},
|
||||
)
|
||||
|
||||
fmt.Printf("where:%v \n", where)
|
||||
}
|
||||
|
||||
// updateGuildMember 更新成员信息
|
||||
func (gm *GuildMgr) updateGuildMember(g *Guild, accountId string, fields [][]string) {
|
||||
where := [][]string{
|
||||
{"guild_id", q5.ToString(g.GuildId)},
|
||||
{"account_id", accountId},
|
||||
}
|
||||
|
||||
f5.GetJsStyleDb().Update(
|
||||
FRIEND_DB,
|
||||
|
@ -25,7 +25,6 @@ func NewGuildMgr() *GuildMgr {
|
||||
|
||||
func (gm *GuildMgr) init() {
|
||||
gm.pendingReqs = make(map[int64]map[string]bool)
|
||||
|
||||
// 加载公会
|
||||
gm.loadGuildFromDB()
|
||||
// 加载公会成员
|
||||
@ -173,8 +172,7 @@ func (gm *GuildMgr) LeaveGuild(guildId int64, accountId string) error {
|
||||
|
||||
_ = guild.RemoveMember(accountId)
|
||||
fields := [][]string{{"is_leave_guild", q5.ToString(1)}}
|
||||
where := []string{"account_id", q5.ToString(member.AccountId)}
|
||||
gm.updateGuildMember(guild, fields, where)
|
||||
gm.updateGuildMember(guild, member.AccountId, fields)
|
||||
|
||||
return nil
|
||||
}
|
||||
@ -211,8 +209,7 @@ func (gm *GuildMgr) DismissMember(guildId int64, operatorAccountId, accountId st
|
||||
|
||||
_ = guild.RemoveMember(accountId)
|
||||
fields := [][]string{{"is_leave_guild", q5.ToString(1)}}
|
||||
where := []string{"account_id", q5.ToString(dismissMember.AccountId)}
|
||||
gm.updateGuildMember(guild, fields, where)
|
||||
gm.updateGuildMember(guild, dismissMember.AccountId, fields)
|
||||
|
||||
return nil
|
||||
}
|
||||
@ -228,16 +225,25 @@ func (gm *GuildMgr) PromoteMember(guildId int64, operatorAccountId, accountId st
|
||||
return fmt.Errorf("cannot promote the leader")
|
||||
}
|
||||
|
||||
// 会长仅可操作
|
||||
operatorPermLevel := 1
|
||||
err := gm.checkOperatorPerm(guild, operatorAccountId, operatorPermLevel)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
member, err := guild.GetMember(accountId)
|
||||
if err != nil {
|
||||
return fmt.Errorf("member not found in the guild")
|
||||
}
|
||||
newLevel := 2
|
||||
member.Level = newLevel
|
||||
if member.Level == newLevel {
|
||||
return nil
|
||||
}
|
||||
|
||||
member.Level = newLevel
|
||||
fields := [][]string{{"level", q5.ToString(newLevel)}}
|
||||
where := []string{"account_id", q5.ToString(member.AccountId)}
|
||||
gm.updateGuildMember(guild, fields, where)
|
||||
gm.updateGuildMember(guild, member.AccountId, fields)
|
||||
|
||||
return nil
|
||||
}
|
||||
@ -253,15 +259,25 @@ func (gm *GuildMgr) DemoteMember(guildId int64, operatorAccountId, accountId str
|
||||
return fmt.Errorf("cannot demote the leader")
|
||||
}
|
||||
|
||||
// 会长仅可操作
|
||||
operatorPermLevel := 1
|
||||
err := gm.checkOperatorPerm(guild, operatorAccountId, operatorPermLevel)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
member, err := guild.GetMember(accountId)
|
||||
if err != nil {
|
||||
return fmt.Errorf("member not found in the guild")
|
||||
}
|
||||
|
||||
newLevel := 3
|
||||
if member.Level == newLevel {
|
||||
return nil
|
||||
}
|
||||
member.Level = newLevel
|
||||
fields := [][]string{{"level", q5.ToString(newLevel)}}
|
||||
where := []string{"account_id", q5.ToString(member.AccountId)}
|
||||
gm.updateGuildMember(guild, fields, where)
|
||||
gm.updateGuildMember(guild, member.AccountId, fields)
|
||||
|
||||
return nil
|
||||
}
|
||||
@ -288,6 +304,7 @@ func (gm *GuildMgr) Disband(guildId int64, accountId string) error {
|
||||
return fmt.Errorf("guild not found")
|
||||
}
|
||||
|
||||
// 会长仅可操作
|
||||
if accountId != guild.LeaderId {
|
||||
return fmt.Errorf("cannot disband guild")
|
||||
}
|
||||
@ -300,9 +317,11 @@ func (gm *GuildMgr) Disband(guildId int64, accountId string) error {
|
||||
}
|
||||
gm.updateGuild(guild, updateFields)
|
||||
|
||||
fields := [][]string{{"is_deleted", q5.ToString(1)}}
|
||||
var where []string
|
||||
gm.updateGuildMember(guild, fields, where)
|
||||
fields := [][]string{{"is_leave_guild", q5.ToString(1)}}
|
||||
gm.updateGuildMembers(guild, fields)
|
||||
|
||||
is_join_guild := 3
|
||||
gm.updateAllPendingReqs(guildId, is_join_guild)
|
||||
|
||||
// 确保在删除之前没有其他地方引用了公会对象的指针, 以避免空指针异常
|
||||
gm.Guilds[guildId] = nil
|
||||
|
@ -26,7 +26,7 @@ func (p *Player) CMSearchUser(hdr *f5.MsgHdr, msg *cs.CMSearchUser) {
|
||||
}
|
||||
rspMsg.Users = append(rspMsg.Users, friend)
|
||||
}
|
||||
fmt.Printf("length%d \n", len(rspMsg.Users))
|
||||
f5.GetSysLog().Info("CMSearchUser user count:%d\n", len(rspMsg.Users))
|
||||
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
}
|
||||
@ -38,7 +38,7 @@ func (p *Player) CMSearchUserByAccountId(hdr *f5.MsgHdr, msg *cs.CMSearchUserByA
|
||||
if user != nil {
|
||||
rspMsg.AccountId = &user.AccountId
|
||||
rspMsg.Username = &user.Username
|
||||
fmt.Printf("search result: accountId:%s \n", *rspMsg.AccountId)
|
||||
f5.GetSysLog().Info("CMSearchUserByAccountId search result: %s\n", *rspMsg.AccountId)
|
||||
}
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
}
|
||||
@ -54,7 +54,8 @@ func (p *Player) CMAddFriendRequest(hdr *f5.MsgHdr, msg *cs.CMAddFriendRequest)
|
||||
reason := err.Error()
|
||||
rspMsg.Reason = &reason
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
f5.GetSysLog().Info("CMAddFriendRequest: reason:%s, params: %s or %s\n", reason, user1Id, user2Id)
|
||||
|
||||
f5.GetSysLog().Info("CMAddFriendRequest err:%s, params: %s or %s\n", reason, user1Id, user2Id)
|
||||
return
|
||||
}
|
||||
|
||||
@ -74,7 +75,8 @@ func (p *Player) CMAcceptFriendRequest(hdr *f5.MsgHdr, msg *cs.CMAcceptFriendReq
|
||||
reason := err.Error()
|
||||
rspMsg.Reason = &reason
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
f5.GetSysLog().Info("CMAcceptFriendRequest: reason:%s, params: %s or %s\n", reason, user1Id, user2Id)
|
||||
|
||||
f5.GetSysLog().Info("CMAcceptFriendRequest err:%s, params: %s or %s\n", reason, user1Id, user2Id)
|
||||
return
|
||||
}
|
||||
|
||||
@ -94,7 +96,8 @@ func (p *Player) CMRejectFriendRequest(hdr *f5.MsgHdr, msg *cs.CMRejectFriendReq
|
||||
reason := err.Error()
|
||||
rspMsg.Reason = &reason
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
f5.GetSysLog().Info("CMAcceptFriendRequest: reason:%s, params: %s or %s\n", reason, user1Id, user2Id)
|
||||
|
||||
f5.GetSysLog().Info("CMAcceptFriendRequest err:%s, params: %s or %s\n", reason, user1Id, user2Id)
|
||||
return
|
||||
}
|
||||
|
||||
@ -151,7 +154,7 @@ func (p *Player) CMDeleteFriendShip(hdr *f5.MsgHdr, msg *cs.CMDeleteFriendShip)
|
||||
reason := err.Error()
|
||||
rspMsg.Reason = &reason
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
f5.GetSysLog().Info("CMDeleteFriendShip: reason:%s, params: %s or %s\n", reason, user1Id, user2Id)
|
||||
f5.GetSysLog().Info("CMDeleteFriendShip err:%s, params: %s or %s\n", reason, user1Id, user2Id)
|
||||
return
|
||||
}
|
||||
|
||||
@ -199,6 +202,8 @@ func (p *Player) CMCreateGuild(hdr *f5.MsgHdr, msg *cs.CMCreateGuild) {
|
||||
if err != nil {
|
||||
errMsg := err.Error()
|
||||
rspMsg.ErrMsg = &errMsg
|
||||
|
||||
f5.GetSysLog().Info("CMCreateGuild err:%s\n", errMsg)
|
||||
} else {
|
||||
rspMsg.GuildId = &guildId
|
||||
}
|
||||
@ -209,15 +214,15 @@ func (p *Player) CMCreateGuild(hdr *f5.MsgHdr, msg *cs.CMCreateGuild) {
|
||||
// CMApplyToGuild 同意申请者加入公会
|
||||
func (p *Player) CMApplyToGuild(hdr *f5.MsgHdr, msg *cs.CMApplyToGuild) {
|
||||
rspMsg := new(cs.SMApplyToGuild)
|
||||
guildId := msg.GetGuildId()
|
||||
err := guildMgr.ApplyToGuild(
|
||||
msg.GetGuildId(),
|
||||
p.accountId,
|
||||
)
|
||||
fmt.Printf("CMApplyToGuild:%v \n", guildId)
|
||||
if err != nil {
|
||||
errMsg := err.Error()
|
||||
rspMsg.ErrMsg = &errMsg
|
||||
|
||||
f5.GetSysLog().Info("CMApplyToGuild err:%s\n", errMsg)
|
||||
}
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
}
|
||||
@ -225,17 +230,16 @@ func (p *Player) CMApplyToGuild(hdr *f5.MsgHdr, msg *cs.CMApplyToGuild) {
|
||||
// CMApprove 同意申请者加入公会
|
||||
func (p *Player) CMApprove(hdr *f5.MsgHdr, msg *cs.CMApprove) {
|
||||
rspMsg := new(cs.SMApprove)
|
||||
guildId := msg.GetGuildId()
|
||||
applicantAccountId := msg.GetApplicantAccountId()
|
||||
err := guildMgr.Approve(
|
||||
msg.GetGuildId(),
|
||||
p.accountId,
|
||||
applicantAccountId,
|
||||
)
|
||||
fmt.Printf("CMApprove:%v \n", guildId)
|
||||
if err != nil {
|
||||
errMsg := err.Error()
|
||||
rspMsg.ErrMsg = &errMsg
|
||||
f5.GetSysLog().Info("CMApprove err:%s\n", errMsg)
|
||||
}
|
||||
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
@ -244,16 +248,15 @@ func (p *Player) CMApprove(hdr *f5.MsgHdr, msg *cs.CMApprove) {
|
||||
// CMReject 拒绝申请者加入公会
|
||||
func (p *Player) CMReject(hdr *f5.MsgHdr, msg *cs.CMReject) {
|
||||
rspMsg := new(cs.SMReject)
|
||||
guildId := msg.GetGuildId()
|
||||
applicantAccountId := msg.GetApplicantAccountId()
|
||||
err := guildMgr.Reject(
|
||||
msg.GetGuildId(),
|
||||
applicantAccountId,
|
||||
)
|
||||
fmt.Printf("CMReject:%v \n", guildId)
|
||||
if err != nil {
|
||||
errMsg := err.Error()
|
||||
rspMsg.ErrMsg = &errMsg
|
||||
f5.GetSysLog().Info("CMReject err:%s\n", errMsg)
|
||||
}
|
||||
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
@ -268,10 +271,10 @@ func (p *Player) CMLeaveGuild(hdr *f5.MsgHdr, msg *cs.CMLeaveGuild) {
|
||||
guildId,
|
||||
p.accountId,
|
||||
)
|
||||
fmt.Printf("CMLeaveGuild:%v \n", guildId)
|
||||
if err != nil {
|
||||
errMsg := err.Error()
|
||||
rspMsg.ErrMsg = &errMsg
|
||||
f5.GetSysLog().Info("CMLeaveGuild err:%s\n", errMsg)
|
||||
}
|
||||
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
@ -280,17 +283,15 @@ func (p *Player) CMLeaveGuild(hdr *f5.MsgHdr, msg *cs.CMLeaveGuild) {
|
||||
// CMDismissMember 开除成员
|
||||
func (p *Player) CMDismissMember(hdr *f5.MsgHdr, msg *cs.CMDismissMember) {
|
||||
rspMsg := new(cs.SMDismissMember)
|
||||
|
||||
guildId := msg.GetGuildId()
|
||||
err := guildMgr.DismissMember(
|
||||
msg.GetGuildId(),
|
||||
p.accountId,
|
||||
msg.GetDismissAccountId(),
|
||||
)
|
||||
fmt.Printf("CMDismissMember:%v \n", guildId)
|
||||
if err != nil {
|
||||
errMsg := err.Error()
|
||||
rspMsg.ErrMsg = &errMsg
|
||||
f5.GetSysLog().Info("CMDismissMember err:%s\n", errMsg)
|
||||
}
|
||||
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
@ -299,17 +300,15 @@ func (p *Player) CMDismissMember(hdr *f5.MsgHdr, msg *cs.CMDismissMember) {
|
||||
// CMPromoteMember 提升成员为干部
|
||||
func (p *Player) CMPromoteMember(hdr *f5.MsgHdr, msg *cs.CMPromoteMember) {
|
||||
rspMsg := new(cs.SMPromoteMember)
|
||||
|
||||
guildId := msg.GetGuildId()
|
||||
err := guildMgr.PromoteMember(
|
||||
msg.GetGuildId(),
|
||||
p.accountId,
|
||||
msg.GetPromoteAccountId(),
|
||||
)
|
||||
fmt.Printf("CMPromoteMember:%v \n", guildId)
|
||||
if err != nil {
|
||||
errMsg := err.Error()
|
||||
rspMsg.ErrMsg = &errMsg
|
||||
f5.GetSysLog().Info("CMPromoteMember err:%s\n", errMsg)
|
||||
}
|
||||
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
@ -318,35 +317,30 @@ func (p *Player) CMPromoteMember(hdr *f5.MsgHdr, msg *cs.CMPromoteMember) {
|
||||
// CMDemoteMember 解除成员干部身份
|
||||
func (p *Player) CMDemoteMember(hdr *f5.MsgHdr, msg *cs.CMDemoteMember) {
|
||||
rspMsg := new(cs.SMDemoteMember)
|
||||
|
||||
guildId := msg.GetGuildId()
|
||||
err := guildMgr.PromoteMember(
|
||||
err := guildMgr.DemoteMember(
|
||||
msg.GetGuildId(),
|
||||
p.accountId,
|
||||
msg.GetDemoteAccountId(),
|
||||
)
|
||||
fmt.Printf("CMDemoteMember:%v \n", guildId)
|
||||
if err != nil {
|
||||
errMsg := err.Error()
|
||||
rspMsg.ErrMsg = &errMsg
|
||||
f5.GetSysLog().Info("CMDemoteMember err:%s\n", errMsg)
|
||||
}
|
||||
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
}
|
||||
|
||||
// CMDisband 解散公会
|
||||
func (p *Player) CMDisband(hdr *f5.MsgHdr, msg *cs.CMDisband) {
|
||||
rspMsg := new(cs.SMDisband)
|
||||
|
||||
guildId := msg.GetGuildId()
|
||||
err := guildMgr.Disband(
|
||||
msg.GetGuildId(),
|
||||
p.accountId,
|
||||
)
|
||||
fmt.Printf("CMDisband:%v \n", guildId)
|
||||
if err != nil {
|
||||
errMsg := err.Error()
|
||||
rspMsg.ErrMsg = &errMsg
|
||||
f5.GetSysLog().Info("CMDisband err:%s\n", errMsg)
|
||||
}
|
||||
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
@ -356,7 +350,7 @@ func (p *Player) CMDisband(hdr *f5.MsgHdr, msg *cs.CMDisband) {
|
||||
func (p *Player) CMSearchGuilds(hdr *f5.MsgHdr, msg *cs.CMSearchGuilds) {
|
||||
rspMsg := new(cs.SMSearchGuilds)
|
||||
rspMsg.Guilds = p.FillGuild(guildMgr.SearchGuilds(msg.GetKeyword()))
|
||||
fmt.Printf("CMSearchGuilds keyword[%s], result:%d \n", msg.GetKeyword(), len(rspMsg.Guilds))
|
||||
f5.GetSysLog().Info("CMSearchGuilds keyword[%s], result:%d \n", msg.GetKeyword(), len(rspMsg.Guilds))
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
}
|
||||
|
||||
|
@ -322,7 +322,7 @@ message SMDismissMember
|
||||
message CMPromoteMember
|
||||
{
|
||||
optional int64 guild_id = 1;
|
||||
optional string PromoteAccountId = 2;
|
||||
optional string promoteAccountId = 2;
|
||||
}
|
||||
|
||||
// 回复提升成员为干部
|
||||
@ -335,7 +335,7 @@ message SMPromoteMember
|
||||
message CMDemoteMember
|
||||
{
|
||||
optional int64 guild_id = 1;
|
||||
optional string DemoteAccountId = 2;
|
||||
optional string demoteAccountId = 2;
|
||||
}
|
||||
|
||||
// 回复解除成员干部身份
|
||||
|
2
third_party/f5
vendored
2
third_party/f5
vendored
@ -1 +1 @@
|
||||
Subproject commit 1055774a44c216387425d5e1025e89dc052fb30a
|
||||
Subproject commit f5fd0f9309b257f55e0a5588d5f018546a1b8bd0
|
Loading…
x
Reference in New Issue
Block a user