🐞 fix(gvg): 云台今日贡献的驻扎分显示
This commit is contained in:
@@ -23,6 +23,7 @@ import { GVGRecModel } from "../../../db/GVGRec";
|
||||
import { checkGVGTask } from "../../../services/task/taskService";
|
||||
import { getFightTimeByPeriod, getMyVestiges, getVestiges } from "../../../services/gvg/gvgFightService";
|
||||
import { getSeconds } from "../../../pubUtils/timeUtil";
|
||||
import { GVGVestigeRankModel } from "../../../db/GVGVestigeRank";
|
||||
|
||||
export default function (app: Application) {
|
||||
new HandlerService(app, {});
|
||||
@@ -202,9 +203,10 @@ export class GVGHandler {
|
||||
}
|
||||
|
||||
const userDailyData = await GVGUserDailyDataModel.findByRole(configId, myLeague.leagueCode, roleId);
|
||||
const myRanks = await GVGVestigeRankModel.findAllByRole(roleId);
|
||||
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
myDistribute: getMyDistribute(userDailyData),
|
||||
myDistribute: getMyDistribute(userDailyData, myRanks),
|
||||
list: result
|
||||
});
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import { arrToMap, getArrayOfNumber, getRandEelm, getRandValueByMinMax, parseGoo
|
||||
import { addGVGReward } from "./gvgItemService";
|
||||
import { getGVGConfig } from "./gvgService";
|
||||
import { getProduceCoinCnt } from "./gvgItemService";
|
||||
import { GVGLeagueFarmRecModel } from "../../db/GVGLeagueFarmRec";
|
||||
import { GVGVestigeRankModel } from "../../db/GVGVestigeRank";
|
||||
import { addResourceRecord } from "./gvgRecService";
|
||||
|
||||
export function checkPreTech(techId: number, activeQueue: number[], techQueue: Tech[]) {
|
||||
@@ -90,12 +90,17 @@ export async function getDailyLoginReward(roleId: string, roleName: string, sid:
|
||||
return null;
|
||||
}
|
||||
|
||||
export function getMyDistribute(userDailyData: GVGUserDailyDataType) {
|
||||
export function getMyDistribute(userDailyData: GVGUserDailyDataType, myRanks: {vestigeId: number, rank: number}[]) {
|
||||
let score = 0;
|
||||
for(let { vestigeId, rank} of myRanks) {
|
||||
let dicRankMap = gameData.gvgVestige.get(vestigeId);
|
||||
if(dicRankMap && dicRankMap.get(rank)) score += dicRankMap.get(rank).score;
|
||||
}
|
||||
return {
|
||||
food: userDailyData?.food||0,
|
||||
mineral: userDailyData?.mineral||0,
|
||||
wood: userDailyData?.wood||0,
|
||||
score: userDailyData?.score||0,
|
||||
score: userDailyData?.score||score,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,8 +127,9 @@ export async function addResource(leagueCode: string, roleId: string, roleName:
|
||||
await GVGUserDataModel.addResource(configId, leagueCode, roleId, food, mineral, wood);
|
||||
// 个人今日贡献更新
|
||||
let userDailyData = await GVGUserDailyDataModel.addResource(configId, leagueCode, roleId, food, mineral, wood);
|
||||
let myRanks = await GVGVestigeRankModel.findAllByRole(roleId);
|
||||
|
||||
let myDistribute = getMyDistribute(userDailyData);
|
||||
let myDistribute = getMyDistribute(userDailyData, myRanks);
|
||||
addResourceRecord(roleId, roleName, leagueCode, resourceType, count);
|
||||
|
||||
return { resource: league.resources, leagueLv: league.lv, myDistribute }
|
||||
|
||||
Reference in New Issue
Block a user