统一推送格式
This commit is contained in:
@@ -153,7 +153,7 @@ export class ComBattleHandler {
|
|||||||
channel.add(roleId, sid);
|
channel.add(roleId, sid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
channelService.pushMessageByUids('onTeamJoin', {teamInfo: comTeam}, uids);
|
channelService.pushMessageByUids('onTeamJoin', resResult(STATUS.SUCCESS, {teamInfo: comTeam}), uids);
|
||||||
}
|
}
|
||||||
let thiz = this;
|
let thiz = this;
|
||||||
// 倒计时一定时间给队长匹配机器人
|
// 倒计时一定时间给队长匹配机器人
|
||||||
@@ -166,7 +166,7 @@ export class ComBattleHandler {
|
|||||||
for (let st of robotStArr) {
|
for (let st of robotStArr) {
|
||||||
await ComBattleTeamModel.addRole(teamCode, st);
|
await ComBattleTeamModel.addRole(teamCode, st);
|
||||||
}
|
}
|
||||||
channel.pushMessage('onTeamJoin', {teamInfo: team});
|
channel.pushMessage('onTeamJoin', resResult(STATUS.SUCCESS, {teamInfo: team}));
|
||||||
}
|
}
|
||||||
// TODO: 代码抽象
|
// TODO: 代码抽象
|
||||||
if (team && team.roleIds && team.roleIds.length === 3) {
|
if (team && team.roleIds && team.roleIds.length === 3) {
|
||||||
@@ -243,7 +243,7 @@ export class ComBattleHandler {
|
|||||||
// if (!team) channelService.pushMessageByUids('onTeamJoin', {teamInfo: null}, [{uid: roleId, sid}]);
|
// if (!team) channelService.pushMessageByUids('onTeamJoin', {teamInfo: null}, [{uid: roleId, sid}]);
|
||||||
thiz.teamMap.set(teamCode, comTeam);
|
thiz.teamMap.set(teamCode, comTeam);
|
||||||
// 推送组队消息
|
// 推送组队消息
|
||||||
channelService.pushMessageByUids('onTeamJoin', {teamInfo: comTeam}, [{uid: roleId, sid}]);
|
channelService.pushMessageByUids('onTeamJoin', resResult(STATUS.SUCCESS, {teamInfo: comTeam}), [{uid: roleId, sid}]);
|
||||||
let channel = channelService.getChannel(teamCode, true);
|
let channel = channelService.getChannel(teamCode, true);
|
||||||
let users = channel.getMembers();
|
let users = channel.getMembers();
|
||||||
if (users.indexOf(roleId) === -1) {
|
if (users.indexOf(roleId) === -1) {
|
||||||
@@ -252,7 +252,7 @@ export class ComBattleHandler {
|
|||||||
// 机器人队伍 3 秒直接开战
|
// 机器人队伍 3 秒直接开战
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
await ComBattleTeamModel.updateStatus(teamCode, COM_TEAM_STATUS.FIGHTING);
|
await ComBattleTeamModel.updateStatus(teamCode, COM_TEAM_STATUS.FIGHTING);
|
||||||
channelService.pushMessageByUids('onComBtlStart', {teamCode, roleStatus: comTeam.roleStatus}, [{uid: roleId, sid}]);
|
channelService.pushMessageByUids('onComBtlStart', resResult(STATUS.SUCCESS, {teamCode, roleStatus: comTeam.roleStatus}), [{uid: roleId, sid}]);
|
||||||
}, 3000);
|
}, 3000);
|
||||||
}, COM_BTL_CONST.ASSIST_TIME);
|
}, COM_BTL_CONST.ASSIST_TIME);
|
||||||
return resResult(STATUS.SUCCESS);
|
return resResult(STATUS.SUCCESS);
|
||||||
@@ -315,7 +315,7 @@ export class ComBattleHandler {
|
|||||||
if (users.indexOf(roleId) === -1) {
|
if (users.indexOf(roleId) === -1) {
|
||||||
channel.add(roleId, sid);
|
channel.add(roleId, sid);
|
||||||
}
|
}
|
||||||
channel.pushMessage('onTeamJoin', {teamInfo: teamStatus});
|
channel.pushMessage('onTeamJoin', resResult(STATUS.SUCCESS, {teamInfo: teamStatus}));
|
||||||
|
|
||||||
if (teamStatus.roleIds && teamStatus.roleIds.length === 3) {
|
if (teamStatus.roleIds && teamStatus.roleIds.length === 3) {
|
||||||
let thiz = this;
|
let thiz = this;
|
||||||
@@ -382,7 +382,7 @@ export class ComBattleHandler {
|
|||||||
|
|
||||||
let channelService = this.app.get('channelService');
|
let channelService = this.app.get('channelService');
|
||||||
let channel = channelService.getChannel(teamCode, false);
|
let channel = channelService.getChannel(teamCode, false);
|
||||||
channel.pushMessage('onTeammateReady', {teamCode, roleId, heroes});
|
channel.pushMessage('onTeammateReady', resResult(STATUS.SUCCESS, {teamCode, roleId, heroes}));
|
||||||
return resResult(STATUS.SUCCESS);
|
return resResult(STATUS.SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -412,7 +412,7 @@ export class ComBattleHandler {
|
|||||||
|
|
||||||
let channelService = this.app.get('channelService');
|
let channelService = this.app.get('channelService');
|
||||||
let channel = channelService.getChannel(teamCode, false);
|
let channel = channelService.getChannel(teamCode, false);
|
||||||
channel.pushMessage('onTeammateReady', {teamCode, roleId, heroes});
|
channel.pushMessage('onTeammateReady', resResult(STATUS.SUCCESS, {teamCode, roleId, heroes}));
|
||||||
return resResult(STATUS.SUCCESS);
|
return resResult(STATUS.SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -452,7 +452,7 @@ export class ComBattleHandler {
|
|||||||
if (users.indexOf(roleIdToRm) !== -1) {
|
if (users.indexOf(roleIdToRm) !== -1) {
|
||||||
channel.removeMember(roleIdToRm);
|
channel.removeMember(roleIdToRm);
|
||||||
}
|
}
|
||||||
channel.pushMessage('onLeaveTeam', {teamCode, roleId: roleIdToRm});
|
channel.pushMessage('onLeaveTeam', resResult(STATUS.SUCCESS, {teamCode, roleId: roleIdToRm}));
|
||||||
clearComBtlTimer(teamCode, this.teamDisTimer); // 移除队员停止解散计时
|
clearComBtlTimer(teamCode, this.teamDisTimer); // 移除队员停止解散计时
|
||||||
let thiz = this;
|
let thiz = this;
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
@@ -472,7 +472,7 @@ export class ComBattleHandler {
|
|||||||
for (let st of robotStArr) {
|
for (let st of robotStArr) {
|
||||||
await ComBattleTeamModel.addRole(teamCode, st);
|
await ComBattleTeamModel.addRole(teamCode, st);
|
||||||
}
|
}
|
||||||
channel.pushMessage('onTeamJoin', {teamInfo: team});
|
channel.pushMessage('onTeamJoin', resResult(STATUS.SUCCESS, {teamInfo: team}));
|
||||||
}
|
}
|
||||||
// TODO: 代码抽象
|
// TODO: 代码抽象
|
||||||
if (team && team.roleIds && team.roleIds.length === 3) {
|
if (team && team.roleIds && team.roleIds.length === 3) {
|
||||||
@@ -507,7 +507,7 @@ export class ComBattleHandler {
|
|||||||
|
|
||||||
let channelService = this.app.get('channelService');
|
let channelService = this.app.get('channelService');
|
||||||
let channel = channelService.getChannel(teamCode, false);
|
let channel = channelService.getChannel(teamCode, false);
|
||||||
channel.pushMessage('onTeamDismiss', {teamCode});
|
channel.pushMessage('onTeamDismiss', resResult(STATUS.SUCCESS, {teamCode}));
|
||||||
channel.destroy();
|
channel.destroy();
|
||||||
clearComBtlTimer(teamCode, this.teamDisTimer); // 队伍解散停止解散计时
|
clearComBtlTimer(teamCode, this.teamDisTimer); // 队伍解散停止解散计时
|
||||||
return resResult(STATUS.SUCCESS);
|
return resResult(STATUS.SUCCESS);
|
||||||
@@ -536,7 +536,7 @@ export class ComBattleHandler {
|
|||||||
clearComBtlTimer(teamCode, this.teamDisTimer); // 战斗开始停止解散计时
|
clearComBtlTimer(teamCode, this.teamDisTimer); // 战斗开始停止解散计时
|
||||||
let channelService = this.app.get('channelService');
|
let channelService = this.app.get('channelService');
|
||||||
let channel = channelService.getChannel(teamCode, false);
|
let channel = channelService.getChannel(teamCode, false);
|
||||||
channel.pushMessage('onComBtlStart', {teamCode, roleStatus: teamStatus.roleStatus});
|
channel.pushMessage('onComBtlStart', resResult(STATUS.SUCCESS, {teamCode, roleStatus: teamStatus.roleStatus}));
|
||||||
// 每场倒计时结算
|
// 每场倒计时结算
|
||||||
let thiz = this;
|
let thiz = this;
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
@@ -546,7 +546,7 @@ export class ComBattleHandler {
|
|||||||
let channel = channelService.getChannel(teamCode, false);
|
let channel = channelService.getChannel(teamCode, false);
|
||||||
let team = await ComBattleTeamModel.syncTeamData({teamCode, status: COM_TEAM_STATUS.LOOSE, roleStatus: teamStatus.roleStatus, bossHpArr: teamStatus.bossHpArr});
|
let team = await ComBattleTeamModel.syncTeamData({teamCode, status: COM_TEAM_STATUS.LOOSE, roleStatus: teamStatus.roleStatus, bossHpArr: teamStatus.bossHpArr});
|
||||||
if (!team) return resResult(STATUS.COM_BATTLE_RESULT_ERR);
|
if (!team) return resResult(STATUS.COM_BATTLE_RESULT_ERR);
|
||||||
channel.pushMessage('onTeamComplete', {teamCode, result: false});
|
channel.pushMessage('onTeamComplete', resResult(STATUS.SUCCESS, {teamCode, result: false}));
|
||||||
thiz.teamMap.delete(teamCode);
|
thiz.teamMap.delete(teamCode);
|
||||||
}
|
}
|
||||||
}, COM_BTL_CONST.BTL_TIME_LMT);
|
}, COM_BTL_CONST.BTL_TIME_LMT);
|
||||||
@@ -626,7 +626,7 @@ export class ComBattleHandler {
|
|||||||
let channelService = this.app.get('channelService');
|
let channelService = this.app.get('channelService');
|
||||||
let channel = channelService.getChannel(teamCode, false);
|
let channel = channelService.getChannel(teamCode, false);
|
||||||
const roleStatus = teamStatus.roleStatus.map(st => {return {roleId: st.roleId, totalDmg: st.totalDmg, killed: st.killed}});
|
const roleStatus = teamStatus.roleStatus.map(st => {return {roleId: st.roleId, totalDmg: st.totalDmg, killed: st.killed}});
|
||||||
channel.pushMessage('onTeammateAct', {teamCode, bossCurHp: teamStatus.bossCurHp, bossHpArr: teamStatus.bossHpArr, roleStatus});
|
channel.pushMessage('onTeammateAct', resResult(STATUS.SUCCESS, {teamCode, bossCurHp: teamStatus.bossCurHp, bossHpArr: teamStatus.bossHpArr, roleStatus}));
|
||||||
// 判断战斗是否结束
|
// 判断战斗是否结束
|
||||||
let battleSt = checkComBattleResult(teamStatus);
|
let battleSt = checkComBattleResult(teamStatus);
|
||||||
teamStatus.status = battleSt;
|
teamStatus.status = battleSt;
|
||||||
@@ -648,7 +648,7 @@ export class ComBattleHandler {
|
|||||||
let res = await ItemModel.decreaseItems(teamStatus.capId, [{id: teamStatus.blueprtId, count: 1}]);
|
let res = await ItemModel.decreaseItems(teamStatus.capId, [{id: teamStatus.blueprtId, count: 1}]);
|
||||||
if (res.hasError) return resResult(STATUS.COM_BATTLE_BLUEPRT_NOT_ENOUGH);
|
if (res.hasError) return resResult(STATUS.COM_BATTLE_BLUEPRT_NOT_ENOUGH);
|
||||||
}
|
}
|
||||||
channel.pushMessage('onTeamComplete', {teamCode, result});
|
channel.pushMessage('onTeamComplete', resResult(STATUS.SUCCESS, {teamCode, result}));
|
||||||
this.teamMap.delete(teamCode);
|
this.teamMap.delete(teamCode);
|
||||||
}
|
}
|
||||||
return resResult(STATUS.SUCCESS);
|
return resResult(STATUS.SUCCESS);
|
||||||
@@ -670,14 +670,14 @@ export class ComBattleHandler {
|
|||||||
if (isSuccess && teamStatus.bossCurHp <= 0) {
|
if (isSuccess && teamStatus.bossCurHp <= 0) {
|
||||||
let team = await ComBattleTeamModel.updateResult(teamCode, roleId, isSuccess);
|
let team = await ComBattleTeamModel.updateResult(teamCode, roleId, isSuccess);
|
||||||
if (!team) return resResult(STATUS.COM_BATTLE_RESULT_ERR);
|
if (!team) return resResult(STATUS.COM_BATTLE_RESULT_ERR);
|
||||||
channel.pushMessage('onTeamComplete', {teamCode, result: isSuccess});
|
channel.pushMessage('onTeamComplete', resResult(STATUS.SUCCESS, {teamCode, result: isSuccess}));
|
||||||
} else if (!isSuccess) {
|
} else if (!isSuccess) {
|
||||||
let team = await ComBattleTeamModel.updateResult(teamCode, roleId, isSuccess);
|
let team = await ComBattleTeamModel.updateResult(teamCode, roleId, isSuccess);
|
||||||
if (!team) return resResult(STATUS.COM_BATTLE_RESULT_ERR);
|
if (!team) return resResult(STATUS.COM_BATTLE_RESULT_ERR);
|
||||||
if (team.status === COM_TEAM_STATUS.LOOSE) {
|
if (team.status === COM_TEAM_STATUS.LOOSE) {
|
||||||
channel.pushMessage('onTeamComplete', {teamCode, result: isSuccess});
|
channel.pushMessage('onTeamComplete', resResult(STATUS.SUCCESS, {teamCode, result: isSuccess}));
|
||||||
} else {
|
} else {
|
||||||
channel.pushMessage('onTeammateAct', {teamCode, bossCurHp: teamStatus.bossCurHp, roleStatus: {roleId, battleStatus: 2}});
|
channel.pushMessage('onTeammateAct', resResult(STATUS.SUCCESS, {teamCode, bossCurHp: teamStatus.bossCurHp, roleStatus: {roleId, battleStatus: 2}}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return resResult(STATUS.SUCCESS, { bossCurHp: teamStatus.bossCurHp });
|
return resResult(STATUS.SUCCESS, { bossCurHp: teamStatus.bossCurHp });
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import { Application, ChannelService, FrontendSession, RemoterClass } from 'pinus';
|
import { Application, ChannelService, FrontendSession, RemoterClass } from 'pinus';
|
||||||
|
import { resResult } from '../../../pubUtils/util';
|
||||||
|
import { STATUS } from '../../../consts';
|
||||||
|
|
||||||
export default function (app: Application) {
|
export default function (app: Application) {
|
||||||
return new ComBattleRemote(app);
|
return new ComBattleRemote(app);
|
||||||
@@ -22,7 +24,7 @@ export class ComBattleRemote {
|
|||||||
let param = {
|
let param = {
|
||||||
user: username
|
user: username
|
||||||
};
|
};
|
||||||
channel.pushMessage('onAdd', param);
|
channel.pushMessage('onAdd', resResult(STATUS.SUCCESS, param));
|
||||||
|
|
||||||
if (!!channel) {
|
if (!!channel) {
|
||||||
channel.add(uid, sid);
|
channel.add(uid, sid);
|
||||||
@@ -48,7 +50,7 @@ export class ComBattleRemote {
|
|||||||
let param = {
|
let param = {
|
||||||
user: username
|
user: username
|
||||||
};
|
};
|
||||||
channel.pushMessage('onAdd', param);
|
channel.pushMessage('onAdd', resResult(STATUS.SUCCESS, param));
|
||||||
|
|
||||||
if (!!channel) {
|
if (!!channel) {
|
||||||
channel.add(uid, sid);
|
channel.add(uid, sid);
|
||||||
@@ -108,7 +110,7 @@ export class ComBattleRemote {
|
|||||||
let param = {
|
let param = {
|
||||||
user: username
|
user: username
|
||||||
};
|
};
|
||||||
channel.pushMessage('onLeave', param);
|
channel.pushMessage('onLeave', resResult(STATUS.SUCCESS, param));
|
||||||
}
|
}
|
||||||
|
|
||||||
public async hurt(uid: string, sid: string, name: string, bossHurt: number, actorHurt: [{actorId: number, actorHurt: number}]) {
|
public async hurt(uid: string, sid: string, name: string, bossHurt: number, actorHurt: [{actorId: number, actorHurt: number}]) {
|
||||||
@@ -120,7 +122,7 @@ export class ComBattleRemote {
|
|||||||
if (this.bossHp < 0) {
|
if (this.bossHp < 0) {
|
||||||
this.bossHp = 0;
|
this.bossHp = 0;
|
||||||
}
|
}
|
||||||
channel.pushMessage('bossHp', {bossHp: this.bossHp});
|
channel.pushMessage('bossHp', resResult(STATUS.SUCCESS, {bossHp: this.bossHp}));
|
||||||
}
|
}
|
||||||
return this.bossHp;
|
return this.bossHp;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import {Application, BackendSession} from 'pinus';
|
import {Application, BackendSession} from 'pinus';
|
||||||
|
import { resResult } from '../../../pubUtils/util';
|
||||||
|
import { STATUS } from '../../../consts';
|
||||||
|
|
||||||
|
|
||||||
export default function(app: Application) {
|
export default function(app: Application) {
|
||||||
@@ -29,13 +31,13 @@ export class ChatHandler {
|
|||||||
|
|
||||||
// the target is all users
|
// the target is all users
|
||||||
if (msg.target === '*') {
|
if (msg.target === '*') {
|
||||||
channel.pushMessage('onChat', param);
|
channel.pushMessage('onChat', resResult(STATUS.SUCCESS, param));
|
||||||
}
|
}
|
||||||
// the target is specific user
|
// the target is specific user
|
||||||
else {
|
else {
|
||||||
let tuid = msg.target + '*' + rid;
|
let tuid = msg.target + '*' + rid;
|
||||||
let tsid = channel.getMember(tuid)['sid'];
|
let tsid = channel.getMember(tuid)['sid'];
|
||||||
channelService.pushMessageByUids('onChat', param, [{
|
channelService.pushMessageByUids('onChat', resResult(STATUS.SUCCESS, param), [{
|
||||||
uid: tuid,
|
uid: tuid,
|
||||||
sid: tsid
|
sid: tsid
|
||||||
}]);
|
}]);
|
||||||
@@ -55,13 +57,13 @@ export class ChatHandler {
|
|||||||
|
|
||||||
// the target is all users
|
// the target is all users
|
||||||
if (msg.target === '*') {
|
if (msg.target === '*') {
|
||||||
channel.pushMessage('onChat', param);
|
channel.pushMessage('onChat', resResult(STATUS.SUCCESS, param));
|
||||||
}
|
}
|
||||||
// the target is specific user
|
// the target is specific user
|
||||||
else {
|
else {
|
||||||
let tuid = msg.target + '*' + rid;
|
let tuid = msg.target + '*' + rid;
|
||||||
let tsid = channel.getMember(tuid)['sid'];
|
let tsid = channel.getMember(tuid)['sid'];
|
||||||
channelService.pushMessageByUids('onChat', param, [{
|
channelService.pushMessageByUids('onChat', resResult(STATUS.SUCCESS, param), [{
|
||||||
uid: tuid,
|
uid: tuid,
|
||||||
sid: tsid
|
sid: tsid
|
||||||
}]);
|
}]);
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import { Application, ChannelService, FrontendSession, RemoterClass } from 'pinus';
|
import { Application, ChannelService, FrontendSession, RemoterClass } from 'pinus';
|
||||||
|
import { resResult } from '../../../pubUtils/util';
|
||||||
|
import { STATUS } from '../../../consts';
|
||||||
|
|
||||||
export default function (app: Application) {
|
export default function (app: Application) {
|
||||||
return new ChatRemote(app);
|
return new ChatRemote(app);
|
||||||
@@ -39,7 +41,7 @@ export class ChatRemote {
|
|||||||
let param = {
|
let param = {
|
||||||
user: username
|
user: username
|
||||||
};
|
};
|
||||||
channel.pushMessage('onAdd', param);
|
channel.pushMessage('onAdd', resResult(STATUS.SUCCESS, param));
|
||||||
|
|
||||||
if (!!channel) {
|
if (!!channel) {
|
||||||
channel.add(uid, sid);
|
channel.add(uid, sid);
|
||||||
@@ -87,6 +89,6 @@ export class ChatRemote {
|
|||||||
let param = {
|
let param = {
|
||||||
user: username
|
user: username
|
||||||
};
|
};
|
||||||
channel.pushMessage('onLeave', param);
|
channel.pushMessage('onLeave', resResult(STATUS.SUCCESS, param));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -33,9 +33,7 @@ export class GmHandler {
|
|||||||
let event = await getEvent(eventStatus, roleId, roleName);
|
let event = await getEvent(eventStatus, roleId, roleName);
|
||||||
|
|
||||||
let tsid = channel.getMember(roleId)['sid'];
|
let tsid = channel.getMember(roleId)['sid'];
|
||||||
channelService.pushMessageByUids('onSpecialEvent', {
|
channelService.pushMessageByUids('onSpecialEvent', resResult(STATUS.SUCCESS, { event }), [{
|
||||||
msg: { event }
|
|
||||||
}, [{
|
|
||||||
uid: roleId,
|
uid: roleId,
|
||||||
sid: tsid
|
sid: tsid
|
||||||
}]);
|
}]);
|
||||||
@@ -75,9 +73,7 @@ export class GmHandler {
|
|||||||
|
|
||||||
|
|
||||||
let tsid = channel.getMember(roleId)['sid'];
|
let tsid = channel.getMember(roleId)['sid'];
|
||||||
channelService.pushMessageByUids(eventName, {
|
channelService.pushMessageByUids(eventName, resResult(STATUS.SUCCESS, content), [{
|
||||||
msg: content
|
|
||||||
}, [{
|
|
||||||
uid: roleId,
|
uid: roleId,
|
||||||
sid: tsid
|
sid: tsid
|
||||||
}]);
|
}]);
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import { Application, ChannelService, FrontendSession, RemoterClass } from 'pinus';
|
import { Application, ChannelService, FrontendSession, RemoterClass } from 'pinus';
|
||||||
|
import { resResult } from '../../../pubUtils/util';
|
||||||
|
import { STATUS } from '../../../consts';
|
||||||
|
|
||||||
export default function (app: Application) {
|
export default function (app: Application) {
|
||||||
return new ChatRemote(app);
|
return new ChatRemote(app);
|
||||||
@@ -39,7 +41,7 @@ export class ChatRemote {
|
|||||||
let param = {
|
let param = {
|
||||||
user: username
|
user: username
|
||||||
};
|
};
|
||||||
channel.pushMessage('onAdd', param);
|
channel.pushMessage('onAdd', resResult(STATUS.SUCCESS, param));
|
||||||
|
|
||||||
if (!!channel) {
|
if (!!channel) {
|
||||||
channel.add(uid, sid);
|
channel.add(uid, sid);
|
||||||
@@ -87,6 +89,6 @@ export class ChatRemote {
|
|||||||
let param = {
|
let param = {
|
||||||
user: username
|
user: username
|
||||||
};
|
};
|
||||||
channel.pushMessage('onLeave', param);
|
channel.pushMessage('onLeave', resResult(STATUS.SUCCESS, param));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -88,7 +88,7 @@ export async function towerBattleEnd(sid: string, roleId: string, serverId: numb
|
|||||||
if (reward) towerReward = reward;
|
if (reward) towerReward = reward;
|
||||||
if (towerLv == HANG_UP_CONSTS.ENABLE_LV) {
|
if (towerLv == HANG_UP_CONSTS.ENABLE_LV) {
|
||||||
await startHangUp(roleId, roleName);
|
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 {
|
return {
|
||||||
|
|||||||
@@ -292,9 +292,7 @@ function randomPosition(positionStr: string, prePoint: Array<number>, curPoint:
|
|||||||
function pushEventMsg(sid: string, roleId: string, msg: any ) {
|
function pushEventMsg(sid: string, roleId: string, msg: any ) {
|
||||||
let channelService = pinus.app.get('channelService');
|
let channelService = pinus.app.get('channelService');
|
||||||
|
|
||||||
let param = { msg };
|
channelService.pushMessageByUids('onSpecialEvent', resResult(STATUS.SUCCESS, msg), [{
|
||||||
|
|
||||||
channelService.pushMessageByUids('onSpecialEvent', param, [{
|
|
||||||
uid: roleId,
|
uid: roleId,
|
||||||
sid: sid
|
sid: sid
|
||||||
}]);
|
}]);
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import { BackendSession, FrontendSession, pinus } from "pinus";
|
import { BackendSession, FrontendSession, pinus } from "pinus";
|
||||||
import { getGamedata } from "../pubUtils/gamedata";
|
import { getGamedata } from "../pubUtils/gamedata";
|
||||||
import { RoleModel } from "../db/Role";
|
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)) {
|
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) {
|
if(funcs.length > 0) {
|
||||||
|
|
||||||
pinus.app.get('channelService').pushMessageByUids('onFuncSwitchOn', {funcs}, [{
|
pinus.app.get('channelService').pushMessageByUids('onFuncSwitchOn', resResult(STATUS.SUCCESS, {funcs}), [{
|
||||||
uid: roleId,
|
uid: roleId,
|
||||||
sid: sid
|
sid: sid
|
||||||
}]);
|
}]);
|
||||||
|
|||||||
Reference in New Issue
Block a user