🐞 fix(录像): 修复录像存储以及读取路径
This commit is contained in:
@@ -15,7 +15,7 @@ import { RedisClient } from 'redis';
|
||||
import { REDIS_KEY } from '@consts';
|
||||
import { RegionModel } from '@db/Region';
|
||||
import { getRandEelmWithWeight } from 'app/pubUtils/util';
|
||||
import { getLocalRplUrl, getRemoteRplUrl } from 'app/pubUtils/battleUtils'
|
||||
import { getLocalRplUrl, getRemoteRplUrl, getRemoteRplPrefix } from 'app/pubUtils/battleUtils'
|
||||
import { ChannelInfoModel } from '@db/ChannelInfo';
|
||||
import { GVGVestigeRecModel } from '@db/GVGVestigeRec';
|
||||
import { GVGBattleRecModel } from '@db/GVGBattleRec';
|
||||
@@ -202,7 +202,7 @@ export default class GameController extends Controller {
|
||||
const { ctx } = this;
|
||||
const parts = ctx.multipart();
|
||||
let part;
|
||||
let [writePath, token, battleCode, fullPath, remoteUrl, warType] = ['', '', '', '', '', 0];
|
||||
let [writePath, token, battleCode, fullPath, remoteUrl, warType, prefix] = ['', '', '', '', '', 0, ''];
|
||||
while ((part = await parts()) != null) {
|
||||
if (part.length) {
|
||||
console.log('kv: ', `${part[0]}: ${part[1]}`);
|
||||
@@ -267,7 +267,8 @@ export default class GameController extends Controller {
|
||||
const writeStream = fs.createWriteStream(fullPath);
|
||||
await pump(part, writeStream);
|
||||
|
||||
remoteUrl = `${getRemoteRplUrl(ctx.app.config.realEnv, ctx.app.config.sshHost,roleId, warType, battleCode)}/${battleCode}.bin`;
|
||||
prefix = getRemoteRplPrefix(ctx.app.config.realEnv);
|
||||
remoteUrl = `${getRemoteRplUrl(ctx.app.config.sshHost,roleId, warType, battleCode)}/${battleCode}.bin`;
|
||||
let updateDBRes;
|
||||
if (warType === WAR_TYPE.PVP) {
|
||||
updateDBRes = await PvpRecordModel.updateRplStatus(battleCode, true, remoteUrl);
|
||||
@@ -284,7 +285,7 @@ export default class GameController extends Controller {
|
||||
}
|
||||
}
|
||||
}
|
||||
ctx.body = ctx.service.utils.resResult(STATUS.SUCCESS, { rplUrl: remoteUrl });
|
||||
ctx.body = ctx.service.utils.resResult(STATUS.SUCCESS, { rplUrl: prefix + remoteUrl });
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user