寻宝:增加倒计时
This commit is contained in:
@@ -22,7 +22,7 @@ import { addUserToChannel, getSimpleRoleInfo } from '../../../services/roleServi
|
||||
import { ChannelUser } from '../../../domain/ChannelUser';
|
||||
import { pushComBtlTeamMsg, pushFriendTeamInviteMsg, pushNormalItemMsg, pushTeamInviteMsg } from '../../../services/chatService';
|
||||
import { EXTERIOR } from '../../../pubUtils/dicParam';
|
||||
import { getZeroPointD, getTimeFunD } from '../../../pubUtils/timeUtil';
|
||||
import { getZeroPointD, getTimeFunD, getSeconds, nowSeconds } from '../../../pubUtils/timeUtil';
|
||||
import { FriendParams } from '../../../domain/roleField/friend';
|
||||
import { checkTask, checkTaskWithGoods } from '../../../services/taskService';
|
||||
import { gameData, getWarByBlueprtId } from '../../../pubUtils/data';
|
||||
@@ -427,6 +427,7 @@ export class ComBattleHandler {
|
||||
if (teamStatus.status !== COM_TEAM_STATUS.DEFAULT) return resResult(STATUS.COM_BATTLE_ALREADY_START);
|
||||
|
||||
teamStatus.status = COM_TEAM_STATUS.FIGHTING;
|
||||
teamStatus.endTime = nowSeconds() + COM_BTL_CONST.BTL_TIME_LMT/1000;
|
||||
|
||||
let team = await ComBattleTeamModel.updateStatusByCode(teamCode, COM_TEAM_STATUS.FIGHTING);
|
||||
if (!team) return resResult(STATUS.COM_BATTLE_START_ERR);
|
||||
@@ -603,16 +604,16 @@ export class ComBattleHandler {
|
||||
|
||||
async getComBtlStatus(msg: {teamCode: string}, session: BackendSession) {
|
||||
let { teamCode } = msg;
|
||||
let roleStatus: RoleStatus[], status: number, bossHpArr: BossHp[], timeout: boolean;
|
||||
let roleStatus: RoleStatus[], status: number, bossHpArr: BossHp[], timeout: boolean, endTime = 0;
|
||||
let memTeam = this.teamMap.get(teamCode);
|
||||
if (memTeam) {
|
||||
({ roleStatus, status, bossHpArr, timeout } = memTeam);
|
||||
({ roleStatus, status, bossHpArr, timeout, endTime } = memTeam);
|
||||
} else {
|
||||
let dbTeam = await ComBattleTeamModel.getTeamByCode(teamCode);
|
||||
if (!dbTeam) return resResult(STATUS.COM_BATTLE_TEAM_INVALID);
|
||||
({ roleStatus, status, bossHpArr, timeout } = dbTeam);
|
||||
({ roleStatus, status, bossHpArr, timeout, endTime } = dbTeam);
|
||||
}
|
||||
return resResult(STATUS.SUCCESS, { teamInfo: {status, teamCode, roleStatus, bossHpArr, timeout} });
|
||||
return resResult(STATUS.SUCCESS, { teamInfo: {status, teamCode, roleStatus, bossHpArr, timeout, endTime} });
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,7 +23,7 @@ import { checkActivityTask, checkTaskInComBattleEnd } from './taskService';
|
||||
import { getRewardByBlueprtId, gameData, getBossHpByBlueprtId } from '../pubUtils/data';
|
||||
import { getFriendPointObject } from '../pubUtils/itemUtils';
|
||||
import { DicWar } from '../pubUtils/dictionary/DicWar';
|
||||
import { getZeroPointD } from '../pubUtils/timeUtil';
|
||||
import { getZeroPointD, nowSeconds } from '../pubUtils/timeUtil';
|
||||
import { dispatch } from '../pubUtils/dispatcher';
|
||||
import { handleCost } from './rewardService';
|
||||
|
||||
@@ -257,7 +257,7 @@ export async function handleComBtlProgress(teamStatus: MemComBtlTeam, robotHurtT
|
||||
st.fixReward = await getRealReward(teamStatus.blueprtId, st);
|
||||
};
|
||||
}
|
||||
let team = await ComBattleTeamModel.syncTeamData({ teamCode, status: battleSt, roleStatus: teamStatus.roleStatus, bossHpArr: teamStatus.bossHpArr });
|
||||
let team = await ComBattleTeamModel.syncTeamData({ teamCode, status: battleSt, roleStatus: teamStatus.roleStatus, bossHpArr: teamStatus.bossHpArr, endTime: teamStatus.endTime });
|
||||
if (!team) return resResult(STATUS.COM_BATTLE_RESULT_ERR);
|
||||
|
||||
// 战斗胜利队长扣减藏宝图
|
||||
|
||||
@@ -180,6 +180,10 @@ export default class ComBattleTeam extends BaseModel {
|
||||
|
||||
// 黑名单
|
||||
blacklist: string[] = [];
|
||||
|
||||
// 黑名单
|
||||
@prop({ required: true, default: 0 })
|
||||
endTime: number = 0;
|
||||
|
||||
public static async createTeam(teamData: ComBattleTeamParam, lean = true) {
|
||||
const team: ComBattleTeamType = await ComBattleTeamModel.findOneAndUpdate({ teamCode: teamData.teamCode }, {$set :{...teamData, roleCnt: teamData.roleIds.length}}, {upsert: true, new: true}).lean(lean);
|
||||
@@ -226,7 +230,7 @@ export default class ComBattleTeam extends BaseModel {
|
||||
return team;
|
||||
}
|
||||
|
||||
public static async syncTeamData(teamData: {teamCode: string, status: number, roleStatus: RoleStatus[], bossHpArr: BossHp[]}, timeout = false, lean = true) {
|
||||
public static async syncTeamData(teamData: {teamCode: string, status: number, roleStatus: RoleStatus[], bossHpArr: BossHp[], endTime?: number}, timeout = false, lean = true) {
|
||||
console.log('syncTeamData bossHpArr: ', teamData.bossHpArr);
|
||||
const team: ComBattleTeamType = await ComBattleTeamModel.findOneAndUpdate({ teamCode: teamData.teamCode }, {$set :{...teamData, roleCnt: teamData.roleStatus.length, timeout}}, {new: true}).lean(lean);
|
||||
return team;
|
||||
|
||||
Reference in New Issue
Block a user