✨ feat(battle): 添加录像上传接口
This commit is contained in:
@@ -11,7 +11,7 @@ import { LadderMatchRecModel } from '../../../db/LadderMatchRec';
|
||||
import { HeroModel } from '../../../db/Hero';
|
||||
import { LADDER } from '../../../pubUtils/dicParam';
|
||||
import { handleCost } from '../../../services/role/rewardService';
|
||||
import { DEBUG_MAGIC_WORD, ITEM_CHANGE_REASON, LADDER_OPP_STATUS, LADDER_STATUS, REDIS_KEY } from '../../../consts';
|
||||
import { DEBUG_MAGIC_WORD, ITEM_CHANGE_REASON, LADDER_OPP_STATUS, LADDER_STATUS, REDIS_KEY, WAR_TYPE } from '../../../consts';
|
||||
import { checkBattleHeroesByHid } from '../../../services/normalBattleService';
|
||||
import { ServerlistModel } from '../../../db/Serverlist';
|
||||
import { saveLadderDefCeByData } from '../../../services/redisService';
|
||||
@@ -19,6 +19,7 @@ import { pushLadderTopChangeMsg } from '../../../services/sysChatService';
|
||||
import { checkTaskInLadderEnd, checkTaskInLadderStart, checkTaskInLadderSweep } from '../../../services/task/taskService';
|
||||
import { BattleRecordModel } from '../../../db/BattleRecord';
|
||||
import { isHeroHidden } from '../../../services/dataService';
|
||||
import { getRemoteRplFilePath, getRemoteRplPrefix } from '../../../pubUtils/battleUtils';
|
||||
|
||||
export default function (app: Application) {
|
||||
new HandlerService(app, {});
|
||||
@@ -356,7 +357,14 @@ export class LadderHandler {
|
||||
async getRec(msg: {}, session: BackendSession) {
|
||||
let roleId = session.get('roleId');
|
||||
let list = await LadderMatchRecModel.findRec(roleId);
|
||||
return resResult(STATUS.SUCCESS, { list });
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
list: list.map(rec => {
|
||||
const { roleId1, battleCode, hasRpl } = rec;
|
||||
const rplFileUrl = battleCode && hasRpl ? getRemoteRplFilePath(roleId1, WAR_TYPE.LADDER, battleCode) : '';
|
||||
return { ...rec, rplFileUrl };
|
||||
}),
|
||||
rplPrefixUrl: getRemoteRplPrefix(pinus.app.get('env'))
|
||||
});
|
||||
}
|
||||
|
||||
// debug接口
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { WAR_TYPE } from './../../../consts/constModules/battleConst';
|
||||
|
||||
import { Application, BackendSession, pinus, HandlerService, } from 'pinus';
|
||||
import { findIndex } from 'underscore';
|
||||
@@ -21,6 +22,7 @@ import { BattleRecordModel } from '../../../db/BattleRecord';
|
||||
import { PvpRecordModel, PvpRecordParam, PvpRecordType } from '../../../db/PvpRecord';
|
||||
import { pvpEndParamInter } from '../../../pubUtils/interface';
|
||||
import { getSeconds, nowSeconds } from '../../../pubUtils/timeUtil';
|
||||
import { getRemoteRplPrefix, getRemoteRplFilePath } from '../../../pubUtils/battleUtils';
|
||||
import { PlayerDetail, PlayerDetailHero } from '../../../domain/battleField/guild';
|
||||
import { PvpSaveDataModel } from '../../../db/PvpSaveData';
|
||||
import { PVPConfigModel } from '../../../db/PvpConfig';
|
||||
@@ -262,7 +264,7 @@ export class PvpHandler {
|
||||
|
||||
let seasonNum: number = this.app.get('pvpSeasonNum');
|
||||
// 战报记录
|
||||
await PvpRecordModel.createRec({ roleId1: roleId, roleId2: robotIdComBack(oppRoleId), warId: BattleRecord.battleId, attackInfo, defenseInfo, createTime: nowSeconds(), timeout: seasonNum != pvpSeasonNum });
|
||||
await PvpRecordModel.createRec({ roleId1: roleId, roleId2: robotIdComBack(oppRoleId), battleCode, warId: BattleRecord.battleId, attackInfo, defenseInfo, createTime: nowSeconds(), timeout: seasonNum != pvpSeasonNum });
|
||||
|
||||
// 更新battleRecord
|
||||
await BattleRecordModel.updateBattleRecordByCode(battleCode, {
|
||||
@@ -600,7 +602,14 @@ export class PvpHandler {
|
||||
if(record.attackInfo) record.attackInfo['serverName'] = serverNames[record.attackInfo.serverId];
|
||||
}
|
||||
|
||||
return resResult(STATUS.SUCCESS, { list: pvpRecords });
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
list: pvpRecords.map(rec => {
|
||||
const { roleId1, battleCode, hasRpl } = rec;
|
||||
const rplFileUrl = battleCode && hasRpl ? getRemoteRplFilePath(roleId1, WAR_TYPE.PVP, battleCode) : '';
|
||||
return { ...rec, rplFileUrl };
|
||||
}),
|
||||
rplPrefixUrl: getRemoteRplPrefix(pinus.app.get('env'))
|
||||
});
|
||||
}
|
||||
|
||||
// debug接口
|
||||
|
||||
Reference in New Issue
Block a user