save
This commit is contained in:
parent
86df80be84
commit
f6730e9cde
@ -40,11 +40,7 @@ func (cm *CacheMgr) GetProfileByAccountId(accountId string, cb func(err error, p
|
||||
}
|
||||
if rows.Next() {
|
||||
aId := q5.ToString(*rows.GetByIndex(0))
|
||||
player := playerMgr.GetPlayerByAccountId(aId)
|
||||
var onlineStatue int32 = 0
|
||||
if player != nil {
|
||||
onlineStatue = 1
|
||||
}
|
||||
onlineStatue := playerMgr.GetOnlineStatus(aId)
|
||||
profile := &PlayerProfile{
|
||||
AccountId: q5.ToString(*rows.GetByIndex(0)),
|
||||
Username: q5.ToString(*rows.GetByIndex(1)),
|
||||
@ -73,11 +69,7 @@ func (cm *CacheMgr) loadUsersProfile(sql string) {
|
||||
}
|
||||
for rows.Next() {
|
||||
accountId := q5.ToString(*rows.GetByIndex(0))
|
||||
player := playerMgr.GetPlayerByAccountId(accountId)
|
||||
var onlineStatue int32 = 0
|
||||
if player != nil {
|
||||
onlineStatue = 1
|
||||
}
|
||||
onlineStatus := playerMgr.GetOnlineStatus(accountId)
|
||||
profile := &PlayerProfile{
|
||||
AccountId: accountId,
|
||||
Username: q5.ToString(*rows.GetByIndex(1)),
|
||||
@ -86,7 +78,7 @@ func (cm *CacheMgr) loadUsersProfile(sql string) {
|
||||
Star: q5.ToInt32(*rows.GetByIndex(4)),
|
||||
Rank: q5.ToInt32(*rows.GetByIndex(5)),
|
||||
LastLoginTime: q5.ToInt32(*rows.GetByIndex(6)),
|
||||
OnlineStatus: onlineStatue,
|
||||
OnlineStatus: onlineStatus,
|
||||
}
|
||||
cm.AddCacheProfile(1, profile)
|
||||
}
|
||||
|
@ -56,8 +56,7 @@ const (
|
||||
LogTypeApprove = 1 // 公会日志类型, 批准加入
|
||||
LogTypeLeave = 2
|
||||
LogTypeDismiss = 3
|
||||
LogTypePromote = 4
|
||||
LogTypeDemote = 5
|
||||
LogTypeChangeLevel = 4
|
||||
LogTypeDisband = 6
|
||||
GuildMemberLevelLeader = 1 // 成员等级, 会长
|
||||
GuildMemberLevelViceLeader = 20 // 成员等级, 副会长
|
||||
@ -80,8 +79,6 @@ const (
|
||||
EVENT_JOIN = "event_join"
|
||||
EVENT_LEAVE = "event_leave"
|
||||
EVENT_DISMISS_MEMBER = "event_dismiss_member"
|
||||
EVENT_PROMOTE_MEMBER = "event_promote_member"
|
||||
EVENT_DEMOTE_MEMBER = "event_demote_member"
|
||||
EVENT_SET_MEMBER_LEVEL = "event_set_member_level"
|
||||
EVENT_DISBAND = "event_disband"
|
||||
EVENT_SET_NOTICE = "event_set_notice"
|
||||
@ -119,7 +116,6 @@ const (
|
||||
ERR_CODE_GUILD_BLOCKED_LEADER = 12009
|
||||
ERR_CODE_GUILD_OPERATOR_MEMBER_NO_PERM = 12010
|
||||
ERR_CODE_GUILD_DISMISS_MEMBER_NO_PERM = 12011
|
||||
ERR_CODE_GUILD_DEMOTE_MEMBER_OK = 12012
|
||||
ERR_CODE_CREATE_GUILD_DB_FAIL = 12013
|
||||
ERR_CODE_CREATE_GUILD_MEMBER_DB_FAIL = 12014
|
||||
ERR_CODE_UPDATE_GUILD_DB_FAIL = 12015
|
||||
|
@ -63,8 +63,6 @@ type MsgHandler interface {
|
||||
CMLeaveGuild(*f5.MsgHdr, *CMLeaveGuild)
|
||||
CMDismissMember(*f5.MsgHdr, *CMDismissMember)
|
||||
CMSetMemberLevel(*f5.MsgHdr, *CMSetMemberLevel)
|
||||
CMPromoteMember(*f5.MsgHdr, *CMPromoteMember)
|
||||
CMDemoteMember(*f5.MsgHdr, *CMDemoteMember)
|
||||
CMGuildMembersList(*f5.MsgHdr, *CMGuildMembersList)
|
||||
CMDisband(*f5.MsgHdr, *CMDisband)
|
||||
CMSearchGuilds(*f5.MsgHdr, *CMSearchGuilds)
|
||||
@ -159,12 +157,6 @@ func (this *MsgHandlerImpl) CMDismissMember(hdr *f5.MsgHdr, msg *CMDismissMember
|
||||
func (this *MsgHandlerImpl) CMSetMemberLevel(hdr *f5.MsgHdr, msg *CMSetMemberLevel) {
|
||||
}
|
||||
|
||||
func (this *MsgHandlerImpl) CMPromoteMember(hdr *f5.MsgHdr, msg *CMPromoteMember) {
|
||||
}
|
||||
|
||||
func (this *MsgHandlerImpl) CMDemoteMember(hdr *f5.MsgHdr, msg *CMDemoteMember) {
|
||||
}
|
||||
|
||||
func (this *MsgHandlerImpl) CMGuildMembersList(hdr *f5.MsgHdr, msg *CMGuildMembersList) {
|
||||
}
|
||||
|
||||
@ -425,22 +417,6 @@ func (this *SMSetMemberLevel) GetNetMsgId() uint16 {
|
||||
return uint16(SMMessageIdE__SMSetMemberLevel)
|
||||
}
|
||||
|
||||
func (this *CMPromoteMember) GetNetMsgId() uint16 {
|
||||
return uint16(CMMessageIdE__CMPromoteMember)
|
||||
}
|
||||
|
||||
func (this *SMPromoteMember) GetNetMsgId() uint16 {
|
||||
return uint16(SMMessageIdE__SMPromoteMember)
|
||||
}
|
||||
|
||||
func (this *CMDemoteMember) GetNetMsgId() uint16 {
|
||||
return uint16(CMMessageIdE__CMDemoteMember)
|
||||
}
|
||||
|
||||
func (this *SMDemoteMember) GetNetMsgId() uint16 {
|
||||
return uint16(SMMessageIdE__SMDemoteMember)
|
||||
}
|
||||
|
||||
func (this *CMGuildMembersList) GetNetMsgId() uint16 {
|
||||
return uint16(CMMessageIdE__CMGuildMembersList)
|
||||
}
|
||||
@ -843,30 +819,6 @@ func init() {
|
||||
},
|
||||
}
|
||||
|
||||
handlers[int(CMMessageIdE__CMPromoteMember)] = &CsNetMsgHandler{
|
||||
MsgId: int(CMMessageIdE__CMPromoteMember),
|
||||
ParseCb: func (data []byte) interface{} {
|
||||
msg := &CMPromoteMember{}
|
||||
proto.Unmarshal(data, msg)
|
||||
return msg
|
||||
},
|
||||
Cb: func (hdr *f5.MsgHdr, handler MsgHandler) {
|
||||
handler.CMPromoteMember(hdr, hdr.Msg.(*CMPromoteMember))
|
||||
},
|
||||
}
|
||||
|
||||
handlers[int(CMMessageIdE__CMDemoteMember)] = &CsNetMsgHandler{
|
||||
MsgId: int(CMMessageIdE__CMDemoteMember),
|
||||
ParseCb: func (data []byte) interface{} {
|
||||
msg := &CMDemoteMember{}
|
||||
proto.Unmarshal(data, msg)
|
||||
return msg
|
||||
},
|
||||
Cb: func (hdr *f5.MsgHdr, handler MsgHandler) {
|
||||
handler.CMDemoteMember(hdr, hdr.Msg.(*CMDemoteMember))
|
||||
},
|
||||
}
|
||||
|
||||
handlers[int(CMMessageIdE__CMGuildMembersList)] = &CsNetMsgHandler{
|
||||
MsgId: int(CMMessageIdE__CMGuildMembersList),
|
||||
ParseCb: func (data []byte) interface{} {
|
||||
|
@ -52,8 +52,6 @@ const (
|
||||
CMMessageIdE__CMReject CMMessageIdE = 124
|
||||
CMMessageIdE__CMLeaveGuild CMMessageIdE = 125
|
||||
CMMessageIdE__CMDismissMember CMMessageIdE = 126
|
||||
CMMessageIdE__CMPromoteMember CMMessageIdE = 127
|
||||
CMMessageIdE__CMDemoteMember CMMessageIdE = 128
|
||||
CMMessageIdE__CMDisband CMMessageIdE = 129
|
||||
CMMessageIdE__CMSearchGuilds CMMessageIdE = 130
|
||||
CMMessageIdE__CMApplyList CMMessageIdE = 131
|
||||
@ -95,8 +93,6 @@ var (
|
||||
124: "_CMReject",
|
||||
125: "_CMLeaveGuild",
|
||||
126: "_CMDismissMember",
|
||||
127: "_CMPromoteMember",
|
||||
128: "_CMDemoteMember",
|
||||
129: "_CMDisband",
|
||||
130: "_CMSearchGuilds",
|
||||
131: "_CMApplyList",
|
||||
@ -135,8 +131,6 @@ var (
|
||||
"_CMReject": 124,
|
||||
"_CMLeaveGuild": 125,
|
||||
"_CMDismissMember": 126,
|
||||
"_CMPromoteMember": 127,
|
||||
"_CMDemoteMember": 128,
|
||||
"_CMDisband": 129,
|
||||
"_CMSearchGuilds": 130,
|
||||
"_CMApplyList": 131,
|
||||
@ -214,8 +208,6 @@ const (
|
||||
SMMessageIdE__SMReject SMMessageIdE = 124
|
||||
SMMessageIdE__SMLeaveGuild SMMessageIdE = 125
|
||||
SMMessageIdE__SMDismissMember SMMessageIdE = 126
|
||||
SMMessageIdE__SMPromoteMember SMMessageIdE = 127
|
||||
SMMessageIdE__SMDemoteMember SMMessageIdE = 128
|
||||
SMMessageIdE__SMDisband SMMessageIdE = 129
|
||||
SMMessageIdE__SMSearchGuilds SMMessageIdE = 130
|
||||
SMMessageIdE__SMApplyList SMMessageIdE = 131
|
||||
@ -262,8 +254,6 @@ var (
|
||||
124: "_SMReject",
|
||||
125: "_SMLeaveGuild",
|
||||
126: "_SMDismissMember",
|
||||
127: "_SMPromoteMember",
|
||||
128: "_SMDemoteMember",
|
||||
129: "_SMDisband",
|
||||
130: "_SMSearchGuilds",
|
||||
131: "_SMApplyList",
|
||||
@ -305,8 +295,6 @@ var (
|
||||
"_SMReject": 124,
|
||||
"_SMLeaveGuild": 125,
|
||||
"_SMDismissMember": 126,
|
||||
"_SMPromoteMember": 127,
|
||||
"_SMDemoteMember": 128,
|
||||
"_SMDisband": 129,
|
||||
"_SMSearchGuilds": 130,
|
||||
"_SMApplyList": 131,
|
||||
@ -368,7 +356,7 @@ var File_cs_msgid_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_cs_msgid_proto_rawDesc = []byte{
|
||||
0x0a, 0x0e, 0x63, 0x73, 0x5f, 0x6d, 0x73, 0x67, 0x69, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x12, 0x02, 0x63, 0x73, 0x2a, 0xd2, 0x06, 0x0a, 0x0d, 0x43, 0x4d, 0x4d, 0x65, 0x73, 0x73, 0x61,
|
||||
0x12, 0x02, 0x63, 0x73, 0x2a, 0xa6, 0x06, 0x0a, 0x0d, 0x43, 0x4d, 0x4d, 0x65, 0x73, 0x73, 0x61,
|
||||
0x67, 0x65, 0x49, 0x64, 0x5f, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x5f, 0x43, 0x4d, 0x50, 0x69, 0x6e,
|
||||
0x67, 0x10, 0x65, 0x12, 0x0c, 0x0a, 0x08, 0x5f, 0x43, 0x4d, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x10,
|
||||
0x67, 0x12, 0x10, 0x0a, 0x0c, 0x5f, 0x43, 0x4d, 0x52, 0x65, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63,
|
||||
@ -404,84 +392,78 @@ var file_cs_msgid_proto_rawDesc = []byte{
|
||||
0x0a, 0x09, 0x5f, 0x43, 0x4d, 0x52, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x10, 0x7c, 0x12, 0x11, 0x0a,
|
||||
0x0d, 0x5f, 0x43, 0x4d, 0x4c, 0x65, 0x61, 0x76, 0x65, 0x47, 0x75, 0x69, 0x6c, 0x64, 0x10, 0x7d,
|
||||
0x12, 0x14, 0x0a, 0x10, 0x5f, 0x43, 0x4d, 0x44, 0x69, 0x73, 0x6d, 0x69, 0x73, 0x73, 0x4d, 0x65,
|
||||
0x6d, 0x62, 0x65, 0x72, 0x10, 0x7e, 0x12, 0x14, 0x0a, 0x10, 0x5f, 0x43, 0x4d, 0x50, 0x72, 0x6f,
|
||||
0x6d, 0x6f, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x10, 0x7f, 0x12, 0x14, 0x0a, 0x0f,
|
||||
0x5f, 0x43, 0x4d, 0x44, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x10,
|
||||
0x80, 0x01, 0x12, 0x0f, 0x0a, 0x0a, 0x5f, 0x43, 0x4d, 0x44, 0x69, 0x73, 0x62, 0x61, 0x6e, 0x64,
|
||||
0x10, 0x81, 0x01, 0x12, 0x14, 0x0a, 0x0f, 0x5f, 0x43, 0x4d, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68,
|
||||
0x47, 0x75, 0x69, 0x6c, 0x64, 0x73, 0x10, 0x82, 0x01, 0x12, 0x11, 0x0a, 0x0c, 0x5f, 0x43, 0x4d,
|
||||
0x41, 0x70, 0x70, 0x6c, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x10, 0x83, 0x01, 0x12, 0x11, 0x0a, 0x0c,
|
||||
0x5f, 0x43, 0x4d, 0x47, 0x75, 0x69, 0x6c, 0x64, 0x4c, 0x6f, 0x67, 0x73, 0x10, 0x84, 0x01, 0x12,
|
||||
0x11, 0x0a, 0x0c, 0x5f, 0x43, 0x4d, 0x53, 0x65, 0x74, 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x10,
|
||||
0x85, 0x01, 0x12, 0x16, 0x0a, 0x11, 0x5f, 0x43, 0x4d, 0x53, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x62,
|
||||
0x65, 0x72, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x10, 0x86, 0x01, 0x12, 0x18, 0x0a, 0x13, 0x5f, 0x43,
|
||||
0x4d, 0x47, 0x75, 0x69, 0x6c, 0x64, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x4c, 0x69, 0x73,
|
||||
0x74, 0x10, 0x87, 0x01, 0x12, 0x0f, 0x0a, 0x0a, 0x5f, 0x43, 0x4d, 0x53, 0x65, 0x74, 0x4e, 0x61,
|
||||
0x6d, 0x65, 0x10, 0x88, 0x01, 0x12, 0x11, 0x0a, 0x0c, 0x5f, 0x43, 0x4d, 0x53, 0x65, 0x74, 0x41,
|
||||
0x76, 0x61, 0x74, 0x61, 0x72, 0x10, 0x89, 0x01, 0x12, 0x13, 0x0a, 0x0e, 0x5f, 0x43, 0x4d, 0x53,
|
||||
0x65, 0x74, 0x4a, 0x6f, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x64, 0x10, 0x8a, 0x01, 0x12, 0x1a, 0x0a,
|
||||
0x15, 0x5f, 0x43, 0x4d, 0x52, 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64, 0x47, 0x75, 0x69,
|
||||
0x6c, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x10, 0x8b, 0x01, 0x2a, 0xb2, 0x07, 0x0a, 0x0d, 0x53, 0x4d,
|
||||
0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x64, 0x5f, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x5f,
|
||||
0x53, 0x4d, 0x50, 0x69, 0x6e, 0x67, 0x10, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x5f, 0x53, 0x4d, 0x52,
|
||||
0x70, 0x63, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x66, 0x12, 0x0c, 0x0a, 0x08, 0x5f, 0x53, 0x4d,
|
||||
0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x10, 0x67, 0x12, 0x10, 0x0a, 0x0c, 0x5f, 0x53, 0x4d, 0x52, 0x65,
|
||||
0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x10, 0x68, 0x12, 0x1c, 0x0a, 0x18, 0x5f, 0x53, 0x4d,
|
||||
0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x55, 0x73, 0x65, 0x72, 0x42, 0x79, 0x41, 0x63, 0x63, 0x6f,
|
||||
0x75, 0x6e, 0x74, 0x49, 0x64, 0x10, 0x69, 0x12, 0x11, 0x0a, 0x0d, 0x5f, 0x53, 0x4d, 0x53, 0x65,
|
||||
0x61, 0x72, 0x63, 0x68, 0x55, 0x73, 0x65, 0x72, 0x10, 0x6a, 0x12, 0x17, 0x0a, 0x13, 0x5f, 0x53,
|
||||
0x4d, 0x41, 0x64, 0x64, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x10, 0x6b, 0x12, 0x1a, 0x0a, 0x16, 0x5f, 0x53, 0x4d, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74,
|
||||
0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x10, 0x6c, 0x12,
|
||||
0x1a, 0x0a, 0x16, 0x5f, 0x53, 0x4d, 0x52, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x46, 0x72, 0x69, 0x65,
|
||||
0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x10, 0x6d, 0x12, 0x1f, 0x0a, 0x1b, 0x5f,
|
||||
0x53, 0x4d, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x46, 0x72, 0x69,
|
||||
0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x10, 0x6e, 0x12, 0x11, 0x0a, 0x0d,
|
||||
0x5f, 0x53, 0x4d, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x10, 0x6f, 0x12,
|
||||
0x17, 0x0a, 0x13, 0x5f, 0x53, 0x4d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x46, 0x72, 0x69, 0x65,
|
||||
0x6e, 0x64, 0x53, 0x68, 0x69, 0x70, 0x10, 0x70, 0x12, 0x13, 0x0a, 0x0f, 0x5f, 0x53, 0x4d, 0x41,
|
||||
0x64, 0x64, 0x42, 0x6c, 0x61, 0x63, 0x6b, 0x6c, 0x69, 0x73, 0x74, 0x10, 0x71, 0x12, 0x16, 0x0a,
|
||||
0x12, 0x5f, 0x53, 0x4d, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x42, 0x6c, 0x61, 0x63, 0x6b, 0x6c,
|
||||
0x69, 0x73, 0x74, 0x10, 0x72, 0x12, 0x10, 0x0a, 0x0c, 0x5f, 0x53, 0x4d, 0x42, 0x6c, 0x61, 0x63,
|
||||
0x6b, 0x6c, 0x69, 0x73, 0x74, 0x10, 0x74, 0x12, 0x10, 0x0a, 0x0c, 0x5f, 0x53, 0x4d, 0x47, 0x75,
|
||||
0x69, 0x6c, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x10, 0x78, 0x12, 0x12, 0x0a, 0x0e, 0x5f, 0x53, 0x4d,
|
||||
0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x47, 0x75, 0x69, 0x6c, 0x64, 0x10, 0x79, 0x12, 0x13, 0x0a,
|
||||
0x0f, 0x5f, 0x53, 0x4d, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x54, 0x6f, 0x47, 0x75, 0x69, 0x6c, 0x64,
|
||||
0x10, 0x7a, 0x12, 0x0e, 0x0a, 0x0a, 0x5f, 0x53, 0x4d, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65,
|
||||
0x10, 0x7b, 0x12, 0x0d, 0x0a, 0x09, 0x5f, 0x53, 0x4d, 0x52, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x10,
|
||||
0x7c, 0x12, 0x11, 0x0a, 0x0d, 0x5f, 0x53, 0x4d, 0x4c, 0x65, 0x61, 0x76, 0x65, 0x47, 0x75, 0x69,
|
||||
0x6c, 0x64, 0x10, 0x7d, 0x12, 0x14, 0x0a, 0x10, 0x5f, 0x53, 0x4d, 0x44, 0x69, 0x73, 0x6d, 0x69,
|
||||
0x73, 0x73, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x10, 0x7e, 0x12, 0x14, 0x0a, 0x10, 0x5f, 0x53,
|
||||
0x4d, 0x50, 0x72, 0x6f, 0x6d, 0x6f, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x10, 0x7f,
|
||||
0x12, 0x14, 0x0a, 0x0f, 0x5f, 0x53, 0x4d, 0x44, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x4d, 0x65, 0x6d,
|
||||
0x62, 0x65, 0x72, 0x10, 0x80, 0x01, 0x12, 0x0f, 0x0a, 0x0a, 0x5f, 0x53, 0x4d, 0x44, 0x69, 0x73,
|
||||
0x62, 0x61, 0x6e, 0x64, 0x10, 0x81, 0x01, 0x12, 0x14, 0x0a, 0x0f, 0x5f, 0x53, 0x4d, 0x53, 0x65,
|
||||
0x6d, 0x62, 0x65, 0x72, 0x10, 0x7e, 0x12, 0x0f, 0x0a, 0x0a, 0x5f, 0x43, 0x4d, 0x44, 0x69, 0x73,
|
||||
0x62, 0x61, 0x6e, 0x64, 0x10, 0x81, 0x01, 0x12, 0x14, 0x0a, 0x0f, 0x5f, 0x43, 0x4d, 0x53, 0x65,
|
||||
0x61, 0x72, 0x63, 0x68, 0x47, 0x75, 0x69, 0x6c, 0x64, 0x73, 0x10, 0x82, 0x01, 0x12, 0x11, 0x0a,
|
||||
0x0c, 0x5f, 0x53, 0x4d, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x10, 0x83, 0x01,
|
||||
0x12, 0x11, 0x0a, 0x0c, 0x5f, 0x53, 0x4d, 0x47, 0x75, 0x69, 0x6c, 0x64, 0x4c, 0x6f, 0x67, 0x73,
|
||||
0x10, 0x84, 0x01, 0x12, 0x11, 0x0a, 0x0c, 0x5f, 0x53, 0x4d, 0x53, 0x65, 0x74, 0x4e, 0x6f, 0x74,
|
||||
0x69, 0x63, 0x65, 0x10, 0x85, 0x01, 0x12, 0x16, 0x0a, 0x11, 0x5f, 0x53, 0x4d, 0x53, 0x65, 0x74,
|
||||
0x0c, 0x5f, 0x43, 0x4d, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x10, 0x83, 0x01,
|
||||
0x12, 0x11, 0x0a, 0x0c, 0x5f, 0x43, 0x4d, 0x47, 0x75, 0x69, 0x6c, 0x64, 0x4c, 0x6f, 0x67, 0x73,
|
||||
0x10, 0x84, 0x01, 0x12, 0x11, 0x0a, 0x0c, 0x5f, 0x43, 0x4d, 0x53, 0x65, 0x74, 0x4e, 0x6f, 0x74,
|
||||
0x69, 0x63, 0x65, 0x10, 0x85, 0x01, 0x12, 0x16, 0x0a, 0x11, 0x5f, 0x43, 0x4d, 0x53, 0x65, 0x74,
|
||||
0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x10, 0x86, 0x01, 0x12, 0x18,
|
||||
0x0a, 0x13, 0x5f, 0x53, 0x4d, 0x47, 0x75, 0x69, 0x6c, 0x64, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72,
|
||||
0x73, 0x4c, 0x69, 0x73, 0x74, 0x10, 0x87, 0x01, 0x12, 0x0f, 0x0a, 0x0a, 0x5f, 0x53, 0x4d, 0x53,
|
||||
0x65, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x10, 0x88, 0x01, 0x12, 0x11, 0x0a, 0x0c, 0x5f, 0x53, 0x4d,
|
||||
0x0a, 0x13, 0x5f, 0x43, 0x4d, 0x47, 0x75, 0x69, 0x6c, 0x64, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72,
|
||||
0x73, 0x4c, 0x69, 0x73, 0x74, 0x10, 0x87, 0x01, 0x12, 0x0f, 0x0a, 0x0a, 0x5f, 0x43, 0x4d, 0x53,
|
||||
0x65, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x10, 0x88, 0x01, 0x12, 0x11, 0x0a, 0x0c, 0x5f, 0x43, 0x4d,
|
||||
0x53, 0x65, 0x74, 0x41, 0x76, 0x61, 0x74, 0x61, 0x72, 0x10, 0x89, 0x01, 0x12, 0x13, 0x0a, 0x0e,
|
||||
0x5f, 0x53, 0x4d, 0x53, 0x65, 0x74, 0x4a, 0x6f, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x64, 0x10, 0x8a,
|
||||
0x01, 0x12, 0x1a, 0x0a, 0x15, 0x5f, 0x53, 0x4d, 0x52, 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e,
|
||||
0x64, 0x47, 0x75, 0x69, 0x6c, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x10, 0x8b, 0x01, 0x12, 0x20, 0x0a,
|
||||
0x1b, 0x5f, 0x53, 0x4d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x74, 0x52, 0x65,
|
||||
0x64, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x10, 0xe8, 0x07, 0x12,
|
||||
0x15, 0x0a, 0x10, 0x5f, 0x53, 0x4d, 0x43, 0x68, 0x61, 0x74, 0x4d, 0x73, 0x67, 0x4e, 0x6f, 0x74,
|
||||
0x69, 0x66, 0x79, 0x10, 0xe9, 0x07, 0x12, 0x1c, 0x0a, 0x17, 0x5f, 0x53, 0x4d, 0x55, 0x70, 0x64,
|
||||
0x61, 0x74, 0x65, 0x52, 0x65, 0x64, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4e, 0x6f, 0x74, 0x69, 0x66,
|
||||
0x79, 0x10, 0xea, 0x07, 0x12, 0x27, 0x0a, 0x22, 0x5f, 0x53, 0x4d, 0x55, 0x70, 0x64, 0x61, 0x74,
|
||||
0x65, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x74, 0x52, 0x65, 0x64, 0x50,
|
||||
0x6f, 0x69, 0x6e, 0x74, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x10, 0xeb, 0x07, 0x12, 0x1f, 0x0a,
|
||||
0x1a, 0x5f, 0x53, 0x4d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x74, 0x43, 0x68,
|
||||
0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x4c, 0x61, 0x73, 0x74, 0x49, 0x64, 0x10, 0xec, 0x07, 0x12, 0x1e,
|
||||
0x0a, 0x19, 0x5f, 0x53, 0x4d, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x4a, 0x6f, 0x69, 0x6e,
|
||||
0x47, 0x75, 0x69, 0x6c, 0x64, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x10, 0xf2, 0x07, 0x42, 0x06,
|
||||
0x5a, 0x04, 0x2e, 0x3b, 0x63, 0x73,
|
||||
0x5f, 0x43, 0x4d, 0x53, 0x65, 0x74, 0x4a, 0x6f, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x64, 0x10, 0x8a,
|
||||
0x01, 0x12, 0x1a, 0x0a, 0x15, 0x5f, 0x43, 0x4d, 0x52, 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e,
|
||||
0x64, 0x47, 0x75, 0x69, 0x6c, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x10, 0x8b, 0x01, 0x2a, 0x86, 0x07,
|
||||
0x0a, 0x0d, 0x53, 0x4d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x64, 0x5f, 0x65, 0x12,
|
||||
0x0b, 0x0a, 0x07, 0x5f, 0x53, 0x4d, 0x50, 0x69, 0x6e, 0x67, 0x10, 0x65, 0x12, 0x0f, 0x0a, 0x0b,
|
||||
0x5f, 0x53, 0x4d, 0x52, 0x70, 0x63, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x66, 0x12, 0x0c, 0x0a,
|
||||
0x08, 0x5f, 0x53, 0x4d, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x10, 0x67, 0x12, 0x10, 0x0a, 0x0c, 0x5f,
|
||||
0x53, 0x4d, 0x52, 0x65, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x10, 0x68, 0x12, 0x1c, 0x0a,
|
||||
0x18, 0x5f, 0x53, 0x4d, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x55, 0x73, 0x65, 0x72, 0x42, 0x79,
|
||||
0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, 0x10, 0x69, 0x12, 0x11, 0x0a, 0x0d, 0x5f,
|
||||
0x53, 0x4d, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x55, 0x73, 0x65, 0x72, 0x10, 0x6a, 0x12, 0x17,
|
||||
0x0a, 0x13, 0x5f, 0x53, 0x4d, 0x41, 0x64, 0x64, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x10, 0x6b, 0x12, 0x1a, 0x0a, 0x16, 0x5f, 0x53, 0x4d, 0x41, 0x63,
|
||||
0x63, 0x65, 0x70, 0x74, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x10, 0x6c, 0x12, 0x1a, 0x0a, 0x16, 0x5f, 0x53, 0x4d, 0x52, 0x65, 0x6a, 0x65, 0x63, 0x74,
|
||||
0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x10, 0x6d, 0x12,
|
||||
0x1f, 0x0a, 0x1b, 0x5f, 0x53, 0x4d, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e,
|
||||
0x67, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x10, 0x6e,
|
||||
0x12, 0x11, 0x0a, 0x0d, 0x5f, 0x53, 0x4d, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x72, 0x69, 0x65, 0x6e,
|
||||
0x64, 0x10, 0x6f, 0x12, 0x17, 0x0a, 0x13, 0x5f, 0x53, 0x4d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65,
|
||||
0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x53, 0x68, 0x69, 0x70, 0x10, 0x70, 0x12, 0x13, 0x0a, 0x0f,
|
||||
0x5f, 0x53, 0x4d, 0x41, 0x64, 0x64, 0x42, 0x6c, 0x61, 0x63, 0x6b, 0x6c, 0x69, 0x73, 0x74, 0x10,
|
||||
0x71, 0x12, 0x16, 0x0a, 0x12, 0x5f, 0x53, 0x4d, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x42, 0x6c,
|
||||
0x61, 0x63, 0x6b, 0x6c, 0x69, 0x73, 0x74, 0x10, 0x72, 0x12, 0x10, 0x0a, 0x0c, 0x5f, 0x53, 0x4d,
|
||||
0x42, 0x6c, 0x61, 0x63, 0x6b, 0x6c, 0x69, 0x73, 0x74, 0x10, 0x74, 0x12, 0x10, 0x0a, 0x0c, 0x5f,
|
||||
0x53, 0x4d, 0x47, 0x75, 0x69, 0x6c, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x10, 0x78, 0x12, 0x12, 0x0a,
|
||||
0x0e, 0x5f, 0x53, 0x4d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x47, 0x75, 0x69, 0x6c, 0x64, 0x10,
|
||||
0x79, 0x12, 0x13, 0x0a, 0x0f, 0x5f, 0x53, 0x4d, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x54, 0x6f, 0x47,
|
||||
0x75, 0x69, 0x6c, 0x64, 0x10, 0x7a, 0x12, 0x0e, 0x0a, 0x0a, 0x5f, 0x53, 0x4d, 0x41, 0x70, 0x70,
|
||||
0x72, 0x6f, 0x76, 0x65, 0x10, 0x7b, 0x12, 0x0d, 0x0a, 0x09, 0x5f, 0x53, 0x4d, 0x52, 0x65, 0x6a,
|
||||
0x65, 0x63, 0x74, 0x10, 0x7c, 0x12, 0x11, 0x0a, 0x0d, 0x5f, 0x53, 0x4d, 0x4c, 0x65, 0x61, 0x76,
|
||||
0x65, 0x47, 0x75, 0x69, 0x6c, 0x64, 0x10, 0x7d, 0x12, 0x14, 0x0a, 0x10, 0x5f, 0x53, 0x4d, 0x44,
|
||||
0x69, 0x73, 0x6d, 0x69, 0x73, 0x73, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x10, 0x7e, 0x12, 0x0f,
|
||||
0x0a, 0x0a, 0x5f, 0x53, 0x4d, 0x44, 0x69, 0x73, 0x62, 0x61, 0x6e, 0x64, 0x10, 0x81, 0x01, 0x12,
|
||||
0x14, 0x0a, 0x0f, 0x5f, 0x53, 0x4d, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x47, 0x75, 0x69, 0x6c,
|
||||
0x64, 0x73, 0x10, 0x82, 0x01, 0x12, 0x11, 0x0a, 0x0c, 0x5f, 0x53, 0x4d, 0x41, 0x70, 0x70, 0x6c,
|
||||
0x79, 0x4c, 0x69, 0x73, 0x74, 0x10, 0x83, 0x01, 0x12, 0x11, 0x0a, 0x0c, 0x5f, 0x53, 0x4d, 0x47,
|
||||
0x75, 0x69, 0x6c, 0x64, 0x4c, 0x6f, 0x67, 0x73, 0x10, 0x84, 0x01, 0x12, 0x11, 0x0a, 0x0c, 0x5f,
|
||||
0x53, 0x4d, 0x53, 0x65, 0x74, 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x10, 0x85, 0x01, 0x12, 0x16,
|
||||
0x0a, 0x11, 0x5f, 0x53, 0x4d, 0x53, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x4c, 0x65,
|
||||
0x76, 0x65, 0x6c, 0x10, 0x86, 0x01, 0x12, 0x18, 0x0a, 0x13, 0x5f, 0x53, 0x4d, 0x47, 0x75, 0x69,
|
||||
0x6c, 0x64, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x10, 0x87, 0x01,
|
||||
0x12, 0x0f, 0x0a, 0x0a, 0x5f, 0x53, 0x4d, 0x53, 0x65, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x10, 0x88,
|
||||
0x01, 0x12, 0x11, 0x0a, 0x0c, 0x5f, 0x53, 0x4d, 0x53, 0x65, 0x74, 0x41, 0x76, 0x61, 0x74, 0x61,
|
||||
0x72, 0x10, 0x89, 0x01, 0x12, 0x13, 0x0a, 0x0e, 0x5f, 0x53, 0x4d, 0x53, 0x65, 0x74, 0x4a, 0x6f,
|
||||
0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x64, 0x10, 0x8a, 0x01, 0x12, 0x1a, 0x0a, 0x15, 0x5f, 0x53, 0x4d,
|
||||
0x52, 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64, 0x47, 0x75, 0x69, 0x6c, 0x64, 0x4c, 0x69,
|
||||
0x73, 0x74, 0x10, 0x8b, 0x01, 0x12, 0x20, 0x0a, 0x1b, 0x5f, 0x53, 0x4d, 0x55, 0x70, 0x64, 0x61,
|
||||
0x74, 0x65, 0x43, 0x68, 0x61, 0x74, 0x52, 0x65, 0x64, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4e, 0x6f,
|
||||
0x74, 0x69, 0x66, 0x79, 0x10, 0xe8, 0x07, 0x12, 0x15, 0x0a, 0x10, 0x5f, 0x53, 0x4d, 0x43, 0x68,
|
||||
0x61, 0x74, 0x4d, 0x73, 0x67, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x10, 0xe9, 0x07, 0x12, 0x1c,
|
||||
0x0a, 0x17, 0x5f, 0x53, 0x4d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x64, 0x50, 0x6f,
|
||||
0x69, 0x6e, 0x74, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x10, 0xea, 0x07, 0x12, 0x27, 0x0a, 0x22,
|
||||
0x5f, 0x53, 0x4d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65,
|
||||
0x43, 0x68, 0x61, 0x74, 0x52, 0x65, 0x64, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4e, 0x6f, 0x74, 0x69,
|
||||
0x66, 0x79, 0x10, 0xeb, 0x07, 0x12, 0x1f, 0x0a, 0x1a, 0x5f, 0x53, 0x4d, 0x55, 0x70, 0x64, 0x61,
|
||||
0x74, 0x65, 0x43, 0x68, 0x61, 0x74, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x4c, 0x61, 0x73,
|
||||
0x74, 0x49, 0x64, 0x10, 0xec, 0x07, 0x12, 0x1e, 0x0a, 0x19, 0x5f, 0x53, 0x4d, 0x41, 0x70, 0x70,
|
||||
0x72, 0x6f, 0x76, 0x65, 0x4a, 0x6f, 0x69, 0x6e, 0x47, 0x75, 0x69, 0x6c, 0x64, 0x4e, 0x6f, 0x74,
|
||||
0x69, 0x66, 0x79, 0x10, 0xf2, 0x07, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x63, 0x73,
|
||||
}
|
||||
|
||||
var (
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -110,11 +110,7 @@ func (fm *FriendsMgr) findUsersByUsername(username string, sinceId int64, cb fun
|
||||
lastId = autoId
|
||||
}
|
||||
accountId := q5.ToString(*rows.GetByIndex(1))
|
||||
player := playerMgr.GetPlayerByAccountId(accountId)
|
||||
var onlineStatue int32 = 0
|
||||
if player != nil {
|
||||
onlineStatue = 1
|
||||
}
|
||||
onlineStatus := playerMgr.GetOnlineStatus(accountId)
|
||||
profile := &PlayerProfile{
|
||||
AccountId: q5.ToString(*rows.GetByIndex(1)),
|
||||
Username: q5.ToString(*rows.GetByIndex(2)),
|
||||
@ -123,7 +119,7 @@ func (fm *FriendsMgr) findUsersByUsername(username string, sinceId int64, cb fun
|
||||
Star: q5.ToInt32(*rows.GetByIndex(5)),
|
||||
Rank: q5.ToInt32(*rows.GetByIndex(6)),
|
||||
LastLoginTime: q5.ToInt32(*rows.GetByIndex(7)),
|
||||
OnlineStatus: onlineStatue,
|
||||
OnlineStatus: onlineStatus,
|
||||
}
|
||||
profiles = append(profiles, profile)
|
||||
}
|
||||
|
@ -1,25 +1,27 @@
|
||||
package main
|
||||
|
||||
import "math/rand"
|
||||
|
||||
type GuildMember struct {
|
||||
AccountId string
|
||||
Level int32 // 1: 会长, 20: 副会长, 30: 精英, 40 成员
|
||||
}
|
||||
|
||||
type Guild struct {
|
||||
AutoId int64 // 公会自增id
|
||||
GuildId int64 // 公会id
|
||||
Name string // 公会名称
|
||||
LeaderId string // 公会leader
|
||||
Avatar int32 // 头像
|
||||
Notice string // 公告
|
||||
JoinCond int32 // 公会加入条件
|
||||
JoinCondValue int32 // 公会加入条件值
|
||||
TotalStars int32 // 公会统计信息, 总星星数量
|
||||
TotalKills int32 // 公会统计信息, 单局总击杀数
|
||||
ChickenDinners int32 // 公会统计信息, 单局第一名数
|
||||
MaxMembers int32 // 公会最大成员数 default 30
|
||||
Members []*GuildMember
|
||||
PendingReqs map[string]int32 // pendingAccountId -> status 0,1,2,3 pending, accept, reject, leave
|
||||
AutoId int64 // 公会自增id
|
||||
GuildId int64 // 公会id
|
||||
Name string // 公会名称
|
||||
LeaderId string // 公会leader
|
||||
Avatar int32 // 头像
|
||||
Notice string // 公告
|
||||
JoinCond int32 // 公会加入条件
|
||||
JoinCondValue int32 // 公会加入条件值
|
||||
TotalStars int32 // 公会统计信息, 总星星数量
|
||||
TotalKills int32 // 公会统计信息, 单局总击杀数
|
||||
ChickenDinners int32 // 公会统计信息, 单局第一名数
|
||||
MaxMembers int32 // 公会最大成员数 default 30
|
||||
Members map[string]*GuildMember // accountId -> GuildMember
|
||||
PendingReqs map[string]int32 // pendingAccountId -> status 0,1,2,3 pending, accept, reject, leave
|
||||
}
|
||||
|
||||
// GuildLog 公会日志
|
||||
@ -44,32 +46,18 @@ func (g *Guild) GetMembersCount() int {
|
||||
return len(g.Members)
|
||||
}
|
||||
|
||||
func (g *Guild) GetMembers() []*GuildMember {
|
||||
return g.Members
|
||||
}
|
||||
|
||||
// findMemberIndex 根据 AccountId 查找成员在 Members 切片中的索引
|
||||
func (g *Guild) findMemberIndex(accountId string) int {
|
||||
for i, member := range g.Members {
|
||||
if member.AccountId == accountId {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
// GetMember 根据 AccountId 获取成员信息
|
||||
func (g *Guild) GetMember(accountId string) *GuildMember {
|
||||
index := g.findMemberIndex(accountId)
|
||||
if index == -1 {
|
||||
return nil
|
||||
if member, exists := g.Members[accountId]; exists {
|
||||
return member
|
||||
}
|
||||
return g.Members[index]
|
||||
return nil
|
||||
}
|
||||
|
||||
// IsMember 是否是公会成员
|
||||
func (g *Guild) IsMember(accountId string) bool {
|
||||
return g.findMemberIndex(accountId) >= 0
|
||||
_, exists := g.Members[accountId]
|
||||
return exists
|
||||
}
|
||||
|
||||
// IsFull 成员是否已满
|
||||
@ -79,21 +67,13 @@ func (g *Guild) IsFull() bool {
|
||||
|
||||
// AddMember 添加成员
|
||||
func (g *Guild) AddMember(member *GuildMember) {
|
||||
g.Members = append(g.Members, member)
|
||||
accountId := member.AccountId
|
||||
g.Members[accountId] = member
|
||||
}
|
||||
|
||||
// RemoveMember 移除成员
|
||||
func (g *Guild) RemoveMember(accountId string) {
|
||||
if accountId == g.LeaderId {
|
||||
return
|
||||
}
|
||||
index := g.findMemberIndex(accountId)
|
||||
if index == -1 {
|
||||
return
|
||||
}
|
||||
copy(g.Members[index:], g.Members[index+1:])
|
||||
g.Members[len(g.Members)-1] = nil
|
||||
g.Members = g.Members[:len(g.Members)-1]
|
||||
delete(g.Members, accountId)
|
||||
}
|
||||
|
||||
func (g *Guild) SetNotice(notice *string) {
|
||||
@ -128,3 +108,32 @@ func (gm *GuildMember) GetAccountId() string {
|
||||
func (g *Guild) IsInReq(accountId string) bool {
|
||||
return g.PendingReqs[accountId] == PendingReqIsJoinGuildStatusJoined
|
||||
}
|
||||
|
||||
func (g *Guild) NewLeaderId() *GuildMember {
|
||||
if len(g.Members) <= 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
// 找到级别最高的成员
|
||||
highestLevel := int32(GuildMemberLevelDefault)
|
||||
highestLevelMembers := make([]*GuildMember, 0)
|
||||
for _, member := range g.Members {
|
||||
if member.Level < highestLevel {
|
||||
// 发现更高级别的成员,重置列表
|
||||
highestLevel = member.Level
|
||||
highestLevelMembers = []*GuildMember{member}
|
||||
} else if member.Level == highestLevel {
|
||||
// 发现与当前最高级别相同的成员,添加到列表中
|
||||
highestLevelMembers = append(highestLevelMembers, member)
|
||||
}
|
||||
}
|
||||
|
||||
if len(highestLevelMembers) <= 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
newLeaderIndex := rand.Intn(len(highestLevelMembers))
|
||||
newLeader := highestLevelMembers[newLeaderIndex]
|
||||
newLeader.Level = GuildMemberLevelLeader
|
||||
return newLeader
|
||||
}
|
||||
|
@ -41,10 +41,9 @@ func (gm *GuildMgr) loadGuildFromDBResult(err error, rows *f5.DataSet) {
|
||||
}
|
||||
for rows.Next() {
|
||||
guildId := q5.ToInt64(*rows.GetByIndex(1))
|
||||
// append to gm.guilds
|
||||
gm.guilds[guildId] = &Guild{
|
||||
guild := &Guild{
|
||||
AutoId: q5.ToInt64(*rows.GetByIndex(0)),
|
||||
GuildId: q5.ToInt64(*rows.GetByIndex(1)),
|
||||
GuildId: guildId,
|
||||
Name: q5.ToString(*rows.GetByIndex(2)),
|
||||
LeaderId: q5.ToString(*rows.GetByIndex(3)),
|
||||
Avatar: q5.ToInt32(*rows.GetByIndex(4)),
|
||||
@ -55,7 +54,11 @@ func (gm *GuildMgr) loadGuildFromDBResult(err error, rows *f5.DataSet) {
|
||||
TotalKills: q5.ToInt32(*rows.GetByIndex(9)),
|
||||
ChickenDinners: q5.ToInt32(*rows.GetByIndex(10)),
|
||||
MaxMembers: q5.ToInt32(*rows.GetByIndex(11)),
|
||||
Members: make(map[string]*GuildMember, MaxMembers),
|
||||
PendingReqs: make(map[string]int32, MaxPendingReqs),
|
||||
}
|
||||
|
||||
gm.guilds[guildId] = guild
|
||||
gm.guildIds = append(gm.guildIds, guildId)
|
||||
}
|
||||
q5.UnSetBitFlag(&gm.loadedFlags, LoadGuildFlag)
|
||||
@ -135,9 +138,6 @@ func (gm *GuildMgr) loadPendingReqsFromDBResult(err error, rows *f5.DataSet) {
|
||||
Status: PendingReqIsJoinGuildStatusDefault,
|
||||
}
|
||||
if guild, ok := gm.guilds[guildId]; ok {
|
||||
if guild.PendingReqs == nil {
|
||||
guild.PendingReqs = make(map[string]int32)
|
||||
}
|
||||
guild.AddPendingReq(pendingReq)
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"q5"
|
||||
"sort"
|
||||
"time"
|
||||
)
|
||||
|
||||
@ -112,6 +111,7 @@ func (gm *GuildMgr) CreateGuild(avatar int32, name *string, leaderId string,
|
||||
TotalKills: 0,
|
||||
ChickenDinners: 0,
|
||||
MaxMembers: MaxMembers,
|
||||
Members: make(map[string]*GuildMember, MaxMembers),
|
||||
PendingReqs: make(map[string]int32, MaxPendingReqs),
|
||||
}
|
||||
guild.AddMember(newMember)
|
||||
@ -154,8 +154,7 @@ func (gm *GuildMgr) ApplyToGuild(guildId int64, applicantAccountId string, cb fu
|
||||
}
|
||||
// 可直接加入
|
||||
if guild.JoinCond == JoinCondFree {
|
||||
gm.JoinGuild(guild, applicantAccountId)
|
||||
cb(ERR_CODE_OK, "ApplyToGuild OK")
|
||||
gm.JoinGuild(guild, applicantAccountId, cb)
|
||||
return
|
||||
}
|
||||
|
||||
@ -169,8 +168,7 @@ func (gm *GuildMgr) ApplyToGuild(guildId int64, applicantAccountId string, cb fu
|
||||
cb(ERR_CODE_APPLY_GUILD_FAIL, "ApplyToGuild Fail, user star error")
|
||||
return
|
||||
}
|
||||
gm.JoinGuild(guild, applicantAccountId)
|
||||
cb(ERR_CODE_OK, "ApplyToGuild OK")
|
||||
gm.JoinGuild(guild, applicantAccountId, cb)
|
||||
return
|
||||
}
|
||||
|
||||
@ -216,7 +214,6 @@ func (gm *GuildMgr) ApplyToGuild(guildId int64, applicantAccountId string, cb fu
|
||||
EVENT_APPLY,
|
||||
prop,
|
||||
)
|
||||
|
||||
cb(ERR_CODE_OK, "ApplyToGuild ok")
|
||||
})
|
||||
}
|
||||
@ -353,30 +350,34 @@ func (gm *GuildMgr) Reject(operatorAccountId, accountId string, cb func(errCode
|
||||
}
|
||||
|
||||
// JoinGuild 直接加入公会
|
||||
func (gm *GuildMgr) JoinGuild(guild *Guild, accountId string) {
|
||||
func (gm *GuildMgr) JoinGuild(guild *Guild, accountId string, cb func(errCode int32, errMsg string)) {
|
||||
newMember := GuildMember{AccountId: accountId, Level: GuildMemberLevelDefault}
|
||||
guildId := guild.GuildId
|
||||
gm.upsertGuildMember(guildId, &newMember,
|
||||
func(err error) {
|
||||
if err != nil {
|
||||
guild.AddMember(&newMember)
|
||||
gm.AddUserGuild(accountId, guildId)
|
||||
|
||||
user := friendMgr.GetUser(accountId)
|
||||
cacheMgr.LoadPlayerProfile(user, func(playerProfile *PlayerProfile) {})
|
||||
|
||||
// Add event
|
||||
prop := make(map[string]string)
|
||||
prop["guild_id"] = q5.ToString(guild.GuildId)
|
||||
prop["members_count"] = q5.ToString(guild.GetMembersCount())
|
||||
f5.GetTgLog().AddTrackLog(
|
||||
GAME_ID,
|
||||
accountId,
|
||||
"127.0.0.1",
|
||||
EVENT_JOIN,
|
||||
prop,
|
||||
)
|
||||
cb(ERR_CODE_UPDATE_GUILD_MEMBER_DB_FAIL, "JoinGuild Fail, upsertGuildMember")
|
||||
return
|
||||
}
|
||||
guild.AddMember(&newMember)
|
||||
gm.AddUserGuild(accountId, guildId)
|
||||
|
||||
cb(ERR_CODE_OK, "ApplyToGuild OK")
|
||||
|
||||
user := friendMgr.GetUser(accountId)
|
||||
cacheMgr.LoadPlayerProfile(user, func(playerProfile *PlayerProfile) {})
|
||||
|
||||
// Add event
|
||||
prop := make(map[string]string)
|
||||
prop["guild_id"] = q5.ToString(guild.GuildId)
|
||||
prop["members_count"] = q5.ToString(guild.GetMembersCount())
|
||||
f5.GetTgLog().AddTrackLog(
|
||||
GAME_ID,
|
||||
accountId,
|
||||
"127.0.0.1",
|
||||
EVENT_JOIN,
|
||||
prop,
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
@ -384,7 +385,7 @@ func (gm *GuildMgr) JoinGuild(guild *Guild, accountId string) {
|
||||
func (gm *GuildMgr) LeaveGuild(accountId string, cb func(errCode int32, errMsg string)) {
|
||||
guild := gm.GetGuildByAccountId(accountId)
|
||||
if guild == nil {
|
||||
cb(ERR_CODE_GUILD_NO_EXISTS, "LeaveGuild guild no exists")
|
||||
cb(ERR_CODE_GUILD_NO_EXISTS, "no join guild]")
|
||||
return
|
||||
}
|
||||
member := guild.GetMember(accountId)
|
||||
@ -404,7 +405,7 @@ func (gm *GuildMgr) LeaveGuild(accountId string, cb func(errCode int32, errMsg s
|
||||
|
||||
// 重新选举公长
|
||||
if accountId == guild.LeaderId {
|
||||
newLeader := ElectNewGuildLeader(guild)
|
||||
newLeader := guild.NewLeaderId()
|
||||
if newLeader == nil {
|
||||
cb(ERR_CODE_UPDATE_GUILD_DB_FAIL, "error")
|
||||
return
|
||||
@ -440,8 +441,9 @@ func (gm *GuildMgr) LeaveGuild(accountId string, cb func(errCode int32, errMsg s
|
||||
|
||||
guild.RemoveMember(accountId)
|
||||
gm.RemoveUserGuild(accountId)
|
||||
|
||||
// Add logs
|
||||
logContent := fmt.Sprintf("LeaveGuild[%d-%s]", guild.GuildId, accountId)
|
||||
logContent := fmt.Sprintf("MemberCount[%d]", guild.GetMembersCount())
|
||||
gm.WriteLog(guild.GuildId, accountId, LogTypeLeave, logContent)
|
||||
|
||||
// Add event
|
||||
@ -455,7 +457,6 @@ func (gm *GuildMgr) LeaveGuild(accountId string, cb func(errCode int32, errMsg s
|
||||
EVENT_LEAVE,
|
||||
prop,
|
||||
)
|
||||
|
||||
cb(ERR_CODE_OK, "LeaveGuild OK")
|
||||
})
|
||||
}
|
||||
@ -527,12 +528,12 @@ func (gm *GuildMgr) SetMemberLevel(operatorAccountId, accountId string, level in
|
||||
// 干部, 精英, 副会长
|
||||
guild := gm.GetGuildByAccountId(operatorAccountId)
|
||||
if guild == nil {
|
||||
cb(ERR_CODE_GUILD_NO_EXISTS, "PromoteMember guild no exists")
|
||||
cb(ERR_CODE_GUILD_NO_EXISTS, "SetMemberLevel guild no exists")
|
||||
return
|
||||
}
|
||||
|
||||
if accountId == guild.LeaderId || accountId == operatorAccountId {
|
||||
cb(ERR_CODE_GUILD_BLOCKED_LEADER, "PromoteMember Blocked leader")
|
||||
cb(ERR_CODE_GUILD_BLOCKED_LEADER, "SetMemberLevel no operate your self account")
|
||||
return
|
||||
}
|
||||
|
||||
@ -544,7 +545,7 @@ func (gm *GuildMgr) SetMemberLevel(operatorAccountId, accountId string, level in
|
||||
|
||||
beforeLevel := member.Level
|
||||
if member.Level == level {
|
||||
cb(ERR_CODE_GUILD_OPERATOR_MEMBER_NO_PERM, "LeaveGuild error")
|
||||
cb(ERR_CODE_GUILD_OPERATOR_MEMBER_NO_PERM, "SetMemberLevel error")
|
||||
return
|
||||
}
|
||||
|
||||
@ -556,8 +557,34 @@ func (gm *GuildMgr) SetMemberLevel(operatorAccountId, accountId string, level in
|
||||
}
|
||||
|
||||
member.Level = level
|
||||
// 转让会长的操作
|
||||
if level == GuildMemberLevelLeader {
|
||||
operatorMember := guild.GetMember(operatorAccountId)
|
||||
operatorMember.Level = GuildMemberLevelDefault
|
||||
|
||||
guild.LeaderId = member.AccountId
|
||||
updateFields := [][]string{
|
||||
{"leader_account_id", q5.ToString(guild.LeaderId)},
|
||||
}
|
||||
gm.updateGuild(guild, updateFields, func(err error) {
|
||||
if err != nil {
|
||||
cb(ERR_CODE_UPDATE_GUILD_DB_FAIL, err.Error())
|
||||
return
|
||||
}
|
||||
// 新会长
|
||||
newMemberFields := [][]string{{"level", q5.ToString(member.Level)}}
|
||||
gm.updateGuildMember(guild, member.AccountId, newMemberFields,
|
||||
func(err error) {
|
||||
if err != nil {
|
||||
cb(ERR_CODE_UPDATE_GUILD_MEMBER_DB_FAIL, err.Error())
|
||||
return
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
logContent := fmt.Sprintf("SetMemberLevel[%d-%s-%s-%d-%d]", guild.GuildId, operatorAccountId, accountId, beforeLevel, level)
|
||||
gm.WriteLog(guild.GuildId, accountId, LogTypePromote, logContent)
|
||||
gm.WriteLog(guild.GuildId, accountId, LogTypeChangeLevel, logContent)
|
||||
|
||||
// Add event
|
||||
prop := make(map[string]string)
|
||||
@ -578,123 +605,6 @@ func (gm *GuildMgr) SetMemberLevel(operatorAccountId, accountId string, level in
|
||||
})
|
||||
}
|
||||
|
||||
// PromoteMember 提升成员为干部
|
||||
func (gm *GuildMgr) PromoteMember(operatorAccountId, accountId string, cb func(errCode int32, errMsg string)) {
|
||||
// 干部, 精英, 副会长
|
||||
guild := gm.GetGuildByAccountId(operatorAccountId)
|
||||
if guild == nil {
|
||||
cb(ERR_CODE_GUILD_NO_EXISTS, "PromoteMember guild no exists")
|
||||
return
|
||||
}
|
||||
|
||||
if accountId == guild.LeaderId || accountId == operatorAccountId {
|
||||
cb(ERR_CODE_GUILD_BLOCKED_LEADER, "PromoteMember Blocked leader")
|
||||
return
|
||||
}
|
||||
|
||||
// 仅会长操作
|
||||
if operatorAccountId != guild.LeaderId {
|
||||
cb(ERR_CODE_GUILD_NO_LEADER_PERM, "PromoteMember only leader perm")
|
||||
return
|
||||
}
|
||||
|
||||
member := guild.GetMember(accountId)
|
||||
if member == nil {
|
||||
cb(ERR_CODE_GUILD_MEMBER_NO_EXISTS, "LeaveGuild member no exists")
|
||||
return
|
||||
}
|
||||
|
||||
if member.Level == GuildMemberLevelViceLeader {
|
||||
cb(ERR_CODE_GUILD_OPERATOR_MEMBER_NO_PERM, "LeaveGuild error")
|
||||
return
|
||||
}
|
||||
|
||||
fields := [][]string{{"level", q5.ToString(GuildMemberLevelViceLeader)}}
|
||||
gm.updateGuildMember(guild, member.AccountId, fields, func(err error) {
|
||||
if err != nil {
|
||||
cb(ERR_CODE_UPDATE_GUILD_MEMBER_DB_FAIL, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
member.Level = GuildMemberLevelViceLeader
|
||||
logContent := fmt.Sprintf("PromoteMember[%d-%s-%s]", guild.GuildId, operatorAccountId, accountId)
|
||||
gm.WriteLog(guild.GuildId, accountId, LogTypePromote, logContent)
|
||||
|
||||
// Add event
|
||||
prop := make(map[string]string)
|
||||
prop["guild_id"] = q5.ToString(guild.GuildId)
|
||||
prop["accountId"] = q5.ToString(accountId)
|
||||
prop["members_count"] = q5.ToString(guild.GetMembersCount())
|
||||
f5.GetTgLog().AddTrackLog(
|
||||
GAME_ID,
|
||||
operatorAccountId,
|
||||
"127.0.0.1",
|
||||
EVENT_PROMOTE_MEMBER,
|
||||
prop,
|
||||
)
|
||||
|
||||
cb(ERR_CODE_OK, "PromoteMember OK")
|
||||
})
|
||||
}
|
||||
|
||||
// DemoteMember 解除成员干部身份
|
||||
func (gm *GuildMgr) DemoteMember(operatorAccountId, accountId string, cb func(errCode int32, errMsg string)) {
|
||||
guild := gm.GetGuildByAccountId(operatorAccountId)
|
||||
if guild == nil {
|
||||
cb(ERR_CODE_GUILD_NO_EXISTS, "DemoteMember guild no exists")
|
||||
return
|
||||
}
|
||||
|
||||
if accountId == guild.LeaderId || accountId == operatorAccountId {
|
||||
cb(ERR_CODE_GUILD_BLOCKED_LEADER, "DemoteMember Blocked leader")
|
||||
return
|
||||
}
|
||||
|
||||
// 仅会长可操作
|
||||
if operatorAccountId != guild.LeaderId {
|
||||
cb(ERR_CODE_GUILD_NO_LEADER_PERM, "DemoteMember only leader perm")
|
||||
return
|
||||
}
|
||||
|
||||
member := guild.GetMember(accountId)
|
||||
if member == nil {
|
||||
cb(ERR_CODE_GUILD_MEMBER_NO_EXISTS, "DemoteMember member no exists")
|
||||
return
|
||||
}
|
||||
|
||||
if member.Level == GuildMemberLevelDefault {
|
||||
cb(ERR_CODE_GUILD_DEMOTE_MEMBER_OK, "DemoteMember member ok")
|
||||
return
|
||||
}
|
||||
|
||||
fields := [][]string{{"level", q5.ToString(GuildMemberLevelDefault)}}
|
||||
gm.updateGuildMember(guild, member.AccountId, fields, func(err error) {
|
||||
if err != nil {
|
||||
cb(ERR_CODE_UPDATE_GUILD_MEMBER_DB_FAIL, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
member.Level = GuildMemberLevelDefault
|
||||
logContent := fmt.Sprintf("DemoteMember[%d-%s-%s]", guild.GuildId, operatorAccountId, accountId)
|
||||
gm.WriteLog(guild.GuildId, accountId, LogTypeDemote, logContent)
|
||||
|
||||
// Add event
|
||||
prop := make(map[string]string)
|
||||
prop["guild_id"] = q5.ToString(guild.GuildId)
|
||||
prop["accountId"] = q5.ToString(accountId)
|
||||
prop["members_count"] = q5.ToString(guild.GetMembersCount())
|
||||
f5.GetTgLog().AddTrackLog(
|
||||
GAME_ID,
|
||||
operatorAccountId,
|
||||
"127.0.0.1",
|
||||
EVENT_DEMOTE_MEMBER,
|
||||
prop,
|
||||
)
|
||||
|
||||
cb(ERR_CODE_OK, "DemoteMember OK")
|
||||
})
|
||||
}
|
||||
|
||||
// Disband 解散公会
|
||||
func (gm *GuildMgr) Disband(operatorAccountId string, cb func(errCode int32, errMsg string)) {
|
||||
guild := gm.GetGuildByAccountId(operatorAccountId)
|
||||
@ -705,7 +615,7 @@ func (gm *GuildMgr) Disband(operatorAccountId string, cb func(errCode int32, err
|
||||
|
||||
// 仅会长可操作
|
||||
if operatorAccountId != guild.LeaderId {
|
||||
cb(ERR_CODE_GUILD_NO_LEADER_PERM, "PromoteMember only leader perm")
|
||||
cb(ERR_CODE_GUILD_NO_LEADER_PERM, "Disband only leader perm")
|
||||
return
|
||||
}
|
||||
guildId := guild.GuildId
|
||||
@ -1011,26 +921,3 @@ func (gm *GuildMgr) GetGuildLogs(guildId int64) []*GuildLog {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func ElectNewGuildLeader(guild *Guild) *GuildMember {
|
||||
sort.Slice(guild.Members, func(i, j int) bool {
|
||||
return guild.Members[i].Level < guild.Members[j].Level
|
||||
})
|
||||
// 找到级别最低的成员
|
||||
lowestLevel := guild.Members[0].Level
|
||||
|
||||
var potentialLeaders []*GuildMember
|
||||
for _, member := range guild.Members {
|
||||
if member.Level == lowestLevel {
|
||||
potentialLeaders = append(potentialLeaders, member)
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
newLeader := potentialLeaders[rand.Intn(len(potentialLeaders))]
|
||||
newLeader.Level = GuildMemberLevelLeader
|
||||
return newLeader
|
||||
//newLeader.Level = GuildMemberLevelLeader
|
||||
//return newLeader.AccountId
|
||||
}
|
||||
|
@ -35,10 +35,9 @@ func (this *HandlerMgr) init() {
|
||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMReject), PLAYER_HANDLER_ID)
|
||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMLeaveGuild), PLAYER_HANDLER_ID)
|
||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMDismissMember), PLAYER_HANDLER_ID)
|
||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMPromoteMember), PLAYER_HANDLER_ID)
|
||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMDemoteMember), PLAYER_HANDLER_ID)
|
||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMDisband), PLAYER_HANDLER_ID)
|
||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMSearchGuilds), PLAYER_HANDLER_ID)
|
||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMApplyList), PLAYER_HANDLER_ID)
|
||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMGuildMembersList), PLAYER_HANDLER_ID)
|
||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMSetNotice), PLAYER_HANDLER_ID)
|
||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMSetName), PLAYER_HANDLER_ID)
|
||||
|
@ -440,36 +440,6 @@ func (p *Player) CMSetMemberLevel(hdr *f5.MsgHdr, msg *cs.CMSetMemberLevel) {
|
||||
})
|
||||
}
|
||||
|
||||
// CMPromoteMember 提升成员为干部
|
||||
func (p *Player) CMPromoteMember(hdr *f5.MsgHdr, msg *cs.CMPromoteMember) {
|
||||
guildMgr.PromoteMember(
|
||||
p.accountId,
|
||||
msg.GetPromoteAccountId(),
|
||||
func(errCode int32, errMsg string) {
|
||||
rspMsg := new(cs.SMPromoteMember)
|
||||
if errCode != 0 {
|
||||
rspMsg.Errcode = &errCode
|
||||
rspMsg.Errmsg = &errMsg
|
||||
}
|
||||
p.SendMsg(rspMsg)
|
||||
})
|
||||
}
|
||||
|
||||
// CMDemoteMember 解除成员干部身份
|
||||
func (p *Player) CMDemoteMember(hdr *f5.MsgHdr, msg *cs.CMDemoteMember) {
|
||||
guildMgr.DemoteMember(
|
||||
p.accountId,
|
||||
msg.GetDemoteAccountId(),
|
||||
func(errCode int32, errMsg string) {
|
||||
rspMsg := new(cs.SMDemoteMember)
|
||||
if errCode != 0 {
|
||||
rspMsg.Errcode = &errCode
|
||||
rspMsg.Errmsg = &errMsg
|
||||
}
|
||||
p.SendMsg(rspMsg)
|
||||
})
|
||||
}
|
||||
|
||||
// CMDisband 解散公会
|
||||
func (p *Player) CMDisband(hdr *f5.MsgHdr, msg *cs.CMDisband) {
|
||||
guildMgr.Disband(
|
||||
@ -621,6 +591,7 @@ func (p *Player) FillMFGuildMember(member *GuildMember) *cs.MFGuildMember {
|
||||
if profile == nil {
|
||||
return nil
|
||||
}
|
||||
onlineStatus := playerMgr.GetOnlineStatus(member.AccountId)
|
||||
guildMember := &cs.MFGuildMember{
|
||||
AccountId: &member.AccountId,
|
||||
Level: &member.Level,
|
||||
@ -629,7 +600,7 @@ func (p *Player) FillMFGuildMember(member *GuildMember) *cs.MFGuildMember {
|
||||
AvatarHead: &profile.AvatarHead,
|
||||
Star: &profile.Star,
|
||||
Rank: &profile.Rank,
|
||||
OnlineStatus: &profile.OnlineStatus,
|
||||
OnlineStatus: &onlineStatus,
|
||||
LastLoginTime: &profile.LastLoginTime,
|
||||
}
|
||||
return guildMember
|
||||
@ -688,6 +659,7 @@ func (p *Player) FillMFUser(profile *PlayerProfile) *cs.MFUser {
|
||||
guildId = guild.GuildId
|
||||
guildName = guild.Name
|
||||
}
|
||||
onlineStatus := playerMgr.GetOnlineStatus(profile.AccountId)
|
||||
|
||||
resUser := &cs.MFUser{
|
||||
AccountId: &profile.AccountId,
|
||||
@ -697,7 +669,7 @@ func (p *Player) FillMFUser(profile *PlayerProfile) *cs.MFUser {
|
||||
GuildId: &guildId,
|
||||
GuildName: &guildName,
|
||||
Rank: &profile.Rank,
|
||||
OnlineStatus: &profile.OnlineStatus,
|
||||
OnlineStatus: &onlineStatus,
|
||||
LastLoginTime: &profile.LastLoginTime,
|
||||
}
|
||||
return resUser
|
||||
|
@ -190,3 +190,11 @@ func (this *PlayerMgr) getPlayerBySocket(socket f5.WspCliConn) *Player {
|
||||
func (this *PlayerMgr) addSocketHash(wsp f5.WspCliConn, p *Player) {
|
||||
this.socketHash[wsp] = p
|
||||
}
|
||||
|
||||
func (this *PlayerMgr) GetOnlineStatus(accountId string) int32 {
|
||||
player := this.GetPlayerByAccountId(accountId)
|
||||
if player != nil {
|
||||
return OnlineStatus
|
||||
}
|
||||
return OnlineStatusOff
|
||||
}
|
||||
|
@ -37,8 +37,6 @@ enum CMMessageId_e
|
||||
_CMReject = 124;
|
||||
_CMLeaveGuild = 125;
|
||||
_CMDismissMember = 126;
|
||||
_CMPromoteMember = 127;
|
||||
_CMDemoteMember = 128;
|
||||
_CMDisband = 129;
|
||||
_CMSearchGuilds = 130;
|
||||
_CMApplyList = 131;
|
||||
@ -79,8 +77,6 @@ enum SMMessageId_e
|
||||
_SMReject = 124;
|
||||
_SMLeaveGuild = 125;
|
||||
_SMDismissMember = 126;
|
||||
_SMPromoteMember = 127;
|
||||
_SMDemoteMember = 128;
|
||||
_SMDisband = 129;
|
||||
_SMSearchGuilds = 130;
|
||||
_SMApplyList = 131;
|
||||
|
@ -420,7 +420,7 @@ message CMApplyList{}
|
||||
// 回复申请者列表
|
||||
message SMApplyList
|
||||
{
|
||||
optional string errcode = 1;
|
||||
optional int32 errcode = 1;
|
||||
optional string errmsg = 2;
|
||||
repeated MFGuildMember members = 3;
|
||||
}
|
||||
@ -496,32 +496,6 @@ message SMSetMemberLevel
|
||||
optional string errmsg = 2;
|
||||
}
|
||||
|
||||
// 请求提升成员为干部
|
||||
message CMPromoteMember
|
||||
{
|
||||
optional string promoteAccountId = 1;
|
||||
}
|
||||
|
||||
// 回复提升成员为干部
|
||||
message SMPromoteMember
|
||||
{
|
||||
optional int32 errcode = 1;
|
||||
optional string errmsg = 2;
|
||||
}
|
||||
|
||||
// 请求解除成员干部身份
|
||||
message CMDemoteMember
|
||||
{
|
||||
optional string demoteAccountId = 1;
|
||||
}
|
||||
|
||||
// 回复解除成员干部身份
|
||||
message SMDemoteMember
|
||||
{
|
||||
optional int32 errcode = 1;
|
||||
optional string errmsg = 2;
|
||||
}
|
||||
|
||||
// 请求公会成员列表
|
||||
message CMGuildMembersList
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user