fix同意好友申请申请记录没有删除
This commit is contained in:
parent
4d9dd37713
commit
2d43a4153a
|
@ -511,7 +511,7 @@ func (this *FriendMgr) FriendApply(p *Player, destP *model.BindFriend) {
|
|||
// p 同意者
|
||||
// destP 申请者
|
||||
func (this *FriendMgr) FriendAgree(p *Player, destP *model.BindFriend) {
|
||||
var applyList []int32
|
||||
var applyList, meApplyList []int32
|
||||
SendToClick := func(retCode friend.OpResultCode, self ...bool) {
|
||||
pack := &friend.SCFriendOp{
|
||||
OpCode: proto.Int32(OpTypeAgree),
|
||||
|
@ -534,6 +534,10 @@ func (this *FriendMgr) FriendAgree(p *Player, destP *model.BindFriend) {
|
|||
RoleId: int32(roleId),
|
||||
}
|
||||
p.SendToClient(int(friend.FriendPacketID_PACKET_SCFriendOp), pack)
|
||||
if meApplyList != nil {
|
||||
p.ApplyList = meApplyList
|
||||
this.SendApplyList(p)
|
||||
}
|
||||
} else {
|
||||
destPs := PlayerMgrSington.GetPlayerBySnId(destP.SnId)
|
||||
if destPs != nil && destPs.IsOnLine() {
|
||||
|
@ -613,32 +617,42 @@ func (this *FriendMgr) FriendAgree(p *Player, destP *model.BindFriend) {
|
|||
// 删除被申请者的申请列表
|
||||
list1, err := model.QueryFriendApplyBySnid(plt, snid)
|
||||
if err != nil {
|
||||
logger.Logger.Errorf("QueryFriendApplyBySnid %v error: %v", snid, err)
|
||||
return friend.OpResultCode_OPRC_Error
|
||||
}
|
||||
for k, v := range list1.ApplySnids {
|
||||
if v.SnId == applySnid {
|
||||
list1.ApplySnids = append(list1.ApplySnids[:k], list1.ApplySnids[k+1:]...)
|
||||
model.UpsertFriendApply(plt, snid, list1)
|
||||
break
|
||||
if list1 != nil {
|
||||
for k, v := range list1.ApplySnids {
|
||||
if v.SnId == applySnid {
|
||||
list1.ApplySnids = append(list1.ApplySnids[:k], list1.ApplySnids[k+1:]...)
|
||||
model.UpsertFriendApply(plt, snid, list1)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
// 删除发起方的申请列表
|
||||
list2, err := model.QueryFriendApplyListBySnid(plt, applySnid)
|
||||
if err != nil {
|
||||
logger.Logger.Errorf("QueryFriendApplyListBySnid %v error: %v", applySnid, err)
|
||||
return friend.OpResultCode_OPRC_Error
|
||||
}
|
||||
for k, v := range list2.List {
|
||||
if v == snid {
|
||||
list2.List = append(list2.List[:k], list2.List[k+1:]...)
|
||||
model.UpsertApplyList(plt, list2)
|
||||
break
|
||||
if list2 != nil {
|
||||
for k, v := range list2.List {
|
||||
if v == snid {
|
||||
list2.List = append(list2.List[:k], list2.List[k+1:]...)
|
||||
model.UpsertApplyList(plt, list2)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if applySnid == destP.SnId {
|
||||
if applySnid == destP.SnId && list2 != nil {
|
||||
applyList = list2.List
|
||||
}
|
||||
|
||||
if applySnid == p.SnId && list2 != nil {
|
||||
meApplyList = list2.List
|
||||
}
|
||||
|
||||
return friend.OpResultCode_OPRC_Sucess
|
||||
}
|
||||
|
||||
|
@ -658,10 +672,9 @@ func (this *FriendMgr) FriendAgree(p *Player, destP *model.BindFriend) {
|
|||
CreateTime: time.Now().Unix(),
|
||||
})
|
||||
model.UpsertFriend(friendDB)
|
||||
return friend.OpResultCode_OPRC_Sucess
|
||||
}
|
||||
|
||||
return friend.OpResultCode_OPRC_Error
|
||||
return nil
|
||||
}), task.CompleteNotifyWrapper(func(data interface{}, tt task.Task) {
|
||||
if data != nil {
|
||||
logger.Logger.Error("FriendAgree data:", data)
|
||||
|
|
Loading…
Reference in New Issue