诸侯混战:修复重复打开不同城门推送问题
This commit is contained in:
@@ -19,6 +19,7 @@ import { sendMessageToCityWithSuc } from "../../../services/pushService";
|
||||
import { isDebugTime } from "../../../pubUtils/sdkUtil";
|
||||
import { GuildActivityCityDeclareModel } from "../../../db/GuildActivityCityDeclare";
|
||||
import { GuildModel } from "../../../db/Guild";
|
||||
import { getHistoryCity, setHistoryCity } from "../../../services/redisService";
|
||||
|
||||
export default function (app: Application) {
|
||||
new HandlerService(app, {});
|
||||
@@ -97,13 +98,12 @@ export class CityActivityHandler {
|
||||
obj.pushGuild(guildCode, serverId, cityId);
|
||||
}
|
||||
|
||||
let historyCity = obj.getHistoryCity(roleId);
|
||||
let historyCity = await getHistoryCity(roleId);
|
||||
if (historyCity) {
|
||||
await leaveCityChannel(roleId, sid, historyCity);
|
||||
}
|
||||
await addRoleToCityChannel(roleId, sid, cityId);
|
||||
obj.setHistoryCity(roleId, cityId);
|
||||
|
||||
await setHistoryCity(roleId, cityId);
|
||||
|
||||
let ranks = await getCityActivityRank(guildCode, serverId, cityId, roleId, roleName);
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ export class CityActivityObject {
|
||||
private members: Map<string, Array<Member>> = new Map(); // 每个军团参与的成员 guildCode => [{roleId, job}]
|
||||
private cities: Map<string, string[]> = new Map(); // 各个城池参与的军团 serverId&cityId => [guildCode]
|
||||
private guilds: Map<string, number> = new Map(); // 军团所在的城池 guildCode => cityId
|
||||
private historyCity: Map<string, number> = new Map(); // 获取自己打开过的城池的页面 roleId => cityId
|
||||
private sentCity: string[] = [];
|
||||
private startTime: number = 0;
|
||||
|
||||
@@ -112,15 +111,6 @@ export class CityActivityObject {
|
||||
return { gateHp, maxHp: this.maxHp.get(key)||0 }
|
||||
}
|
||||
|
||||
public getHistoryCity(roleId: string) {
|
||||
return this.historyCity.get(roleId)
|
||||
}
|
||||
|
||||
public setHistoryCity(roleId: string, cityId: number) {
|
||||
return this.historyCity.set(roleId, cityId);
|
||||
}
|
||||
|
||||
|
||||
public pushMembers(guildCode: string, roleId: string, job: number, code: string) {
|
||||
|
||||
if(this.members.has(guildCode)) {
|
||||
|
||||
@@ -664,4 +664,14 @@ export async function redisSubScribe() {
|
||||
}
|
||||
});
|
||||
}
|
||||
/*************** 订阅短链接redis *******/
|
||||
/*************** 订阅短链接redis *******/
|
||||
|
||||
/***诸侯混战 */
|
||||
export async function getHistoryCity(roleId: string) {
|
||||
return await redisClient().hgetAsync(REDIS_KEY.GA_HISTORY_CITY, `${roleId}`);
|
||||
}
|
||||
|
||||
export async function setHistoryCity(roleId: string, cityId: number) {
|
||||
await redisClient().hsetAsync(REDIS_KEY.GA_HISTORY_CITY, `${roleId}`, cityId);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user