🐞 fix(gvg): 征战中原遗迹上加字段
This commit is contained in:
@@ -21,7 +21,7 @@ import { RewardInter } from "../../../pubUtils/interface";
|
|||||||
import { getGVGCities, getGVGCitiesInfo } from "../../../services/gvg/gvgBattleService";
|
import { getGVGCities, getGVGCitiesInfo } from "../../../services/gvg/gvgBattleService";
|
||||||
import { GVGRecModel } from "../../../db/GVGRec";
|
import { GVGRecModel } from "../../../db/GVGRec";
|
||||||
import { checkGVGTask } from "../../../services/task/taskService";
|
import { checkGVGTask } from "../../../services/task/taskService";
|
||||||
import { getFightTimeByPeriod, getVestiges } from "../../../services/gvg/gvgFightService";
|
import { getFightTimeByPeriod, getMyVestiges, getVestiges } from "../../../services/gvg/gvgFightService";
|
||||||
import { getSeconds } from "../../../pubUtils/timeUtil";
|
import { getSeconds } from "../../../pubUtils/timeUtil";
|
||||||
|
|
||||||
export default function (app: Application) {
|
export default function (app: Application) {
|
||||||
@@ -78,6 +78,7 @@ export class GVGHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getMap(msg: {}, session: BackendSession) {
|
async getMap(msg: {}, session: BackendSession) {
|
||||||
|
const roleId = session.get('roleId');
|
||||||
const serverId = session.get('serverId');
|
const serverId = session.get('serverId');
|
||||||
const guildCode = session.get('guildCode');
|
const guildCode = session.get('guildCode');
|
||||||
|
|
||||||
@@ -88,7 +89,7 @@ export class GVGHandler {
|
|||||||
let { startFightTime, endFightTime } = getFightTimeByPeriod(period);
|
let { startFightTime, endFightTime } = getFightTimeByPeriod(period);
|
||||||
|
|
||||||
let cities = await getGVGCitiesInfo(myLeague);
|
let cities = await getGVGCitiesInfo(myLeague);
|
||||||
let vestiges = await getVestiges(serverId);
|
let vestiges = await getMyVestiges(serverId, roleId);
|
||||||
|
|
||||||
return resResult(STATUS.SUCCESS, {
|
return resResult(STATUS.SUCCESS, {
|
||||||
configId, period, countdownTime, startFightTime, endFightTime,
|
configId, period, countdownTime, startFightTime, endFightTime,
|
||||||
|
|||||||
@@ -61,6 +61,17 @@ export async function getVestiges(serverId: number) {
|
|||||||
return vestige.vestiges||[];
|
return vestige.vestiges||[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function getMyVestiges(serverId: number, roleId: string) {
|
||||||
|
let vestiges = await getVestiges(serverId);
|
||||||
|
let myRanks = await GVGVestigeRankModel.findAllByRole(roleId);
|
||||||
|
let result: { vestigeId: number, position: string, myRank: number }[] = [];
|
||||||
|
for(let vestige of vestiges) {
|
||||||
|
let myRank = myRanks.find(cur => cur.vestigeId == vestige.vestigeId);
|
||||||
|
result.push({ ...vestige, myRank: myRank?.rank||0 });
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
export async function checkVestige(serverId: number, vestigeId: number) {
|
export async function checkVestige(serverId: number, vestigeId: number) {
|
||||||
let vestiges = await getVestiges(serverId);
|
let vestiges = await getVestiges(serverId);
|
||||||
return !!vestiges.find(cur => cur.vestigeId == vestigeId);
|
return !!vestiges.find(cur => cur.vestigeId == vestigeId);
|
||||||
|
|||||||
Reference in New Issue
Block a user