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

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
+3 -7
View File
@@ -2,11 +2,12 @@ import { FrontendOrBackendSession, pinus } from 'pinus';
import EventRecord, { EventRecordModel } from '../db/EventRecord';
import { RoleModel } from '../db/Role';
import { genCode, getRandEelmWithWeight, resResult, getRandSingleEelm } from '../pubUtils/util';
import { EVENT_STATUS, EVENT_RECORD_STATUS, EVENT_TYPE, EVENT_RANDOM_TYPE_ONE_OPEN, EVENT_QUIZ_NUM, EVENT_ANSWER_STATUS, FUNCS_ID } from '../consts';
import { EVENT_STATUS, EVENT_RECORD_STATUS, EVENT_TYPE, EVENT_RANDOM_TYPE_ONE_OPEN, EVENT_QUIZ_NUM, EVENT_ANSWER_STATUS, FUNCS_ID, PUSH_ROUTE } from '../consts';
import { EVENT_REFRESH_NUM } from '../consts';
import { STATUS } from '../consts/statusCode';
import { gameData } from '../pubUtils/data';
import { DicQuestion } from '../pubUtils/dictionary/DicQuestion';
import { sendMessageToUserWithSuc } from './pushService';
/**
* 从检查接口调用,检查是否有这么个战斗,顺便保存一下battleCode
@@ -266,12 +267,7 @@ function randomPosition(positionArr: number[], prePoint: Array<number>, curPoint
* @param msg
*/
function pushEventMsg(sid: string, roleId: string, msg: any ) {
let channelService = pinus.app.get('channelService');
channelService.pushMessageByUids('onSpecialEvent', resResult(STATUS.SUCCESS, msg), [{
uid: roleId,
sid: sid
}]);
sendMessageToUserWithSuc(roleId, PUSH_ROUTE.SEND_EVENT, msg, sid);
}
/**