✨ feat(gvg): 添加激战期战斗录像支持
This commit is contained in:
@@ -35,6 +35,7 @@ export const WAR_TYPE = {
|
|||||||
BOSS: 20, // 演武台
|
BOSS: 20, // 演武台
|
||||||
LADDER: 21, // 名将擂台
|
LADDER: 21, // 名将擂台
|
||||||
GVG_VESTIGE: 22, // GVG征战中原
|
GVG_VESTIGE: 22, // GVG征战中原
|
||||||
|
GVG_BATTLE: 23, // GVG激战期战斗
|
||||||
};
|
};
|
||||||
|
|
||||||
// 藏宝图掉落参数
|
// 藏宝图掉落参数
|
||||||
|
|||||||
@@ -94,6 +94,9 @@ export default class GVGBattleRec extends BaseModel {
|
|||||||
@prop({ required: true })
|
@prop({ required: true })
|
||||||
battleEndTime: number;
|
battleEndTime: number;
|
||||||
|
|
||||||
|
@prop({ required: true, default: false })
|
||||||
|
hasRpl: boolean; // 是否存在对应录像
|
||||||
|
|
||||||
public static async createRec(configId: number, groupKey: string, warId: number, attackTeam: GVGTeamType, defenseTeam: GVGTeamType) {
|
public static async createRec(configId: number, groupKey: string, warId: number, attackTeam: GVGTeamType, defenseTeam: GVGTeamType) {
|
||||||
const battleCode = genCode(8);
|
const battleCode = genCode(8);
|
||||||
const result: GVGBattleRecType = await GVGBattleRecModel.findOneAndUpdate({ battleCode }, { $set: { configId, groupKey, warId, attackTeam, defenseTeam, isSuccess: false } }, { new: true, upsert: true }).lean();
|
const result: GVGBattleRecType = await GVGBattleRecModel.findOneAndUpdate({ battleCode }, { $set: { configId, groupKey, warId, attackTeam, defenseTeam, isSuccess: false } }, { new: true, upsert: true }).lean();
|
||||||
@@ -109,6 +112,11 @@ export default class GVGBattleRec extends BaseModel {
|
|||||||
const result: GVGBattleRecType = await GVGBattleRecModel.findOneAndUpdate({ battleCode }, { $set: { isSuccess, battleEndTime: nowSeconds(), attackTeamAfter: attackTeam, defenseTeamAfter: defenseTeam } }, { new: true }).lean();
|
const result: GVGBattleRecType = await GVGBattleRecModel.findOneAndUpdate({ battleCode }, { $set: { isSuccess, battleEndTime: nowSeconds(), attackTeamAfter: attackTeam, defenseTeamAfter: defenseTeam } }, { new: true }).lean();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static async updateRplStatus(battleCode: string, hasRpl: boolean) {
|
||||||
|
let result = await GVGBattleRecModel.findOneAndUpdate({ battleCode }, { hasRpl }, { new: true }).lean();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const GVGBattleRecModel = getModelForClass(GVGBattleRec);
|
export const GVGBattleRecModel = getModelForClass(GVGBattleRec);
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import { getRandEelmWithWeight } from 'app/pubUtils/util';
|
|||||||
import { getLocalRplUrl, getRemoteRplUrl } from 'app/pubUtils/battleUtils'
|
import { getLocalRplUrl, getRemoteRplUrl } from 'app/pubUtils/battleUtils'
|
||||||
import { ChannelInfoModel } from '@db/ChannelInfo';
|
import { ChannelInfoModel } from '@db/ChannelInfo';
|
||||||
import { GVGVestigeRecModel } from '@db/GVGVestigeRec';
|
import { GVGVestigeRecModel } from '@db/GVGVestigeRec';
|
||||||
|
import { GVGBattleRecModel } from '@db/GVGBattleRec';
|
||||||
const sendToWormhole = require('stream-wormhole');
|
const sendToWormhole = require('stream-wormhole');
|
||||||
const pump = require('mz-modules/pump');
|
const pump = require('mz-modules/pump');
|
||||||
|
|
||||||
@@ -224,7 +225,7 @@ export default class GameController extends Controller {
|
|||||||
if (!battleRec) return ctx.body = ctx.service.utils.resResult(STATUS.BATTLE_NOT_FOUND);
|
if (!battleRec) return ctx.body = ctx.service.utils.resResult(STATUS.BATTLE_NOT_FOUND);
|
||||||
|
|
||||||
let { warType, roleId } = battleRec;
|
let { warType, roleId } = battleRec;
|
||||||
if (warType !== WAR_TYPE.PVP && warType !== WAR_TYPE.LADDER && warType !== WAR_TYPE.GVG_VESTIGE) return ctx.body = ctx.service.utils.resResult(STATUS.BATTLE_RPL_NOT_SUPPORT);
|
if (warType !== WAR_TYPE.PVP && warType !== WAR_TYPE.LADDER && warType !== WAR_TYPE.GVG_VESTIGE && warType !== WAR_TYPE.GVG_BATTLE) return ctx.body = ctx.service.utils.resResult(STATUS.BATTLE_RPL_NOT_SUPPORT);
|
||||||
|
|
||||||
writePath = getLocalRplUrl(roleId, warType, battleCode);
|
writePath = getLocalRplUrl(roleId, warType, battleCode);
|
||||||
try {
|
try {
|
||||||
@@ -249,6 +250,8 @@ export default class GameController extends Controller {
|
|||||||
updateDBRes = await LadderMatchRecModel.updateRplStatus(battleCode, true);
|
updateDBRes = await LadderMatchRecModel.updateRplStatus(battleCode, true);
|
||||||
} else if (warType == WAR_TYPE.GVG_VESTIGE) {
|
} else if (warType == WAR_TYPE.GVG_VESTIGE) {
|
||||||
updateDBRes = await GVGVestigeRecModel.updateRplStatus(battleCode, true);
|
updateDBRes = await GVGVestigeRecModel.updateRplStatus(battleCode, true);
|
||||||
|
} else if (warType == WAR_TYPE.GVG_BATTLE) {
|
||||||
|
updateDBRes = await GVGBattleRecModel.updateRplStatus(battleCode, true);
|
||||||
}
|
}
|
||||||
if (!updateDBRes) return ctx.body = ctx.service.utils.resResult(STATUS.BATTLE_RPL_UPDATE_ERR);
|
if (!updateDBRes) return ctx.body = ctx.service.utils.resResult(STATUS.BATTLE_RPL_UPDATE_ERR);
|
||||||
remoteUrl = `${getRemoteRplUrl(ctx.app.config.realEnv, roleId, warType, battleCode)}/${battleCode}.bin`;
|
remoteUrl = `${getRemoteRplUrl(ctx.app.config.realEnv, roleId, warType, battleCode)}/${battleCode}.bin`;
|
||||||
|
|||||||
Reference in New Issue
Block a user