🐞 fix(每周结算): 更新活跃值
This commit is contained in:
@@ -9,7 +9,7 @@ import { findWhere } from 'underscore'
|
||||
import { GUILD_STRUCTURE, GUILD_BOSS_STATUS, GUILD_POINT_WAYS } from '../../../consts/constModules/guildConst';
|
||||
import { DATA_NAME } from '../../../consts/dataName';
|
||||
import { UserGuildModel } from '../../../db/UserGuild';
|
||||
import { addActive, getBossWarExtendActive } from '../../../services/guildService';
|
||||
import { addActive, addBossWarExtendActive } from '../../../services/guildService';
|
||||
import { GuildModel } from '../../../db/Guild';
|
||||
import { gameData, getBossByLv } from '../../../pubUtils/data';
|
||||
import { lockData } from '../../../services/redLockService';
|
||||
@@ -197,8 +197,8 @@ export class GuildHandler {
|
||||
await pushBossStatus(guildCode, result);
|
||||
pushGuildBossSucMsg(roleId, roleName, guildCode, bossInstance);
|
||||
|
||||
await addActive(roleId, serverId, GUILD_POINT_WAYS.BOSS_WAR_EXTEND, null, await getBossWarExtendActive(bossCode, roleId));//获得活跃值
|
||||
|
||||
await addBossWarExtendActive(bossCode, serverId)
|
||||
|
||||
res.releaseCallback();//解锁
|
||||
return resResult(STATUS.SUCCESS, { bossHp: 0 });
|
||||
} else {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { gameData, getGuildActiveWeekReward, getGuildActiveByIdAndType, getGoodById } from "../pubUtils/data";
|
||||
import { GuildModel, GuildType, GuildUpdateParam } from "../db/Guild";
|
||||
import { deltaDays, resResult, shouldRefresh } from "../pubUtils/util";
|
||||
import { STATUS, MAIL_TYPE, GUILD_AUTH, GUILD_JOB, REDIS_KEY, CHAT_SERVER, TASK_TYPE, COUNTER, GUILD_REC_TYPE, PUSH_ROUTE, WAR_TYPE, USER_GUILD_STATUS } from "../consts";
|
||||
import { STATUS, MAIL_TYPE, GUILD_AUTH, GUILD_JOB, REDIS_KEY, CHAT_SERVER, TASK_TYPE, COUNTER, GUILD_REC_TYPE, PUSH_ROUTE, WAR_TYPE, USER_GUILD_STATUS, GUILD_POINT_WAYS } from "../consts";
|
||||
import { RoleModel, RoleType } from "../db/Role";
|
||||
import { UserGuildModel, UserGuildType, WishGood } from "../db/UserGuild";
|
||||
import { UserGuildApplyModel } from "../db/UserGuildApply";
|
||||
@@ -167,19 +167,21 @@ export async function getGuildActiveByRefTime(guildCode: string, refTime: Date)
|
||||
* @param roleId
|
||||
* @returns
|
||||
*/
|
||||
export async function getBossWarExtendActive(code: string, roleId: string) {
|
||||
export async function addBossWarExtendActive(code: string, serverId: number) {
|
||||
const bossInstance = await BossInstanceModel.findByCode(code);
|
||||
if (!bossInstance || !bossInstance.ranks || bossInstance.ranks.length == 0) return 0;
|
||||
let ranks = bossInstance.ranks;
|
||||
ranks.sort((obj1, obj2) => obj2.score - obj1.score);
|
||||
const index = ranks.findIndex((obj) => obj.roleId == roleId) + 1;
|
||||
|
||||
const dicBossRankActivePoint = gameData.bossRankActivePoint;
|
||||
const foundEntry = dicBossRankActivePoint.find(
|
||||
(entry) => index >= entry.bossRankMin && index <= entry.bossRankMax
|
||||
);
|
||||
ranks.forEach(async (ele, index) => {
|
||||
const rank = index + 1;
|
||||
const foundEntry = dicBossRankActivePoint.find(
|
||||
(entry) => rank >= entry.bossRankMin && rank <= entry.bossRankMax
|
||||
);
|
||||
|
||||
return foundEntry ? foundEntry.activePoint : 0;
|
||||
await addActive(ele.roleId, serverId, GUILD_POINT_WAYS.BOSS_WAR_EXTEND, null, (foundEntry ? foundEntry.activePoint : 0));//获得活跃值
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -199,7 +201,7 @@ export async function addActive(roleId: string, serverId: number, id: number, ty
|
||||
if (!active) {
|
||||
active = getGuildActiveByIdAndType(id, type);
|
||||
}
|
||||
|
||||
|
||||
let userGuild = await getUserGuildWithRefActive(roleId, 'activeRecord receivedActive activeDaily activeWeekly guildCode');
|
||||
if (!userGuild) return { status: 0, resResult: resResult(STATUS.GUILD_NOT_FOUND) };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user