军团活动:修复活动结束信号发送bug

This commit is contained in:
luying
2021-03-25 15:37:03 +08:00
parent 0e8a8245a0
commit 7c0ede3e52
8 changed files with 99 additions and 36 deletions
@@ -1,11 +1,11 @@
import { GroupMessageType } from './../../../db/GroupMessage';
import { Application, ChannelService } from 'pinus';
import { resResult } from '../../../pubUtils/util';
import { ON_ADD_CHANNEL_ROUTE, ON_GROUP_MSG_ROUTE, ON_LEAVE_CHANNEL_ROUTE, STATUS } from '../../../consts';
import { ON_ADD_CHANNEL_ROUTE, ON_GROUP_MSG_ROUTE, ON_LEAVE_CHANNEL_ROUTE, STATUS, CHANNEL_PREFIX } from '../../../consts';
import { PrivateMessageType } from '../../../db/PrivateMessage';
import { addUserToChannel, getSimpleRoleInfo } from '../../../services/roleService';
import { ChannelUser } from '../../../domain/ChannelUser';
import { getWorldChannelSid } from '../../../services/chatService';
import { getWorldChannelSid, groupRoomId } from '../../../services/chatService';
export default function (app: Application) {
return new ChatRemote(app);
@@ -172,7 +172,7 @@ export class ChatRemote {
* @param serverId
*/
public async sendGuildActivityEnd(serverId: number) {
let roomId = await getWorldChannelSid(serverId);
let roomId = groupRoomId(CHANNEL_PREFIX.WORLD, serverId);
let channel = this.channelService.getChannel(roomId, false);
if (!channel) return;
channel.pushMessage(this.GUILD_ACTIVITY_END, resResult(STATUS.SUCCESS, { }));
@@ -1,4 +1,7 @@
import { Application, ChannelService } from "pinus";
import { Application, ChannelService, BackendSession } from "pinus";
import { GUILD_ACTIVITY_TYPE, STATUS } from "../../../consts";
import { resResult } from "../../../pubUtils/util";
import { getGuildActivityStatus } from "../../../services/guildActivityService";
export default function (app: Application) {
return new RaceActivityHandler(app);
@@ -11,6 +14,29 @@ export class RaceActivityHandler {
this.channelService = app.get('channelService');
}
private aid = GUILD_ACTIVITY_TYPE.GATE_ACTIVITY; // 蛮夷入侵id
// 进入粮草先行界面
async getRaceActivity(msg: {}, session: BackendSession) {
const roleId = session.get('roleId');
const roleName = session.get('roleName');
const serverId = session.get('serverId');
const guildCode = session.get('guildCode');
if(!guildCode) return resResult(STATUS.GUILD_AUTH_NOT_ENOUGH);
let statusResult = getGuildActivityStatus(this.aid);
if(!statusResult) return resResult(STATUS.DIC_DATA_NOT_FOUND);
return resResult(STATUS.SUCCESS, {
...statusResult,
hasJoin: true,
woodenHorse: {},
guildRank:[]
});
}
}