好友:推送申请增加列表
This commit is contained in:
@@ -8,7 +8,7 @@ import { FriendListParam, FriendRecommendParams, BlackListParam, FriendValueList
|
||||
import { FriendShipModel, FriendShipType } from "../../../db/FriendShip";
|
||||
import { FriendRelationModel, Relation } from "../../../db/FriendRelation";
|
||||
import { isRoleOnline, getServerName, getRoleOnlineInfo } from "../../../services/redisService";
|
||||
import { increaseFrdCnt, getRecommendType, sortByBeSentHeart, getApplyList, getFriendList } from "../../../services/friendService";
|
||||
import { increaseFrdCnt, getRecommendType, sortByBeSentHeart, getApplyList, getFriendList, getMyApplyParam, getMyParamAsFriend } from "../../../services/friendService";
|
||||
import { FriendPointModel } from "../../../db/FriendPoint";
|
||||
import { gameData, getDicFriendByLv } from "../../../pubUtils/data";
|
||||
import { addItems, handleCost } from "../../../services/rewardService";
|
||||
@@ -130,7 +130,6 @@ export class FriendHandler {
|
||||
let myFriendRelation = await FriendRelationModel.findFriendByRole(roleId, POPULATE_TYPE.NOT);
|
||||
|
||||
let str = '', resultRoleIds = new Array<string>();
|
||||
let uids = [];
|
||||
for (let hisRoleId of roleIds) {
|
||||
let type = getRecommendType(myFriendRelation, roleId, hisRoleId);
|
||||
if (type == FRIEND_RELATION_TYPE.HAS_FRIEND) {
|
||||
@@ -146,16 +145,17 @@ export class FriendHandler {
|
||||
str = getResStr(STATUS.FRIEND_HIS_APPLY_MAX); continue;
|
||||
}
|
||||
|
||||
await FriendApplyModel.createApply(hisRoleId, role);
|
||||
let apply = await FriendApplyModel.createApply(hisRoleId, role);
|
||||
resultRoleIds.push(hisRoleId);
|
||||
let hisOnlineInfo = await getRoleOnlineInfo(hisRoleId);
|
||||
let uids = [];
|
||||
if (hisOnlineInfo.isOnline) {
|
||||
uids.push({ uid: hisRoleId, sid: hisOnlineInfo.sid });
|
||||
let myApply = await getMyApplyParam(apply.applyCode, role);
|
||||
this.channelService.pushMessageByUids('onFriendApply', resResult(STATUS.SUCCESS, { apply: myApply }), uids);
|
||||
}
|
||||
}
|
||||
|
||||
this.channelService.pushMessageByUids('onFriendApply', resResult(STATUS.SUCCESS, { roleId }), uids);
|
||||
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
isSuccess: str == '',
|
||||
msg: str,
|
||||
@@ -232,7 +232,8 @@ export class FriendHandler {
|
||||
param.setType(FRIEND_RELATION_TYPE.HAS_FRIEND);
|
||||
list.push(param);
|
||||
if (hisOnlineInfo.isOnline) {
|
||||
this.channelService.pushMessageByUids('onFriendAdd', resResult(STATUS.SUCCESS, { friend: param }), [{ uid: friend.roleId, sid: hisOnlineInfo.sid }]);
|
||||
let myParam = await getMyParamAsFriend(friendShip, role, friend.roleId);
|
||||
this.channelService.pushMessageByUids('onFriendAdd', resResult(STATUS.SUCCESS, { friend: myParam }), [{ uid: friend.roleId, sid: hisOnlineInfo.sid }]);
|
||||
}
|
||||
|
||||
resultApplyCodeList.push(apply.applyCode);
|
||||
|
||||
Reference in New Issue
Block a user