fix同意好友申请申请记录没有删除
This commit is contained in:
parent
1477611d4a
commit
8a9a4f0c2d
|
@ -608,51 +608,59 @@ func (this *FriendMgr) FriendAgree(p *Player, destP *model.BindFriend) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret, err := model.QueryFriendApplyBySnid(p.Platform, p.SnId)
|
// 删除申请者的申请列表
|
||||||
if err != nil {
|
delApplyListFunc := func(plt string, snid int32, applySnid int32) friend.OpResultCode {
|
||||||
return friend.OpResultCode_OPRC_Error
|
// 删除被申请者的申请列表
|
||||||
}
|
list1, err := model.QueryFriendApplyBySnid(plt, snid)
|
||||||
// 维护申请放和被申请方的申请列表
|
if err != nil {
|
||||||
//查看是否在申请列表
|
return friend.OpResultCode_OPRC_Error
|
||||||
if ret != nil {
|
}
|
||||||
if ret.ApplySnids != nil {
|
for k, v := range list1.ApplySnids {
|
||||||
for i, as := range ret.ApplySnids {
|
if v.SnId == applySnid {
|
||||||
if as.SnId == destP.SnId {
|
list1.ApplySnids = append(list1.ApplySnids[:k], list1.ApplySnids[k+1:]...)
|
||||||
// 删除被申请者的申请列表
|
model.UpsertFriendApply(plt, snid, list1)
|
||||||
ret.ApplySnids = append(ret.ApplySnids[:i], ret.ApplySnids[i+1:]...)
|
break
|
||||||
model.UpsertFriendApply(p.Platform, p.SnId, ret)
|
|
||||||
|
|
||||||
// 删除发起方的申请列表
|
|
||||||
data, err := model.QueryFriendApplyListBySnid(p.Platform, destP.SnId)
|
|
||||||
if err != nil {
|
|
||||||
logger.Logger.Errorf("QueryFriendApplyListBySnid err:%v", err)
|
|
||||||
} else {
|
|
||||||
if data == nil {
|
|
||||||
data = model.NewApplyList(destP.SnId)
|
|
||||||
}
|
|
||||||
for k, v := range data.List {
|
|
||||||
if v == p.SnId {
|
|
||||||
data.List = append(data.List[:k], data.List[k+1:]...)
|
|
||||||
model.UpsertApplyList(p.Platform, data)
|
|
||||||
applyList = data.List
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 保存好友关系
|
|
||||||
if friendDB != nil {
|
|
||||||
friendDB.BindFriend = append(friendDB.BindFriend, &model.BindFriend{
|
|
||||||
SnId: p.SnId,
|
|
||||||
CreateTime: time.Now().Unix(),
|
|
||||||
})
|
|
||||||
model.UpsertFriend(friendDB)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 删除发起方的申请列表
|
||||||
|
list2, err := model.QueryFriendApplyListBySnid(plt, applySnid)
|
||||||
|
if err != nil {
|
||||||
|
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 applySnid == destP.SnId {
|
||||||
|
applyList = list2.List
|
||||||
|
}
|
||||||
|
|
||||||
|
return friend.OpResultCode_OPRC_Sucess
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//查看是否在申请列表
|
||||||
|
code := delApplyListFunc(p.Platform, p.SnId, destP.SnId)
|
||||||
|
if code != friend.OpResultCode_OPRC_Sucess {
|
||||||
|
return code
|
||||||
|
}
|
||||||
|
code = delApplyListFunc(p.Platform, destP.SnId, p.SnId)
|
||||||
|
if code != friend.OpResultCode_OPRC_Sucess {
|
||||||
|
return code
|
||||||
|
}
|
||||||
|
// 保存好友关系
|
||||||
|
if friendDB != nil {
|
||||||
|
friendDB.BindFriend = append(friendDB.BindFriend, &model.BindFriend{
|
||||||
|
SnId: p.SnId,
|
||||||
|
CreateTime: time.Now().Unix(),
|
||||||
|
})
|
||||||
|
model.UpsertFriend(friendDB)
|
||||||
|
return friend.OpResultCode_OPRC_Sucess
|
||||||
|
}
|
||||||
|
|
||||||
return friend.OpResultCode_OPRC_Error
|
return friend.OpResultCode_OPRC_Error
|
||||||
}), task.CompleteNotifyWrapper(func(data interface{}, tt task.Task) {
|
}), task.CompleteNotifyWrapper(func(data interface{}, tt task.Task) {
|
||||||
if data != nil {
|
if data != nil {
|
||||||
|
|
Loading…
Reference in New Issue