统一推送格式

This commit is contained in:
luying
2020-12-30 11:03:45 +08:00
parent 3677d99d60
commit d6b4f1d62d
9 changed files with 44 additions and 40 deletions
+1 -1
View File
@@ -88,7 +88,7 @@ export async function towerBattleEnd(sid: string, roleId: string, serverId: numb
if (reward) towerReward = reward;
if (towerLv == HANG_UP_CONSTS.ENABLE_LV) {
await startHangUp(roleId, roleName);
pinus.app.get('channelService').pushMessageByUids('hangUpEnable', {code: 200, data: {enable: true}}, [{uid: roleId, sid}]);
pinus.app.get('channelService').pushMessageByUids('hangUpEnable', resResult(STATUS.SUCCESS, {enable: true}), [{uid: roleId, sid}]);
}
}
return {
+1 -3
View File
@@ -292,9 +292,7 @@ function randomPosition(positionStr: string, prePoint: Array<number>, curPoint:
function pushEventMsg(sid: string, roleId: string, msg: any ) {
let channelService = pinus.app.get('channelService');
let param = { msg };
channelService.pushMessageByUids('onSpecialEvent', param, [{
channelService.pushMessageByUids('onSpecialEvent', resResult(STATUS.SUCCESS, msg), [{
uid: roleId,
sid: sid
}]);
@@ -1,6 +1,8 @@
import { BackendSession, FrontendSession, pinus } from "pinus";
import { getGamedata } from "../pubUtils/gamedata";
import { RoleModel } from "../db/Role";
import { resResult } from "../pubUtils/util";
import { STATUS } from "../consts";
// 开启功能
export async function switchOnFunc(roleId: string, type: number, param: number, session: (BackendSession|FrontendSession)) {
@@ -19,7 +21,7 @@ export async function switchOnFunc(roleId: string, type: number, param: number,
if(funcs.length > 0) {
pinus.app.get('channelService').pushMessageByUids('onFuncSwitchOn', {funcs}, [{
pinus.app.get('channelService').pushMessageByUids('onFuncSwitchOn', resResult(STATUS.SUCCESS, {funcs}), [{
uid: roleId,
sid: sid
}]);