军团活动测试:debug诸侯混战挑战时间
This commit is contained in:
@@ -10,12 +10,13 @@ import { UserGuildModel } from "../../../db/UserGuild";
|
||||
import { GuildActivityRecordModel } from "../../../db/GuildActivityRec";
|
||||
import { nowSeconds, getTimeFun } from "../../../pubUtils/timeUtil";
|
||||
import { getGoldObject } from "../../../pubUtils/itemUtils";
|
||||
import { GUILDACTIVITY } from "../../../pubUtils/dicParam";
|
||||
import { GUILDACTIVITY, SERVER_DEBUG_MODE } from "../../../pubUtils/dicParam";
|
||||
import { handleCost } from "../../../services/rewardService";
|
||||
import { addActive } from "../../../services/guildService";
|
||||
import { Rank } from "../../../services/rankService";
|
||||
import { checkActivityTask, checkTask } from "../../../services/taskService";
|
||||
import { guildInter } from "../../../pubUtils/interface";
|
||||
import { dispatch } from "../../../pubUtils/dispatcher";
|
||||
|
||||
export default function (app: Application) {
|
||||
new HandlerService(app, {});
|
||||
@@ -69,7 +70,10 @@ export class CityActivityHandler {
|
||||
let obj = getCityActivityObj();
|
||||
let gateHp = obj.getGateHpAndInc(serverId, cityId, dicCity.hp);
|
||||
|
||||
let myGuildActivityRec = await UserGuildActivityRecModel.findByRoleId(roleId, this.aid);
|
||||
let guildActivityRec = await GuildActivityRecordModel.getRecord(guildCode, serverId, this.aid);
|
||||
if (!guildActivityRec) return resResult(STATUS.INTERNAL_ERR);
|
||||
|
||||
let myGuildActivityRec = await UserGuildActivityRecModel.findByRoleId(roleId, guildActivityRec.code);
|
||||
let challengeTime = 0;
|
||||
if (myGuildActivityRec) {
|
||||
challengeTime = myGuildActivityRec.challengeTime;
|
||||
@@ -278,7 +282,13 @@ export class CityActivityHandler {
|
||||
if (!dicCity) return resResult(STATUS.DIC_DATA_NOT_FOUND);
|
||||
|
||||
// 更新userGuildActivityRecord
|
||||
let challengeTime = <number>getTimeFun().getBeforeSeconds(-1 * GUILDACTIVITY.CITYACTIVITY_CHALLENGE_CD);
|
||||
let challengeTime = nowSeconds() + GUILDACTIVITY.CITYACTIVITY_CHALLENGE_CD;
|
||||
if(SERVER_DEBUG_MODE.CURRENT_TIME == 1) {
|
||||
let guilds = pinus.app.getServersByType('guild');
|
||||
let guild = dispatch(roleId, guilds, 'guild');
|
||||
let currentTime = await pinus.app.rpc.guild.guildActivityRemote.getCurrentTime.toServer(guild.id);
|
||||
challengeTime = Math.floor(currentTime/1000) + GUILDACTIVITY.CITYACTIVITY_CHALLENGE_CD;
|
||||
}
|
||||
let myGuildActivityRec = await UserGuildActivityRecModel.updateInfo(code, { isSuccess, isCompleted: true, cityId, challengeTime });
|
||||
if (!myGuildActivityRec) return resResult(STATUS.INTERNAL_ERR);
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ export class GuildActivityRemote {
|
||||
}
|
||||
|
||||
private channelService: ChannelService;
|
||||
private currentTime: number = Date.now();
|
||||
private setTime: number = Date.now();
|
||||
|
||||
/**
|
||||
* 从systimer服分发到guild各个服,发送排行榜数据
|
||||
@@ -88,4 +90,13 @@ export class GuildActivityRemote {
|
||||
async setDay(week: number) {
|
||||
setWeek(week);
|
||||
}
|
||||
|
||||
setCurrentTime(time: number) {
|
||||
this.currentTime = time;
|
||||
this.setTime = Date.now();
|
||||
}
|
||||
|
||||
getCurrentTime() {
|
||||
return Date.now() - this.setTime + this.currentTime;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user