好友:特殊情况处理
This commit is contained in:
@@ -149,7 +149,7 @@ export class FriendHandler {
|
||||
let hisSid = await getRedis(`login_roleId_${hisRoleId}`);
|
||||
uids.push({ uid: hisRoleId, sid: hisSid });
|
||||
}
|
||||
console.log(JSON.stringify(uids))
|
||||
|
||||
this.channelService.pushMessageByUids('onFriendApply', resResult(STATUS.SUCCESS, { roleId }), uids);
|
||||
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
@@ -167,6 +167,7 @@ export class FriendHandler {
|
||||
let myFriendRelation = await FriendRelationModel.findFriendByRole(roleId, POPULATE_TYPE.NOT);
|
||||
let list = await FriendApplyModel.getApplyList(roleId);
|
||||
let result = new Array<FriendApplyParams>();
|
||||
let delApplyCodeList = new Array<string>();
|
||||
for(let apply of list) {
|
||||
let friend = <RoleType>apply.friend;
|
||||
let type = getRecommendType(myFriendRelation, roleId, friend.roleId);
|
||||
@@ -178,9 +179,15 @@ export class FriendHandler {
|
||||
param.setServerName(serverId, serverName);
|
||||
|
||||
param.setType(type);
|
||||
if(type != FRIEND_RELATION_TYPE.NORMAL) {
|
||||
delApplyCodeList.push(apply.applyCode);
|
||||
continue;
|
||||
}
|
||||
|
||||
result.push(param);
|
||||
}
|
||||
await FriendApplyModel.deleteApply(delApplyCodeList);
|
||||
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
list: result
|
||||
});
|
||||
@@ -205,10 +212,13 @@ export class FriendHandler {
|
||||
for(let apply of applyList) {
|
||||
let type = getRecommendType(myFriendRelation, roleId, apply.frdRoleId);
|
||||
if(type == FRIEND_RELATION_TYPE.HAS_FRIEND) {
|
||||
str = getResStr(STATUS.FRIEND_HAS_ADD); continue;
|
||||
str = getResStr(STATUS.FRIEND_HAS_ADD);
|
||||
resultApplyCodeList.push(apply.applyCode); continue;
|
||||
} else if(type == FRIEND_RELATION_TYPE.HAS_BLOCKED) {
|
||||
resultApplyCodeList.push(apply.applyCode);
|
||||
str = getResStr(STATUS.FRIEND_HAS_BLOCKED); continue;
|
||||
} else if (type == FRIEND_RELATION_TYPE.MYSELF) {
|
||||
resultApplyCodeList.push(apply.applyCode);
|
||||
str = getResStr(STATUS.FRIEND_YOURSELF); continue;
|
||||
}
|
||||
|
||||
@@ -244,6 +254,9 @@ export class FriendHandler {
|
||||
|
||||
await FriendApplyModel.deleteApply(resultApplyCodeList);
|
||||
|
||||
// 特殊处理:如果他点一键同意,有很多人,这个单独的人就不做这个额外的提示,直接把他好友申请删掉就好
|
||||
if(str == getResStr(STATUS.FRIEND_HAS_ADD) && resultApplyCodeList.length > 1) str = '';
|
||||
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
isSuccess: str == '',
|
||||
msg: str,
|
||||
@@ -377,6 +390,7 @@ export class FriendHandler {
|
||||
|
||||
await FriendRelationModel.moveFromFriend(hisRoleId, role, friendShip, false, !!curFriend); //从对方好友删除
|
||||
await FriendRelationModel.moveFromFriend(roleId, friend, friendShip, true, !!curFriend); // 删除好友关系并拉黑
|
||||
await FriendApplyModel.deleteApplyByRoles(roleId, hisRoleId); // 删除双方的申请
|
||||
|
||||
let param = new BlackListParam(friend);
|
||||
let isOnline = await isRoleOnline(friend.roleId);
|
||||
|
||||
Reference in New Issue
Block a user