pvp:重写pvp定时器任务逻辑
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import { gameData, getGuildActiveWeekReward, getGuildActiveByIdAndType, getGoodById } from "../pubUtils/data";
|
||||
import { GuildModel, GuildType } from "../db/Guild";
|
||||
import { resResult, shouldRefresh } from "../pubUtils/util";
|
||||
import { STATUS, MAIL_TYPE, GUILD_AUTH, GUILD_JOB, REDIS_KEY, CHAT_SERVER, TASK_TYPE } from "../consts";
|
||||
import { STATUS, MAIL_TYPE, GUILD_AUTH, GUILD_JOB, REDIS_KEY, CHAT_SERVER, TASK_TYPE, COUNTER } from "../consts";
|
||||
import { RoleModel, RoleType } from "../db/Role";
|
||||
import { UserGuildModel, UserGuildType } from "../db/UserGuild";
|
||||
import { UserGuildApplyModel } from "../db/UserGuildApply";
|
||||
import { SystemConfigModel } from "../db/SystemConfig";
|
||||
import { PVPConfigModel } from "../db/SystemConfig";
|
||||
import { nowSeconds } from "../pubUtils/timeUtil";
|
||||
import { pinus, BackendSession, FrontendOrBackendSession } from "pinus";
|
||||
import { ARMY } from "../pubUtils/dicParam";
|
||||
@@ -17,17 +17,18 @@ import { DATA_NAME } from '../consts/dataName';
|
||||
import { addRoleToGuildChannel } from "./chatService";
|
||||
import { Rank } from "./rankService";
|
||||
import { checkActivityTask, checkTask } from "./taskService";
|
||||
import { CounterModel } from "../db/Counter";
|
||||
|
||||
export async function getMyGuildInfo(roleId: string, sid: string, userGuild: UserGuildType, guild: GuildType, serverId: number, session: FrontendOrBackendSession) {
|
||||
|
||||
|
||||
let leader = <RoleType>guild.leader;
|
||||
let leaderIsOnline = await isRoleOnline(leader.roleId);
|
||||
|
||||
// 打开公会页面,加入channel
|
||||
if(userGuild.guildCode) {
|
||||
if (userGuild.guildCode) {
|
||||
addRoleToGuildChannel(roleId, sid, guild.code);
|
||||
session.set('guildCode', guild.code);
|
||||
session.push('guildCode', () => {});
|
||||
session.push('guildCode', () => { });
|
||||
}
|
||||
|
||||
// 获取排行榜
|
||||
@@ -39,7 +40,7 @@ export async function getMyGuildInfo(roleId: string, sid: string, userGuild: Use
|
||||
let guildMemberMax = dicGuild && memberCnt >= dicGuild.peopleNum;
|
||||
|
||||
// 返回
|
||||
return { hasGuild: true, guildMemberMax, ...guild, leader: { ...leader, isOnline: leaderIsOnline }, rank, myInfo: {...userGuild }};
|
||||
return { hasGuild: true, guildMemberMax, ...guild, leader: { ...leader, isOnline: leaderIsOnline }, rank, myInfo: { ...userGuild } };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -225,7 +226,7 @@ export async function getUserGuildWithRefActive(roleId: string, select?: string,
|
||||
return;
|
||||
for (let i = 0; i < drawCnt; i++) {
|
||||
let donateName = donateNames[donateNames.length - i - 1];
|
||||
await sendMailByContent(MAIL_TYPE.WISH_POOL_REWARD, roleId, {
|
||||
await sendMailByContent(MAIL_TYPE.WISH_POOL_REWARD, roleId, {
|
||||
params: [donateName, goodInfo.name],
|
||||
goods: [{ id: goodId, count: drawCnt }],
|
||||
notPush
|
||||
@@ -304,7 +305,8 @@ export async function settleGuildWeekly() {
|
||||
res.releaseCallback();//解锁
|
||||
}
|
||||
await initSingleRank(REDIS_KEY.GUILD_ACTIVE_RANK);
|
||||
await SystemConfigModel.updateSystemConfig({ settleGuildWeeklyTime: nowSeconds() }); // 记录一下
|
||||
let curSeasonNum = await CounterModel.getCounter(COUNTER.PVP_SEASON_NUM);
|
||||
await PVPConfigModel.updatePVPConfig(curSeasonNum, { settleGuildWeeklyTime: nowSeconds() }); // 记录一下,不知道原作者有什么用处...
|
||||
console.log('————— settleGuildWeekly结束 —————');
|
||||
}
|
||||
|
||||
@@ -314,10 +316,10 @@ export async function getWishPool(userGuild: UserGuildType) {
|
||||
|
||||
let userGuilds = await UserGuildModel.getWishPoolGoods(code, ' wishDntCnt wishGoods roleId');
|
||||
let list = [];
|
||||
userGuilds.map(({ wishGoods, roleId })=>{
|
||||
wishGoods.map(({ type, goodId, count, receiveCnt, drawCnt, id })=>{
|
||||
userGuilds.map(({ wishGoods, roleId }) => {
|
||||
wishGoods.map(({ type, goodId, count, receiveCnt, drawCnt, id }) => {
|
||||
list.push({ type, goodId, count, receiveCnt, drawCnt, id, roleId })
|
||||
});
|
||||
});
|
||||
return { list, wishDntCnt:wishDntCnt||0, wishGoods };
|
||||
return { list, wishDntCnt: wishDntCnt || 0, wishGoods };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user