🐞 fix(gvg): 激战期录像上传特殊处理

This commit is contained in:
liangtongchuan
2023-02-24 21:01:23 +08:00
parent f9bd5a76eb
commit 99b19ee566

View File

@@ -193,7 +193,7 @@ export default class GameController extends Controller {
const { ctx } = this;
const parts = ctx.multipart();
let part;
let [writePath, token, battleCode, fullPath, remoteUrl] = ['', '', '', '', ''];
let [writePath, token, battleCode, fullPath, remoteUrl, warType] = ['', '', '', '', '', 0];
while ((part = await parts()) != null) {
if (part.length) {
console.log('kv: ', `${part[0]}: ${part[1]}`);
@@ -201,6 +201,8 @@ export default class GameController extends Controller {
token = part[1];
} else if (part[0] === 'battleCode') {
battleCode = part[1];
} else if (part[0] === 'warType') {
warType = part[1];
}
} else {
if (!part.filename) {
@@ -221,11 +223,19 @@ export default class GameController extends Controller {
return;
}
let battleRec = await BattleRecordModel.getBattleRecordByCode(battleCode, true);
if (!battleRec) return ctx.body = ctx.service.utils.resResult(STATUS.BATTLE_NOT_FOUND);
let { warType, roleId } = battleRec;
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);
let roleId = '';
if (!!warType && warType === WAR_TYPE.GVG_BATTLE) { // gvg激战期录像没有通用 BattleRecord单独处理
let gvgBattleRec = await GVGBattleRecModel.findByBattleCode(battleCode);
if (!gvgBattleRec) return ctx.body = ctx.service.utils.resResult(STATUS.BATTLE_NOT_FOUND);
roleId = gvgBattleRec.attackTeam?.roleId;
if (!roleId) return ctx.body = ctx.service.utils.resResult(STATUS.BATTLE_NOT_FOUND);
} else {
let battleRec = await BattleRecordModel.getBattleRecordByCode(battleCode, true);
if (!battleRec) return ctx.body = ctx.service.utils.resResult(STATUS.BATTLE_NOT_FOUND);
roleId = battleRec.roleId;
warType = battleRec.warType;
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);
}
writePath = getLocalRplUrl(roleId, warType, battleCode);
try {