巅峰演武:赛季优化修改
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Application, BackendSession } from "pinus";
|
||||
import { Application, BackendSession, pinus } from "pinus";
|
||||
import { gameData, hasShopType } from "../../../pubUtils/data";
|
||||
import { parseGoodStr, resResult } from "../../../pubUtils/util";
|
||||
import { STATUS, GUILD_STRUCTURE, ITID, CONSUME_TYPE, HERO_QUALITY_TYPE, HERO_GROW_MAX, ITEM_CHANGE_REASON } from "../../../consts";
|
||||
@@ -51,6 +51,7 @@ export class ShopHandler {
|
||||
let roleName = session.get('roleName');
|
||||
let sid = session.get('sid');
|
||||
let serverId = session.get('serverId');
|
||||
let seasonNum = pinus.app.get('pvpSeasonNum');
|
||||
|
||||
let { activityId = 0, shopItemId, count } = msg;
|
||||
|
||||
@@ -58,7 +59,7 @@ export class ShopHandler {
|
||||
if(!dicShopItem) return resResult(STATUS.DIC_DATA_NOT_FOUND);
|
||||
if(dicShopItem['productID'] && dicShopItem['productID'] != '&') return resResult(STATUS.CAN_NOT_PURCHASE);
|
||||
|
||||
let userShop = await UserShopModel.findByRoleAndItem(roleId, activityId, dicShopItem);
|
||||
let userShop = await UserShopModel.findByRoleAndItem(roleId, activityId, dicShopItem, seasonNum);
|
||||
|
||||
let checkResult = await checkShopInPurchase(session, activityId, count, userShop?.count||0, dicShopItem);
|
||||
if(checkResult.code != STATUS.SUCCESS.code) {
|
||||
@@ -71,7 +72,7 @@ export class ShopHandler {
|
||||
if(!costResult) return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH);
|
||||
|
||||
// 次数
|
||||
userShop = await UserShopModel.purchase(roleId, roleName, activityId, dicShopItem, count);
|
||||
userShop = await UserShopModel.purchase(roleId, roleName, activityId, dicShopItem, count, seasonNum);
|
||||
if(!userShop) return resResult(STATUS.BUY_COUNT_OVER);
|
||||
|
||||
// 获得
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
import { Application, ChannelService, HandlerService, } from 'pinus';
|
||||
// import { sendRolesMails } from '../../../services/mailService';
|
||||
import { reloadResources } from '../../../pubUtils/data';
|
||||
import { HeroUpdate } from '../../../db/Hero';
|
||||
import { RoleUpdate } from '../../../db/Role';
|
||||
import { SkinUpdate } from '../../../db/Skin';
|
||||
import { RankFirstModel, RankFirstType } from '../../../db/RankFirst';
|
||||
import { Figure } from '../../../domain/dbGeneral';
|
||||
import { PVPConfigModel, PVPConfigType } from '../../../db/SystemConfig';
|
||||
import { PVPConfigModel, PVPConfigType } from '../../../db/PvpConfig';
|
||||
import { treatRoleName, taflush, sendSurveyMail } from '../../../services/sdkService';
|
||||
import { getServerMainten, setServerMainten, stopServerMainten } from '../../../services/gmService';
|
||||
import { errlogger } from '../../../util/logger';
|
||||
import { setApiIsClose } from '../../../services/chatService';
|
||||
import { setPvpSeasonNum, setPvpSettleSeasonNum } from '../../../services/timeTaskService';
|
||||
|
||||
export default function (app: Application) {
|
||||
new HandlerService(app, {});
|
||||
@@ -23,7 +20,6 @@ export class RoleRemote {
|
||||
this.app = app;
|
||||
// this.channelService = app.get('channelService');
|
||||
this.loadRankFirst();
|
||||
this.initPvpSeasonNum();
|
||||
}
|
||||
// private channelService: ChannelService;
|
||||
|
||||
@@ -74,21 +70,17 @@ export class RoleRemote {
|
||||
}
|
||||
|
||||
|
||||
public setPvpSeasonNum(pvpConfig: PVPConfigType) {
|
||||
public async setPvpSeasonNum(pvpConfig: PVPConfigType) {
|
||||
try {
|
||||
if(pvpConfig) {
|
||||
this.app.set('pvpSeasonNum', pvpConfig.seasonNum);
|
||||
this.app.set('pvpSeasonEndTime', pvpConfig.seasonEndTime);
|
||||
}
|
||||
await setPvpSeasonNum(pvpConfig);
|
||||
} catch(e) {
|
||||
errlogger.error(`remote ${__filename} \n ${e.stack}`);
|
||||
}
|
||||
}
|
||||
|
||||
public async initPvpSeasonNum() {
|
||||
public async setPvpSettleSeasonNum(pvpConfig: PVPConfigType) {
|
||||
try {
|
||||
let pvpConfig = await PVPConfigModel.findCurPVPConfig();
|
||||
this.setPvpSeasonNum(pvpConfig);
|
||||
await setPvpSettleSeasonNum(pvpConfig);
|
||||
} catch(e) {
|
||||
errlogger.error(`remote ${__filename} \n ${e.stack}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user