推送:对单人推送函数抽象

This commit is contained in:
luying
2022-04-09 10:28:21 +08:00
parent f486a8d8a5
commit 26a649b213
32 changed files with 146 additions and 703 deletions
@@ -11,7 +11,7 @@ import { findIndex, pick } from 'underscore';
import { SclResultInter, SclPosInter } from '../../../pubUtils/interface';
import { SchoolModel } from '../../../db/School';
import { getTeraphStrengthenResult, getSchoolList } from '../../../services/roleService'
import { HERO_SYSTEM_TYPE, LINEUP_NUM, ROLE_SELECT, REDIS_KEY, TASK_TYPE, DEFAULT_HEROES, DEFAULT_HERO_LV, DEFAULT_ITEMS, DEFAULT_EQUIPS, DEFAULT_GOLD, DEFAULT_COIN, DEBUG_MAGIC_WORD, COUNTER, DEFAULT_LV, ITEM_CHANGE_REASON } from '../../../consts';
import { HERO_SYSTEM_TYPE, LINEUP_NUM, ROLE_SELECT, REDIS_KEY, TASK_TYPE, DEFAULT_HEROES, DEFAULT_HERO_LV, DEFAULT_ITEMS, DEFAULT_EQUIPS, DEFAULT_GOLD, DEFAULT_COIN, DEBUG_MAGIC_WORD, COUNTER, DEFAULT_LV, ITEM_CHANGE_REASON, PUSH_ROUTE } from '../../../consts';
import { checkBattleHeroesByHid, roleLevelup } from '../../../services/normalBattleService';
import { Rank } from '../../../services/rankService';
import { updateUserInfo } from '../../../services/redisService';
@@ -26,6 +26,7 @@ import { UserModel } from '../../../db/User';
import { checkFilterWords, reportTAEvent, treatRoleName } from '../../../services/sdkService';
import { createHeroes } from '../../../services/role/createHero';
import { calculateCeWithHero, calculateCeWithRole } from '../../../services/playerCeService';
import { sendMessageToUser, sendMessageToUserWithSuc } from '../../../services/pushService';
export default function (app: Application) {
new HandlerService(app, {});
@@ -468,41 +469,41 @@ export class RoleHandler {
let sid = session.get('sid');
if (type == 1) {
pinus.app.channelService.pushMessageByUids('onPlayTime', resResult(STATUS.SUCCESS, {
sendMessageToUserWithSuc(roleId, PUSH_ROUTE.PLAY_TIME, {
isGuest: true,
guestTime: 60 * 60, // 游客已体验时间
hasAuthenticated: false, // 是否进行过实名认证
isAdult: false, // 是否已成年
todayPlayTime: 60 * 60, // 今天已游戏时长
type: 1
}), [{ uid: roleId, sid: sid }]);
}, sid);
} else if (type == 2) {
pinus.app.channelService.pushMessageByUids('onPlayTime', resResult(STATUS.SUCCESS, {
sendMessageToUserWithSuc(roleId, PUSH_ROUTE.PLAY_TIME, {
isGuest: false,
guestTime: 0, // 游客已体验时间
hasAuthenticated: true, // 是否进行过实名认证
isAdult: false, // 是否已成年
todayPlayTime: 60 * 60, // 今天已游戏时长
type: 2
}), [{ uid: roleId, sid: sid }]);
}, sid);
} else if (type == 3) {
pinus.app.channelService.pushMessageByUids('onPlayTime', resResult(STATUS.SUCCESS, {
sendMessageToUserWithSuc(roleId, PUSH_ROUTE.PLAY_TIME, {
isGuest: false,
guestTime: 0, // 游客已体验时间
hasAuthenticated: true, // 是否进行过实名认证
isAdult: false, // 是否已成年
todayPlayTime: 3 * 60 * 60, // 今天已游戏时长
type: 3
}), [{ uid: roleId, sid: sid }]);
}, sid);
} else if (type == 4) {
pinus.app.channelService.pushMessageByUids('onPlayTime', resResult(STATUS.SUCCESS, {
sendMessageToUserWithSuc(roleId, PUSH_ROUTE.PLAY_TIME, {
isGuest: false,
guestTime: 0, // 游客已体验时间
hasAuthenticated: true, // 是否进行过实名认证
isAdult: false, // 是否已成年
todayPlayTime: 1.5 * 60 * 60, // 今天已游戏时长
type: 4
}), [{ uid: roleId, sid: sid }]);
}, sid);
}
return resResult(STATUS.SUCCESS);