军团活动:修复城池时间状态
This commit is contained in:
@@ -8,7 +8,7 @@ import { UserGuildActivityRecModel } from "../../../db/UserGuildActivityRec";
|
||||
import { leaveCityChannel, addRoleToCityChannel, getCityChannelSid } from "../../../services/chatService";
|
||||
import { UserGuildModel } from "../../../db/UserGuild";
|
||||
import { GuildActivityRecordModel } from "../../../db/GuildActivityRec";
|
||||
import { nowSeconds, getBeforeMinuteSeconds } from "../../../pubUtils/timeUtil";
|
||||
import { nowSeconds, getBeforeSeconds } from "../../../pubUtils/timeUtil";
|
||||
import { getGoldObject } from "../../../pubUtils/itemUtils";
|
||||
import { GUILDACTIVITY } from "../../../pubUtils/dicParam";
|
||||
import { handleCost } from "../../../services/rewardService";
|
||||
@@ -279,7 +279,7 @@ export class CityActivityHandler {
|
||||
if(!dicCity) return resResult(STATUS.DIC_DATA_NOT_FOUND);
|
||||
|
||||
// 更新userGuildActivityRecord
|
||||
let challengeTime = getBeforeMinuteSeconds(-1 * GUILDACTIVITY.CITYACTIVITY_CD_COST);
|
||||
let challengeTime = getBeforeSeconds(-1 * GUILDACTIVITY.CITYACTIVITY_CHALLENGE_CD);
|
||||
let myGuildActivityRec = await UserGuildActivityRecModel.updateInfo(code, { isSuccess, isCompleted: true, cityId, challengeTime });
|
||||
if(!myGuildActivityRec) return resResult(STATUS.INTERNAL_ERR);
|
||||
|
||||
|
||||
@@ -546,6 +546,8 @@ export function getCityStatus(guildCode: string, cityId: number, dic: DicCityAct
|
||||
let startDay = openDay[curIndex - 1]||0;
|
||||
let endDay = openDay[openDay.length - 1]||0;
|
||||
if(d >= startDay && d <= endDay) status = CITY_STATUS.CAN_DECLARE;
|
||||
if(d == startDay && activityStatus.status != GUILD_ACTIVITY_STATUS.END) status = CITY_STATUS.NOT_OPEN;
|
||||
if(d == endDay && activityStatus.status == GUILD_ACTIVITY_STATUS.END) status = CITY_STATUS.NOT_OPEN;
|
||||
|
||||
let curCity = dbCities.find(cur => cur.cityId == cityId);
|
||||
if(curCity) {
|
||||
|
||||
@@ -53,6 +53,12 @@ export function getBeforeMinuteSeconds(minute: number) {
|
||||
return time;
|
||||
}
|
||||
|
||||
export function getBeforeSeconds(seconds: number) {
|
||||
let time = nowSeconds() - seconds;
|
||||
return time;
|
||||
}
|
||||
|
||||
|
||||
export function getCurWeekDate(day: number, hour: number) {
|
||||
return getWeekDate(new Date(), day, hour);
|
||||
}
|
||||
@@ -183,14 +189,14 @@ export function getNextTime(date: Date, h: number, m = 0, s = 0, ms = 0): Date {
|
||||
|
||||
let week = undefined;
|
||||
|
||||
export function getCurDay( needHandle = false, time?: Date) {
|
||||
export function getCurDay(needHandle = false, time?: Date) {
|
||||
if(!time) time = new Date();
|
||||
let d = time.getDay();
|
||||
if(needHandle && d == 0) d = 7;
|
||||
|
||||
if(week != undefined) {
|
||||
d = week;
|
||||
}
|
||||
if(needHandle && d == 0) d = 7;
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user