推送:对单人推送函数抽象
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Application, BackendSession, ChannelService, HandlerService, } from "pinus";
|
||||
import { resResult, getRandEelm, getResStr, shouldRefresh, sortArrRandom, checkRoleIsRobot, getRobotSysType, makeRobotId, parseNumberList } from "../../../pubUtils/util";
|
||||
import { STATUS, ROLE_SELECT, FRIEND_DROP_TYPE, FRIEND_RELATION_TYPE, POPULATE_TYPE, BLOCK_OPEATE, CONSUME_TYPE, ITID, HERO_SELECT, REDIS_KEY, MSG_SOURCE, MSG_TYPE, TASK_TYPE, ROBOT_SYS_TYPE, ITEM_CHANGE_REASON } from "../../../consts";
|
||||
import { STATUS, ROLE_SELECT, FRIEND_DROP_TYPE, FRIEND_RELATION_TYPE, POPULATE_TYPE, BLOCK_OPEATE, CONSUME_TYPE, ITID, HERO_SELECT, REDIS_KEY, MSG_SOURCE, MSG_TYPE, TASK_TYPE, ROBOT_SYS_TYPE, ITEM_CHANGE_REASON, PUSH_ROUTE } from "../../../consts";
|
||||
import { RoleModel, RoleType } from "../../../db/Role";
|
||||
import { getTimeFun, getZeroPointD } from "../../../pubUtils/timeUtil";
|
||||
import { FriendApplyModel } from "../../../db/FriendApply";
|
||||
@@ -23,6 +23,7 @@ import { checkTaskWithRoles, checkTask } from "../../../services/task/taskServic
|
||||
import { ComBattleTeamModel } from "../../../db/ComBattleTeam";
|
||||
import { JewelModel } from "../../../db/Jewel";
|
||||
import { getHeroesAttributes } from "../../../services/playerCeService";
|
||||
import { sendMessageToUsersWithSuc, sendMessageToUserWithSuc } from "../../../services/pushService";
|
||||
|
||||
|
||||
export default function (app: Application) {
|
||||
@@ -155,11 +156,9 @@ export class FriendHandler {
|
||||
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);
|
||||
sendMessageToUserWithSuc(hisRoleId, PUSH_ROUTE.FRIEND_APPLY, { apply: myApply }, hisOnlineInfo.sid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,7 +239,7 @@ export class FriendHandler {
|
||||
list.push(param);
|
||||
if (hisOnlineInfo.isOnline) {
|
||||
let myParam = await getMyParamAsFriend(friendShip, role, friend.roleId);
|
||||
this.channelService.pushMessageByUids('onFriendAdd', resResult(STATUS.SUCCESS, { friend: myParam }), [{ uid: friend.roleId, sid: hisOnlineInfo.sid }]);
|
||||
sendMessageToUserWithSuc(friend.roleId, PUSH_ROUTE.FRIEND_APPLY, { friend: myParam }, hisOnlineInfo.sid);
|
||||
}
|
||||
|
||||
resultApplyCodeList.push(apply.applyCode);
|
||||
@@ -412,7 +411,7 @@ export class FriendHandler {
|
||||
let hisOnlineInfo = await getRoleOnlineInfo(hisRoleId);
|
||||
if(hisOnlineInfo) {
|
||||
let myApply = await getMyApplyParam(apply.applyCode, role);
|
||||
this.channelService.pushMessageByUids('onFriendApply', resResult(STATUS.SUCCESS, { apply: myApply }), [{uid: hisRoleId, sid: hisOnlineInfo.sid}]);
|
||||
sendMessageToUserWithSuc(friend.roleId, PUSH_ROUTE.FRIEND_APPLY, { apply: myApply }, hisOnlineInfo.sid);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -490,7 +489,8 @@ export class FriendHandler {
|
||||
uids.push({ uid: relation.roleId, sid: hisOnlineInfo.sid });
|
||||
}
|
||||
}
|
||||
this.channelService.pushMessageByUids('onFriendSendHeart', resResult(STATUS.SUCCESS, { roleId }), uids);
|
||||
|
||||
sendMessageToUsersWithSuc(PUSH_ROUTE.FRIEND_SEND_HEART, { roleId }, uids);
|
||||
if (todaySendInc <= 0) return resResult(STATUS.FRIEND_HAS_SENT);
|
||||
|
||||
// 更新情谊值
|
||||
|
||||
Reference in New Issue
Block a user