From 35a28245979c620143e4e2e6792ce2446afed5e8 Mon Sep 17 00:00:00 2001 From: luying Date: Sat, 18 Jun 2022 15:16:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A5=BD=E5=8F=8B=EF=BC=9A=E5=9C=A8=E9=BB=91?= =?UTF-8?q?=E5=90=8D=E5=8D=95=E5=86=85=E7=9A=84=E7=8E=A9=E5=AE=B6=E7=9A=84?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=E4=B8=8D=E5=8F=91=E7=BB=99=E6=8B=89=E9=BB=91?= =?UTF-8?q?=E7=9A=84=E9=82=A3=E4=B8=AA=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/servers/role/handler/friendHandler.ts | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/game-server/app/servers/role/handler/friendHandler.ts b/game-server/app/servers/role/handler/friendHandler.ts index 7e16e4523..3d3e4d28a 100644 --- a/game-server/app/servers/role/handler/friendHandler.ts +++ b/game-server/app/servers/role/handler/friendHandler.ts @@ -148,18 +148,21 @@ export class FriendHandler { } else if (type == FRIEND_RELATION_TYPE.MYSELF) { str = getResStr(STATUS.FRIEND_YOURSELF); continue; } - - let incResult = await RoleModel.increaseFriendApplyCnt(hisRoleId, 1, FRIEND.FRIEND_MANAGE_APPLICATION); - if (!incResult) { - str = getResStr(STATUS.FRIEND_HIS_APPLY_MAX); continue; - } - - let apply = await FriendApplyModel.createApply(hisRoleId, role); - resultRoleIds.push(hisRoleId); - let hisOnlineInfo = await getRoleOnlineInfo(hisRoleId); - if (hisOnlineInfo.isOnline) { - let myApply = await getMyApplyParam(apply.applyCode, role); - sendMessageToUserWithSuc(hisRoleId, PUSH_ROUTE.FRIEND_APPLY, { apply: myApply }, hisOnlineInfo.sid); + let hisRelation = await FriendRelationModel.findFriendByRole(hisRoleId, POPULATE_TYPE.NOT); + let hisType = getRecommendType(hisRelation, hisRoleId, roleId); + if(hisType == FRIEND_RELATION_TYPE.NORMAL) { + let incResult = await RoleModel.increaseFriendApplyCnt(hisRoleId, 1, FRIEND.FRIEND_MANAGE_APPLICATION); + if (!incResult) { + str = getResStr(STATUS.FRIEND_HIS_APPLY_MAX); continue; + } + + let apply = await FriendApplyModel.createApply(hisRoleId, role); + resultRoleIds.push(hisRoleId); + let hisOnlineInfo = await getRoleOnlineInfo(hisRoleId); + if (hisOnlineInfo.isOnline) { + let myApply = await getMyApplyParam(apply.applyCode, role); + sendMessageToUserWithSuc(hisRoleId, PUSH_ROUTE.FRIEND_APPLY, { apply: myApply }, hisOnlineInfo.sid); + } } }