增加已删除视频查看

This commit is contained in:
jianzhichu
2025-12-05 23:17:04 +08:00
parent 91056d9cfa
commit c60f7bdf57
8 changed files with 200 additions and 64 deletions
+17 -2
View File
@@ -205,7 +205,7 @@ namespace dy.net.Controllers
/// <summary> /// <summary>
/// 删除视频-不再下载 /// 删除视频-不再下载
/// </summary> /// </summary>
/// <param name="Id"></param> /// <param name="vid"></param>
/// <returns></returns> /// <returns></returns>
[HttpGet("vdelete/{vid}")] [HttpGet("vdelete/{vid}")]
public async Task<IActionResult> DeleteVideo([FromRoute]string vid) public async Task<IActionResult> DeleteVideo([FromRoute]string vid)
@@ -227,7 +227,12 @@ namespace dy.net.Controllers
if (result) if (result)
{ {
//加入删除逻辑 //加入删除逻辑
await douyinCommonService.AddDeleteVideo(new DouyinVideoDelete { ViedoId = video.AwemeId }); await douyinCommonService.AddDeleteVideo(new DouyinVideoDelete
{
ViedoId = video.AwemeId,
VideoTitle = video.VideoTitle,
VideoSavePath = video.VideoSavePath
});
Serilog.Log.Debug($"前面的日志,你错了,这条视频是永久删除..哈哈--{video.VideoTitle}"); Serilog.Log.Debug($"前面的日志,你错了,这条视频是永久删除..哈哈--{video.VideoTitle}");
return Ok(new { code = 0, data = true }); return Ok(new { code = 0, data = true });
@@ -241,5 +246,15 @@ namespace dy.net.Controllers
} }
} }
/// <summary>
/// 查询已删除视频列表
/// </summary>
/// <returns></returns>
[HttpGet("vdelete/get")]
public async Task<IActionResult> GetDeleteVideo()
{
return Ok(new { code = 0, data = await douyinCommonService.GetDouyinDeleteVideos() } );
}
} }
} }
@@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<_PublishTargetUrl>E:\code\dysync\bin\Release\net6.0\publish\</_PublishTargetUrl> <_PublishTargetUrl>E:\code\dysync\bin\Release\net6.0\publish\</_PublishTargetUrl>
<History>True|2025-12-05T04:46:26.1415079Z||;False|2025-12-05T12:46:19.1274332+08:00||;True|2025-12-05T09:04:36.7111717+08:00||;True|2025-12-05T08:22:51.7343317+08:00||;True|2025-12-05T08:20:32.0383739+08:00||;True|2025-12-04T21:58:29.4112766+08:00||;True|2025-12-04T21:58:10.0382218+08:00||;True|2025-12-04T21:57:55.3894059+08:00||;True|2025-12-04T21:10:38.8943797+08:00||;True|2025-12-04T21:09:31.5024569+08:00||;True|2025-12-04T08:22:47.9617427+08:00||;False|2025-12-04T08:22:41.3759733+08:00||;True|2025-12-04T08:14:02.2478893+08:00||;True|2025-12-04T07:57:00.2208139+08:00||;True|2025-12-03T23:58:13.3693303+08:00||;True|2025-12-03T23:57:40.4257893+08:00||;True|2025-12-03T23:56:38.8717769+08:00||;True|2025-12-03T23:56:24.0663568+08:00||;False|2025-12-03T23:55:36.1902974+08:00||;True|2025-12-03T23:51:30.6688504+08:00||;True|2025-12-03T23:34:17.1648971+08:00||;False|2025-12-03T23:34:07.7649161+08:00||;True|2025-12-03T22:32:56.2435003+08:00||;True|2025-12-03T22:27:45.6059666+08:00||;True|2025-12-03T15:55:28.0186597+08:00||;False|2025-12-03T15:54:17.5032724+08:00||;True|2025-12-03T15:53:10.2273509+08:00||;True|2025-12-02T22:11:37.4645042+08:00||;False|2025-12-02T22:10:47.1320259+08:00||;True|2025-12-02T14:39:58.8932130+08:00||;True|2025-12-02T14:36:37.1529072+08:00||;True|2025-12-02T12:58:22.0951548+08:00||;True|2025-12-02T09:30:33.7066474+08:00||;True|2025-12-02T09:30:14.5481844+08:00||;True|2025-12-02T09:30:00.3123364+08:00||;False|2025-12-02T09:29:54.4615520+08:00||;True|2025-12-02T09:13:01.7995414+08:00||;False|2025-12-02T09:12:55.8360281+08:00||;True|2025-12-02T09:12:31.0156791+08:00||;True|2025-12-02T08:55:11.3773395+08:00||;True|2025-12-02T08:53:21.3927713+08:00||;False|2025-12-02T08:48:55.8638037+08:00||;True|2025-12-02T07:29:25.2192447+08:00||;False|2025-12-02T07:29:10.2504665+08:00||;True|2025-12-02T07:28:29.0769286+08:00||;True|2025-12-01T21:53:07.6474834+08:00||;True|2025-12-01T21:44:28.1674315+08:00||;True|2025-12-01T21:18:47.2119609+08:00||;True|2025-12-01T20:51:19.9948301+08:00||;True|2025-12-01T20:50:36.9904697+08:00||;True|2025-12-01T20:44:10.1695142+08:00||;True|2025-12-01T19:27:58.0479456+08:00||;True|2025-12-01T19:16:02.2288214+08:00||;False|2025-12-01T19:15:56.0372115+08:00||;True|2025-12-01T19:15:16.4854821+08:00||;False|2025-12-01T19:15:06.7001019+08:00||;True|2025-12-01T17:10:38.9739466+08:00||;False|2025-12-01T17:10:18.8928139+08:00||;True|2025-12-01T17:03:59.3171589+08:00||;True|2025-12-01T17:03:12.5681656+08:00||;True|2025-12-01T16:42:51.4415025+08:00||;True|2025-12-01T01:29:59.6975567+08:00||;True|2025-12-01T01:29:45.1898652+08:00||;False|2025-12-01T01:29:33.1787721+08:00||;True|2025-12-01T01:27:33.1297605+08:00||;True|2025-12-01T01:27:27.3976862+08:00||;False|2025-12-01T01:27:20.5193052+08:00||;True|2025-12-01T01:11:11.0210582+08:00||;True|2025-12-01T01:04:04.3307782+08:00||;True|2025-12-01T00:55:49.8018864+08:00||;True|2025-12-01T00:27:25.1323561+08:00||;True|2025-11-30T23:58:20.7284116+08:00||;True|2025-11-30T23:57:58.3027622+08:00||;True|2025-11-30T23:57:43.0829614+08:00||;False|2025-11-30T23:57:33.5606716+08:00||;True|2025-11-30T23:54:29.6203368+08:00||;True|2025-11-30T23:54:27.5383120+08:00||;False|2025-11-30T23:54:17.0823982+08:00||;True|2025-11-30T22:41:11.4538820+08:00||;True|2025-11-30T22:38:19.7064566+08:00||;True|2025-11-30T22:37:35.2889186+08:00||;True|2025-11-30T21:42:31.1408314+08:00||;True|2025-11-30T21:42:19.5385333+08:00||;False|2025-11-30T21:42:13.3290237+08:00||;True|2025-11-30T21:33:28.0806806+08:00||;True|2025-11-30T21:16:56.7088027+08:00||;False|2025-11-30T21:16:46.1444944+08:00||;True|2025-11-30T20:21:24.4059664+08:00||;False|2025-11-30T20:21:17.6006098+08:00||;True|2025-11-30T20:20:08.2030141+08:00||;False|2025-11-30T20:16:12.3608968+08:00||;True|2025-11-30T20:15:35.6048313+08:00||;True|2025-11-30T19:45:18.7229552+08:00||;True|2025-11-30T19:45:08.6083368+08:00||;False|2025-11-30T19:44:54.7824905+08:00||;True|2025-11-30T19:44:17.0179491+08:00||;True|2025-11-30T19:44:06.7073484+08:00||;False|2025-11-30T19:43:58.2896556+08:00||;True|2025-11-30T19:42:08.2261927+08:00||;True|2025-11-30T19:28:15.7115077+08:00||;</History> <History>True|2025-12-05T15:11:51.5026151Z||;True|2025-12-05T12:46:26.1415079+08:00||;False|2025-12-05T12:46:19.1274332+08:00||;True|2025-12-05T09:04:36.7111717+08:00||;True|2025-12-05T08:22:51.7343317+08:00||;True|2025-12-05T08:20:32.0383739+08:00||;True|2025-12-04T21:58:29.4112766+08:00||;True|2025-12-04T21:58:10.0382218+08:00||;True|2025-12-04T21:57:55.3894059+08:00||;True|2025-12-04T21:10:38.8943797+08:00||;True|2025-12-04T21:09:31.5024569+08:00||;True|2025-12-04T08:22:47.9617427+08:00||;False|2025-12-04T08:22:41.3759733+08:00||;True|2025-12-04T08:14:02.2478893+08:00||;True|2025-12-04T07:57:00.2208139+08:00||;True|2025-12-03T23:58:13.3693303+08:00||;True|2025-12-03T23:57:40.4257893+08:00||;True|2025-12-03T23:56:38.8717769+08:00||;True|2025-12-03T23:56:24.0663568+08:00||;False|2025-12-03T23:55:36.1902974+08:00||;True|2025-12-03T23:51:30.6688504+08:00||;True|2025-12-03T23:34:17.1648971+08:00||;False|2025-12-03T23:34:07.7649161+08:00||;True|2025-12-03T22:32:56.2435003+08:00||;True|2025-12-03T22:27:45.6059666+08:00||;True|2025-12-03T15:55:28.0186597+08:00||;False|2025-12-03T15:54:17.5032724+08:00||;True|2025-12-03T15:53:10.2273509+08:00||;True|2025-12-02T22:11:37.4645042+08:00||;False|2025-12-02T22:10:47.1320259+08:00||;True|2025-12-02T14:39:58.8932130+08:00||;True|2025-12-02T14:36:37.1529072+08:00||;True|2025-12-02T12:58:22.0951548+08:00||;True|2025-12-02T09:30:33.7066474+08:00||;True|2025-12-02T09:30:14.5481844+08:00||;True|2025-12-02T09:30:00.3123364+08:00||;False|2025-12-02T09:29:54.4615520+08:00||;True|2025-12-02T09:13:01.7995414+08:00||;False|2025-12-02T09:12:55.8360281+08:00||;True|2025-12-02T09:12:31.0156791+08:00||;True|2025-12-02T08:55:11.3773395+08:00||;True|2025-12-02T08:53:21.3927713+08:00||;False|2025-12-02T08:48:55.8638037+08:00||;True|2025-12-02T07:29:25.2192447+08:00||;False|2025-12-02T07:29:10.2504665+08:00||;True|2025-12-02T07:28:29.0769286+08:00||;True|2025-12-01T21:53:07.6474834+08:00||;True|2025-12-01T21:44:28.1674315+08:00||;True|2025-12-01T21:18:47.2119609+08:00||;True|2025-12-01T20:51:19.9948301+08:00||;True|2025-12-01T20:50:36.9904697+08:00||;True|2025-12-01T20:44:10.1695142+08:00||;True|2025-12-01T19:27:58.0479456+08:00||;True|2025-12-01T19:16:02.2288214+08:00||;False|2025-12-01T19:15:56.0372115+08:00||;True|2025-12-01T19:15:16.4854821+08:00||;False|2025-12-01T19:15:06.7001019+08:00||;True|2025-12-01T17:10:38.9739466+08:00||;False|2025-12-01T17:10:18.8928139+08:00||;True|2025-12-01T17:03:59.3171589+08:00||;True|2025-12-01T17:03:12.5681656+08:00||;True|2025-12-01T16:42:51.4415025+08:00||;True|2025-12-01T01:29:59.6975567+08:00||;True|2025-12-01T01:29:45.1898652+08:00||;False|2025-12-01T01:29:33.1787721+08:00||;True|2025-12-01T01:27:33.1297605+08:00||;True|2025-12-01T01:27:27.3976862+08:00||;False|2025-12-01T01:27:20.5193052+08:00||;True|2025-12-01T01:11:11.0210582+08:00||;True|2025-12-01T01:04:04.3307782+08:00||;True|2025-12-01T00:55:49.8018864+08:00||;True|2025-12-01T00:27:25.1323561+08:00||;True|2025-11-30T23:58:20.7284116+08:00||;True|2025-11-30T23:57:58.3027622+08:00||;True|2025-11-30T23:57:43.0829614+08:00||;False|2025-11-30T23:57:33.5606716+08:00||;True|2025-11-30T23:54:29.6203368+08:00||;True|2025-11-30T23:54:27.5383120+08:00||;False|2025-11-30T23:54:17.0823982+08:00||;True|2025-11-30T22:41:11.4538820+08:00||;True|2025-11-30T22:38:19.7064566+08:00||;True|2025-11-30T22:37:35.2889186+08:00||;True|2025-11-30T21:42:31.1408314+08:00||;True|2025-11-30T21:42:19.5385333+08:00||;False|2025-11-30T21:42:13.3290237+08:00||;True|2025-11-30T21:33:28.0806806+08:00||;True|2025-11-30T21:16:56.7088027+08:00||;False|2025-11-30T21:16:46.1444944+08:00||;True|2025-11-30T20:21:24.4059664+08:00||;False|2025-11-30T20:21:17.6006098+08:00||;True|2025-11-30T20:20:08.2030141+08:00||;False|2025-11-30T20:16:12.3608968+08:00||;True|2025-11-30T20:15:35.6048313+08:00||;True|2025-11-30T19:45:18.7229552+08:00||;True|2025-11-30T19:45:08.6083368+08:00||;False|2025-11-30T19:44:54.7824905+08:00||;True|2025-11-30T19:44:17.0179491+08:00||;True|2025-11-30T19:44:06.7073484+08:00||;False|2025-11-30T19:43:58.2896556+08:00||;True|2025-11-30T19:42:08.2261927+08:00||;</History>
<LastFailureDetails /> <LastFailureDetails />
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
+2 -2
View File
@@ -97,8 +97,8 @@ Cookie 及 `sec_user_id` 是同步功能的核心,需严格按步骤获取,
| 镜像标签 | 架构 | | 镜像标签 | 架构 |
| ----------------- | -------------- | | ----------------- | -------------- |
| `beta_1.7.7` | x86_64 (amd64) | | `beta_1.7.9` | x86_64 (amd64) |
| `arm_1.7.7` | ARM64 | | `arm_1.7.9` | ARM64 |
### 最新镜像查看 ### 最新镜像查看
[镜像列表](http://nas.synology2023.online:10108/api/docker/dysync/1) [镜像列表](http://nas.synology2023.online:10108/api/docker/dysync/1)
+123 -16
View File
@@ -52,10 +52,37 @@
</a-button> </a-button>
</a-space> </a-space>
</a-form-item> </a-form-item>
<!-- 按钮代码 -->
<a-form-item class="form-item delete-btn-2-wrapper">
<a-button danger @click="handShowDeleteVideos" class="delete-button-2">
<ClearOutlined /> <!-- 注意首字母大写Antd图标命名规范 -->
已删除
</a-button>
</a-form-item>
</div> </div>
</a-form> </a-form>
</div> </div>
<!-- 已删除视频-抽屉 -->
<a-drawer title="已删除视频" size="large" :visible="deleteVideoShow" @close="onDeleteVideoClose">
<template #extra>
</template>
<a-list size="small" bordered :data-source="deleteVideos">
<template #renderItem="{item, index}">
<a-list-item>
<span>
{{index+1}}. {{ item.videoTitle }}
</span>
<a-button type="text" size="small" class="copy-delete-video-btn" @click="(e) => copyVideoPath(item.videoSavePath)">
<CopyOutlined /> 复制
</a-button>
</a-list-item>
</template>
</a-list>
</a-drawer>
<!-- 视频播放弹窗 - 保持原有 --> <!-- 视频播放弹窗 - 保持原有 -->
<a-modal v-model:visible="isModalOpen" :width="900" :mask-closable="false" :footer="null" @cancel="handleCancel" :body-style="{ padding: '0', overflow: 'hidden', backgroundColor: '#fff' }" :style="{ <a-modal v-model:visible="isModalOpen" :width="900" :mask-closable="false" :footer="null" @cancel="handleCancel" :body-style="{ padding: '0', overflow: 'hidden', backgroundColor: '#fff' }" :style="{
borderRadius: '8px', borderRadius: '8px',
@@ -144,7 +171,14 @@ import dayjs, { Dayjs } from 'dayjs';
import locale from 'ant-design-vue/es/date-picker/locale/zh_CN'; import locale from 'ant-design-vue/es/date-picker/locale/zh_CN';
import { message, Modal } from 'ant-design-vue'; import { message, Modal } from 'ant-design-vue';
import CryptoJS from 'crypto-js'; import CryptoJS from 'crypto-js';
import { SearchOutlined, SyncOutlined, ShareAltOutlined } from '@ant-design/icons-vue'; import {
SearchOutlined,
SyncOutlined,
ShareAltOutlined,
ClearOutlined,
CopyOutlined,
DeleteOutlined,
} from '@ant-design/icons-vue';
// 类型定义 // 类型定义
type RangeValue = [Dayjs, Dayjs]; type RangeValue = [Dayjs, Dayjs];
@@ -637,6 +671,24 @@ const handleBatchDelete = () => {
}); });
}; };
const deleteVideoShow = ref(false);
const handShowDeleteVideos = () => {
deleteVideoShow.value = true;
getDeleteViedos();
};
const deleteVideos = ref([]);
const getDeleteViedos = () => {
useApiStore()
.GetDeleteViedos()
.then((res) => {
deleteVideos.value = res.data;
});
};
const onDeleteVideoClose = (e) => {
deleteVideoShow.value = false;
};
const reDownload = (param: object) => { const reDownload = (param: object) => {
try { try {
loading.value = true; loading.value = true;
@@ -889,7 +941,6 @@ onMounted(() => {
/* 新增:批量操作开关样式 */ /* 新增:批量操作开关样式 */
.batch-operation-item { .batch-operation-item {
margin-left: 20px !important; margin-left: 20px !important;
/* margin-right: 16px !important; */
} }
.batch-switch { .batch-switch {
@@ -906,7 +957,6 @@ onMounted(() => {
.video-type-radio { .video-type-radio {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
/* gap: 8px; */
} }
.radio-group-item { .radio-group-item {
@@ -914,10 +964,12 @@ onMounted(() => {
min-width: 300px; min-width: 300px;
} }
/* 按钮组样式 */ /* 按钮组样式 - 关键修改:保持原有布局 */
.button-group-item { .button-group-item {
margin-left: auto !important; margin-left: 8px !important; /* 仅保留少量间距,不使用auto */
margin-right: 0 !important; margin-right: 0 !important;
display: flex !important;
align-items: center !important;
} }
.button-group { .button-group {
@@ -930,6 +982,30 @@ onMounted(() => {
min-width: 100px; min-width: 100px;
} }
/* 核心修复:操作行布局 - 关键修改 */
.form-actions-row {
display: flex;
align-items: center;
justify-content: flex-start;
width: 100%;
min-height: 40px;
box-sizing: border-box;
/* 移除之前的padding-right,避免影响其他按钮 */
padding-right: 0 !important;
}
/* 已删除按钮容器 - 独立定位,不影响其他按钮 */
.delete-btn-2-wrapper {
margin-left: auto !important; /* 自动靠右,不影响左侧按钮 */
margin-right: 0 !important;
padding: 0 !important;
width: 100px !important;
height: 32px !important;
display: flex !important;
align-items: center !important;
justify-content: center !important;
}
/* 响应式调整:屏幕较小时允许主查询行换行 */ /* 响应式调整:屏幕较小时允许主查询行换行 */
@media (max-width: 1440px) { @media (max-width: 1440px) {
.form-main-row { .form-main-row {
@@ -943,19 +1019,24 @@ onMounted(() => {
@media (max-width: 1200px) { @media (max-width: 1200px) {
.form-actions-row { .form-actions-row {
flex-direction: column; flex-wrap: wrap; /* 允许其他元素换行 */
align-items: flex-start !important; min-height: 60px; /* 增大行高 */
} }
.batch-operation-item { .batch-operation-item {
margin-left: 20px !important; margin-left: 20px !important;
margin-top: 8px !important; margin-top: 8px !important;
} }
/* 响应式下按钮组调整 */
.button-group-item { .button-group-item {
margin-left: 0 !important; margin-left: 20px !important;
margin-top: 12px !important; margin-top: 8px !important;
width: 100%; }
display: flex; /* 已删除按钮在小屏幕下换行显示 */
justify-content: flex-end; .delete-btn-2-wrapper {
margin-left: 20px !important;
margin-top: 8px !important;
margin-right: 0 !important;
width: auto !important;
} }
} }
@@ -1165,10 +1246,6 @@ onMounted(() => {
margin-right: 8px !important; margin-right: 8px !important;
} }
/* :deep(.ant-table-tbody tr:hover td) {
background-color: #fafafa !important;
} */
/* 新增:表格复选框列样式调整 */ /* 新增:表格复选框列样式调整 */
:deep(.ant-table-selection-column) { :deep(.ant-table-selection-column) {
width: 50px !important; width: 50px !important;
@@ -1253,4 +1330,34 @@ onMounted(() => {
text-decoration-color: #1890ff; text-decoration-color: #1890ff;
text-decoration-thickness: 1px; text-decoration-thickness: 1px;
} }
/* 已删除视频条目样式 */
.delete-video-text {
flex: 1; /* 文本占满剩余空间 */
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
margin-right: 8px;
}
/* 复制按钮样式 */
.copy-delete-video-btn {
padding: 0 4px !important;
height: 24px !important;
font-size: 12px !important;
color: #1890ff !important;
}
.copy-delete-video-btn:hover {
color: #40a9ff !important;
background-color: #f0f9ff !important;
}
/* 列表项布局调整 */
:deep(.ant-list-item) {
display: flex !important;
align-items: center !important;
justify-content: space-between !important;
padding: 8px 16px !important;
}
</style> </style>
+9
View File
@@ -218,6 +218,14 @@ export const useApiStore = defineStore('coreapi', () => {
}); });
} }
//删除
async function GetDeleteViedos() {
return http.request<any, Response<any>>('/api/video/vdelete/get', 'get').then(r => {
return r.data;
}).finally(() => {
});
}
//检查版本 //检查版本
@@ -247,6 +255,7 @@ export const useApiStore = defineStore('coreapi', () => {
} }
return { return {
GetDeleteViedos,
DelFollow, DelFollow,
AddFollow, AddFollow,
CheckTag, CheckTag,
+5
View File
@@ -20,5 +20,10 @@ namespace dy.net.model
public string ViedoId { get; set; } public string ViedoId { get; set; }
public DateTime DeleteTime { get; set; } public DateTime DeleteTime { get; set; }
[SugarColumn(IsNullable =true,Length =1000)]
public string VideoTitle { get; set; }
[SugarColumn(IsNullable = true, Length = 1000)]
public string VideoSavePath { get; set; }
} }
} }
+11
View File
@@ -227,6 +227,17 @@ namespace dy.net.service
return sqlSugarClient.Insertable(dto).ExecuteCommand() > 0; return sqlSugarClient.Insertable(dto).ExecuteCommand() > 0;
} }
/// <summary>
/// 查询已删除视频列表
/// </summary>
/// <returns></returns>
public async Task<List<DouyinVideoDelete>> GetDouyinDeleteVideos()
{
return await sqlSugarClient.Queryable<DouyinVideoDelete>()
.ToListAsync();
}
#region #region
///// <summary> ///// <summary>
+32 -43
View File
@@ -51,41 +51,41 @@ namespace dy.net.service
.ToList(); .ToList();
// 4. 事务包裹:确保插入/更新原子性 // 4. 事务包裹:确保插入/更新原子性
var transaction = await _dyCollectVideoRepository.UseTranAsync(async () => var transaction = await _dyCollectVideoRepository.UseTranAsync(async () =>
{ {
int insertedCount = 0; int insertedCount = 0;
int updatedCount = 0; int updatedCount = 0;
// 5. 批量插入新记录 // 5. 批量插入新记录
if (videosToInsert.Any()) if (videosToInsert.Any())
{ {
insertedCount = await _dyCollectVideoRepository.InsertRangeAsync(videosToInsert); insertedCount = await _dyCollectVideoRepository.InsertRangeAsync(videosToInsert);
} }
// 6. 批量更新已存在记录(核心逻辑) // 6. 批量更新已存在记录(核心逻辑)
if (videosToUpdate.Any()) if (videosToUpdate.Any())
{ {
// 建立AwemeId与待更新数据的映射(O(1)匹配效率) // 建立AwemeId与待更新数据的映射(O(1)匹配效率)
var updateMap = videosToUpdate.ToDictionary(v => v.AwemeId); var updateMap = videosToUpdate.ToDictionary(v => v.AwemeId);
// 遍历已存在实体,赋值需要更新的字段 // 遍历已存在实体,赋值需要更新的字段
List<DouyinVideo> updates= new List<DouyinVideo>(); List<DouyinVideo> updates = new List<DouyinVideo>();
foreach (var existingVideo in existingVideos) foreach (var existingVideo in existingVideos)
{ {
if (updateMap.TryGetValue(existingVideo.AwemeId, out var updateData)) if (updateMap.TryGetValue(existingVideo.AwemeId, out var updateData))
{ {
existingVideo.VideoSavePath = updateData.VideoSavePath; existingVideo.VideoSavePath = updateData.VideoSavePath;
existingVideo.VideoCoverSavePath = updateData.VideoCoverSavePath; existingVideo.VideoCoverSavePath = updateData.VideoCoverSavePath;
} }
} }
// 批量更新数据库 // 批量更新数据库
updatedCount = await _dyCollectVideoRepository.UpdateRangeAsync(existingVideos); updatedCount = await _dyCollectVideoRepository.UpdateRangeAsync(existingVideos);
} }
}, ex => }, ex =>
{ {
Serilog.Log.Error(ex, "批量插入/更新抖音视频失败,AwemeIds{AwemeIds}", string.Join(",", allAwemeIds)); Serilog.Log.Error(ex, "批量插入/更新抖音视频失败,AwemeIds{AwemeIds}", string.Join(",", allAwemeIds));
}); });
return transaction; return transaction;
} }
@@ -148,7 +148,6 @@ namespace dy.net.service
return await _dyCollectVideoRepository.GetPagedAsync(dto); return await _dyCollectVideoRepository.GetPagedAsync(dto);
} }
/// <summary> /// <summary>
/// 关注的博主的视频如果配置为视频标题作为文件名,生成文件名 /// 关注的博主的视频如果配置为视频标题作为文件名,生成文件名
/// </summary> /// </summary>
@@ -171,8 +170,6 @@ namespace dy.net.service
return await _dyCollectVideoRepository.GetByIdAsync(id); return await _dyCollectVideoRepository.GetByIdAsync(id);
} }
/// <summary> /// <summary>
/// 重新下载选中的视频 /// 重新下载选中的视频
/// </summary> /// </summary>
@@ -314,14 +311,6 @@ namespace dy.net.service
} }
} }
/// <summary>
/// 获取待重新下载的视频列表
/// </summary>
/// <returns></returns>
public async Task<List<DouyinReDownload>> GetViedoReDowns()
{
return await _dyCollectVideoRepository.GetViedoReDowns();
}
} }
} }