This commit is contained in:
aozhiwei 2024-04-07 17:08:57 +08:00
parent 6753cd82fe
commit 04de2961c3
3 changed files with 8 additions and 7 deletions

View File

@ -59,7 +59,7 @@ type FriendMgr interface {
GetFriendList(string) []string
GetBlackList(string) []string
AsyncGetApplyList(int64, string, func(int32, string, int64, []string))
AsyncAddFriend(string, string, func(int32, string))
AsyncApplyFriend(string, string, func(int32, string))
AsyncAccpetApply(string, string, func(int32, string))
AsyncRejectApply(string, string, func(int32, string))
AsynDeleteFriend(string, string, func(int32, string))

View File

@ -170,7 +170,7 @@ func (this *friendMgr) AsyncGetApplyList(lastIdx int64, accountId string,
f5.GetDbFilter().Comp(
f5.GetDbFilter().GT("idx", q5.ToString(lastIdx)).And(),
f5.GetDbFilter().EQ("target_id", accountId).And(),
f5.GetDbFilter().EQ("status", "0"),
f5.GetDbFilter().EQ("status", q5.ToString(constant.FRIEND_APPLY_STATUS_NONE)),
),
"",
func (err error, pg *f5.Pagination) {
@ -182,7 +182,7 @@ func (this *friendMgr) AsyncGetApplyList(lastIdx int64, accountId string,
users := []string{}
if pg.Rows.Next() {
idx := q5.ToInt64(pg.Rows.GetByName("idx"))
accountId := pg.Rows.GetByName("account_id")
accountId := pg.Rows.GetByName("sender_id")
if idx > lastSinceId {
lastSinceId = idx
} else {
@ -194,7 +194,7 @@ func (this *friendMgr) AsyncGetApplyList(lastIdx int64, accountId string,
})
}
func (this *friendMgr) AsyncAddFriend(senderId string, targetId string, cb func(int32, string)) {
func (this *friendMgr) AsyncApplyFriend(senderId string, targetId string, cb func(int32, string)) {
if this.IsFriend(senderId, targetId) {
cb(0, "")
return

View File

@ -111,8 +111,9 @@ func (this *player) CMListPendingFriendRequest(hdr *f5.MsgHdr, msg *cs.CMListPen
for _, accountId := range(accountIds) {
userProfile := GetCacheMgr().GetUserProfile(accountId)
if userProfile != nil {
ele := q5.NewSliceElement(&rspMsg.Users)
userProfile.FillMFUser(*ele)
ele := new(cs.MFUser)
q5.AppendSlice(&rspMsg.Users, ele)
userProfile.FillMFUser(ele)
}
}
this.SendMsg(rspMsg)
@ -173,7 +174,7 @@ func (this *player) CMAddFriendRequest(hdr *f5.MsgHdr, msg *cs.CMAddFriendReques
this.SendMsg(rspMsg.Err(2, "Cannot invite oneself"))
return
}
GetFriendMgr().AsyncAddFriend(
GetFriendMgr().AsyncApplyFriend(
this.GetAccountId(),
msg.GetTargetAccountId(),
func (errCode int32, errMsg string) {