寻宝:用户掉线时清除 redis 中的匹配记录
This commit is contained in:
@@ -7,13 +7,13 @@ import { Application } from 'pinus';
|
|||||||
import {FrontendSession} from 'pinus';
|
import {FrontendSession} from 'pinus';
|
||||||
import { HeroModel } from './../../../db/Hero';
|
import { HeroModel } from './../../../db/Hero';
|
||||||
import { resResult, returnHeroCeRatio, reduceCe } from '../../../pubUtils/util';
|
import { resResult, returnHeroCeRatio, reduceCe } from '../../../pubUtils/util';
|
||||||
import { FUNC_OPT_TYPE } from '../../../consts';
|
import { COM_BTL_QUALITY } from '../../../consts';
|
||||||
import { getAp } from '../../../services/actionPointService';
|
import { getAp } from '../../../services/actionPointService';
|
||||||
import { ItemModel } from '../../../db/Item';
|
import { ItemModel } from '../../../db/Item';
|
||||||
import { chackFunOpenWhenLogin } from '../../../services/funcSwitchService';
|
import { chackFunOpenWhenLogin } from '../../../services/funcSwitchService';
|
||||||
import { loginRefresh } from '../../../services/playerEventService';
|
import { loginRefresh } from '../../../services/playerEventService';
|
||||||
import { getRedis, setRedis, delRedis } from '../../../services/redisService';
|
|
||||||
import { nowSeconds } from '../../../pubUtils/timeUtil';
|
import { nowSeconds } from '../../../pubUtils/timeUtil';
|
||||||
|
import { getRedis, setRedis, delRedis, rmRoleFromQueue } from '../../../services/redisService';
|
||||||
export default function (app: Application) {
|
export default function (app: Application) {
|
||||||
return new EntryHandler(app);
|
return new EntryHandler(app);
|
||||||
}
|
}
|
||||||
@@ -117,6 +117,7 @@ export class EntryHandler {
|
|||||||
let serverId = session.get('serverId');
|
let serverId = session.get('serverId');
|
||||||
let key = 'login_roleId_' + roleId;
|
let key = 'login_roleId_' + roleId;
|
||||||
delRedis(key);
|
delRedis(key);
|
||||||
|
rmRoleFromQueue(roleId, sid, COM_BTL_QUALITY, null); // 删除redis中寻宝的匹配记录
|
||||||
let channelService = this.app.get('channelService');
|
let channelService = this.app.get('channelService');
|
||||||
let channel = channelService.getChannel(roleId, true);
|
let channel = channelService.getChannel(roleId, true);
|
||||||
channel.leave(roleId, sid);
|
channel.leave(roleId, sid);
|
||||||
|
|||||||
@@ -288,7 +288,7 @@ export function updateRobotHurtByTime(teamStatus, roleSt: RoleStatus, interval:
|
|||||||
const timerKey = `${teamStatus.teamCode}_${roleSt.roleId}`;
|
const timerKey = `${teamStatus.teamCode}_${roleSt.roleId}`;
|
||||||
const robotTimer = setInterval(() => {
|
const robotTimer = setInterval(() => {
|
||||||
const robotTotalHurt = teamStatus.bossHp * COM_BTL_CONST.ROBOT_HURT_RATIO;
|
const robotTotalHurt = teamStatus.bossHp * COM_BTL_CONST.ROBOT_HURT_RATIO;
|
||||||
if (roleSt.totalDmg < robotTotalHurt && teamStatus.bossCurHp > 0) {
|
if (roleSt.totalDmg < robotTotalHurt && teamStatus.bossCurHp > 0 && teamMap.has(teamStatus.teamCode)) {
|
||||||
updateRobotHurt(teamStatus, roleSt, channel);
|
updateRobotHurt(teamStatus, roleSt, channel);
|
||||||
handleComBtlProgress(teamStatus, sid, robotHurtTimer, teamMap, channel);
|
handleComBtlProgress(teamStatus, sid, robotHurtTimer, teamMap, channel);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user