|
@@ -1514,7 +1514,7 @@ export default {
|
|
|
(progress) => {
|
|
(progress) => {
|
|
|
// 火山云的进度是小数0-1
|
|
// 火山云的进度是小数0-1
|
|
|
if (typeof progress.percent === 'number') {
|
|
if (typeof progress.percent === 'number') {
|
|
|
- const percent = Math.floor(progress.percent * 100);
|
|
|
|
|
|
|
+ const percent = Math.floor(progress.percent);
|
|
|
|
|
|
|
|
// 更新线路2进度
|
|
// 更新线路2进度
|
|
|
this.updateUploadProgress('line2', percent);
|
|
this.updateUploadProgress('line2', percent);
|
|
@@ -2075,20 +2075,21 @@ export default {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- if (!thumbnailSuccess) {
|
|
|
|
|
- console.error('获取封面失败,已重试3次,跳过封面获取继续上传');
|
|
|
|
|
|
|
+
|
|
|
|
|
+ const index = this.videoList.findIndex(item => item.tempId === tempVideo.tempId);
|
|
|
|
|
+ if (!thumbnailSuccess && index !== -1) {
|
|
|
|
|
+ console.error('获取封面失败,已重试3次');
|
|
|
|
|
+ this.videoList[index].uploadStatus = 'failed';
|
|
|
|
|
+ this.videoList[index].uploadDetails.line1Status = 'failed';
|
|
|
|
|
+ this.videoList[index].uploadDetails.line2Status = 'failed';
|
|
|
|
|
+ this.updateBatchProgress(index);
|
|
|
|
|
+ return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 并行上传到两个服务器,添加超时保护
|
|
// 并行上传到两个服务器,添加超时保护
|
|
|
const uploadPromise = Promise.allSettled([
|
|
const uploadPromise = Promise.allSettled([
|
|
|
- Promise.race([
|
|
|
|
|
this.uploadVideoToTxPcdnBatch(tempVideo.file, tempVideo),
|
|
this.uploadVideoToTxPcdnBatch(tempVideo.file, tempVideo),
|
|
|
- new Promise((_, reject) => setTimeout(() => reject(new Error('腾讯云上传超时')), 300000))
|
|
|
|
|
- ]),
|
|
|
|
|
- Promise.race([
|
|
|
|
|
- this.uploadVideoToHSYBatch(tempVideo.file, tempVideo),
|
|
|
|
|
- new Promise((_, reject) => setTimeout(() => reject(new Error('HSY上传超时')), 300000))
|
|
|
|
|
- ])
|
|
|
|
|
|
|
+ this.uploadVideoToHSYBatch(tempVideo.file, tempVideo)
|
|
|
]);
|
|
]);
|
|
|
|
|
|
|
|
const [line1Result, line2Result] = await uploadPromise;
|
|
const [line1Result, line2Result] = await uploadPromise;
|
|
@@ -2097,29 +2098,34 @@ export default {
|
|
|
const line1Success = line1Result.status === 'fulfilled' && line1Result.value.success;
|
|
const line1Success = line1Result.status === 'fulfilled' && line1Result.value.success;
|
|
|
const line2Success = line2Result.status === 'fulfilled' && line2Result.value.success;
|
|
const line2Success = line2Result.status === 'fulfilled' && line2Result.value.success;
|
|
|
|
|
|
|
|
- const index = this.videoList.findIndex(item => item.tempId === tempVideo.tempId);
|
|
|
|
|
- if (index !== -1) {
|
|
|
|
|
|
|
+ // await 后重新获取 index,避免 videoList 在此期间被修改导致 index 过期
|
|
|
|
|
+ const currentIndex = this.videoList.findIndex(item => item.tempId === tempVideo.tempId);
|
|
|
|
|
+ if (currentIndex !== -1) {
|
|
|
if (line1Success && line2Success) {
|
|
if (line1Success && line2Success) {
|
|
|
- this.videoList[index].progress = 100;
|
|
|
|
|
- this.videoList[index].uploadStatus = 'success';
|
|
|
|
|
- this.videoList[index].uploadDetails.line1Status = 'success';
|
|
|
|
|
- this.videoList[index].uploadDetails.line2Status = 'success';
|
|
|
|
|
- this.videoList[index].uploadDetails.line1 = 100;
|
|
|
|
|
- this.videoList[index].uploadDetails.line2 = 100;
|
|
|
|
|
|
|
+ this.videoList[currentIndex].progress = 100;
|
|
|
|
|
+ this.videoList[currentIndex].uploadStatus = 'success';
|
|
|
|
|
+ this.videoList[currentIndex].uploadDetails.line1Status = 'success';
|
|
|
|
|
+ this.videoList[currentIndex].uploadDetails.line2Status = 'success';
|
|
|
|
|
+ this.videoList[currentIndex].uploadDetails.line1 = 100;
|
|
|
|
|
+ this.videoList[currentIndex].uploadDetails.line2 = 100;
|
|
|
} else {
|
|
} else {
|
|
|
- this.videoList[index].uploadStatus = 'failed';
|
|
|
|
|
- this.videoList[index].uploadDetails.line1Status = line1Success ? 'success' : 'failed';
|
|
|
|
|
- this.videoList[index].uploadDetails.line2Status = line2Success ? 'success' : 'failed';
|
|
|
|
|
- this.updateBatchProgress(index);
|
|
|
|
|
|
|
+ this.videoList[currentIndex].uploadStatus = 'failed';
|
|
|
|
|
+ this.videoList[currentIndex].uploadDetails.line1Status = line1Success ? 'success' : 'failed';
|
|
|
|
|
+ this.videoList[currentIndex].uploadDetails.line2Status = line2Success ? 'success' : 'failed';
|
|
|
|
|
+ this.updateBatchProgress(currentIndex);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return { success: line1Success && line2Success, tempVideo };
|
|
return { success: line1Success && line2Success, tempVideo };
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
console.error('视频上传失败:', error);
|
|
console.error('视频上传失败:', error);
|
|
|
- const index = this.videoList.findIndex(item => item.tempId === tempVideo.tempId);
|
|
|
|
|
- if (index !== -1) {
|
|
|
|
|
- this.videoList[index].uploadStatus = 'failed';
|
|
|
|
|
|
|
+ const catchIndex = this.videoList.findIndex(item => item.tempId === tempVideo.tempId);
|
|
|
|
|
+ if (catchIndex !== -1) {
|
|
|
|
|
+ this.videoList[catchIndex].uploadStatus = 'failed';
|
|
|
|
|
+ // 同步更新线路状态,避免 uploadStatus 和 uploadDetails 不一致
|
|
|
|
|
+ // 导致总进度显示红叉但重试时提示"所有线路都已上传成功"
|
|
|
|
|
+ this.videoList[catchIndex].uploadDetails.line1Status = 'failed';
|
|
|
|
|
+ this.videoList[catchIndex].uploadDetails.line2Status = 'failed';
|
|
|
}
|
|
}
|
|
|
// 不再抛出错误,避免影响队列中的其他视频
|
|
// 不再抛出错误,避免影响队列中的其他视频
|
|
|
return { success: false, tempVideo, error: error.message };
|
|
return { success: false, tempVideo, error: error.message };
|
|
@@ -2553,6 +2559,18 @@ export default {
|
|
|
const needRetryLine2 = uploadDetails.line2Status === 'failed' || uploadDetails.line2Status === 'pending';
|
|
const needRetryLine2 = uploadDetails.line2Status === 'failed' || uploadDetails.line2Status === 'pending';
|
|
|
|
|
|
|
|
if (!needRetryLine1 && !needRetryLine2) {
|
|
if (!needRetryLine1 && !needRetryLine2) {
|
|
|
|
|
+ // 线路状态都正常但 uploadStatus 为 failed(catch 块遗留的不一致状态),直接修复
|
|
|
|
|
+ if (tempVideo.uploadStatus === 'failed') {
|
|
|
|
|
+ this.videoList[index].uploadStatus = 'success';
|
|
|
|
|
+ // 确保进度也同步修复
|
|
|
|
|
+ if (uploadDetails.line1Status === 'success' && uploadDetails.line2Status === 'success') {
|
|
|
|
|
+ this.videoList[index].progress = 100;
|
|
|
|
|
+ this.videoList[index].uploadDetails.line1 = 100;
|
|
|
|
|
+ this.videoList[index].uploadDetails.line2 = 100;
|
|
|
|
|
+ }
|
|
|
|
|
+ this.$message.success('上传状态已修复');
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
this.$message.info('所有线路都已上传成功,无需重试');
|
|
this.$message.info('所有线路都已上传成功,无需重试');
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|