好友申请数据修复

This commit is contained in:
sk 2024-12-02 17:10:19 +08:00
parent 744d52226c
commit b1d365e030
1 changed files with 10 additions and 6 deletions

View File

@ -621,11 +621,13 @@ func (this *FriendMgr) FriendAgree(p *Player, destP *model.BindFriend) {
return friend.OpResultCode_OPRC_Error return friend.OpResultCode_OPRC_Error
} }
if list1 != nil { if list1 != nil {
for k, v := range list1.ApplySnids { k := 0
if v.SnId == applySnid { for k < len(list1.ApplySnids) {
if list1.ApplySnids[k].SnId == applySnid {
list1.ApplySnids = append(list1.ApplySnids[:k], list1.ApplySnids[k+1:]...) list1.ApplySnids = append(list1.ApplySnids[:k], list1.ApplySnids[k+1:]...)
model.UpsertFriendApply(plt, snid, list1) model.UpsertFriendApply(plt, snid, list1)
break } else {
k++
} }
} }
} }
@ -636,11 +638,13 @@ func (this *FriendMgr) FriendAgree(p *Player, destP *model.BindFriend) {
return friend.OpResultCode_OPRC_Error return friend.OpResultCode_OPRC_Error
} }
if list2 != nil { if list2 != nil {
for k, v := range list2.List { k := 0
if v == snid { for k < len(list2.List) {
if list2.List[k] == snid {
list2.List = append(list2.List[:k], list2.List[k+1:]...) list2.List = append(list2.List[:k], list2.List[k+1:]...)
model.UpsertApplyList(plt, list2) model.UpsertApplyList(plt, list2)
break } else {
k++
} }
} }
} }