清理无效的视频同步记录
This commit is contained in:
@@ -259,5 +259,16 @@ namespace dy.net.Controllers
|
||||
{
|
||||
return ApiResult.Success(await douyinVideoService.GetLastSyncTop(top));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除无效视频记录
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("removeInvalid")]
|
||||
public async Task<IActionResult> RemoveInvalidVideo()
|
||||
{
|
||||
var data = await douyinVideoService.DeleteInvalidVideo();
|
||||
return Ok(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<_PublishTargetUrl>E:\code\dysync\bin\Release\net6.0\publish\</_PublishTargetUrl>
|
||||
<History>True|2025-12-29T10:57:29.7032246Z||;True|2025-12-27T14:52:24.4780776+08:00||;False|2025-12-27T14:52:19.5635794+08:00||;True|2025-12-27T14:48:01.6252748+08:00||;False|2025-12-27T14:47:55.7976192+08:00||;True|2025-12-27T14:38:23.9723838+08:00||;True|2025-12-27T13:00:29.8583858+08:00||;True|2025-12-26T22:18:42.4015637+08:00||;True|2025-12-26T22:10:58.5274572+08:00||;True|2025-12-26T22:06:26.3129600+08:00||;True|2025-12-26T22:03:55.6718618+08:00||;False|2025-12-26T22:03:48.3809954+08:00||;True|2025-12-26T22:02:33.1840390+08:00||;True|2025-12-26T22:01:16.1660100+08:00||;True|2025-12-25T00:50:26.1116465+08:00||;True|2025-12-25T00:48:27.3087708+08:00||;True|2025-12-25T00:47:38.4835720+08:00||;</History>
|
||||
<History>True|2025-12-30T01:19:08.3178124Z||;True|2025-12-29T18:57:29.7032246+08:00||;True|2025-12-27T14:52:24.4780776+08:00||;False|2025-12-27T14:52:19.5635794+08:00||;True|2025-12-27T14:48:01.6252748+08:00||;False|2025-12-27T14:47:55.7976192+08:00||;True|2025-12-27T14:38:23.9723838+08:00||;True|2025-12-27T13:00:29.8583858+08:00||;True|2025-12-26T22:18:42.4015637+08:00||;True|2025-12-26T22:10:58.5274572+08:00||;True|2025-12-26T22:06:26.3129600+08:00||;True|2025-12-26T22:03:55.6718618+08:00||;False|2025-12-26T22:03:48.3809954+08:00||;True|2025-12-26T22:02:33.1840390+08:00||;True|2025-12-26T22:01:16.1660100+08:00||;True|2025-12-25T00:50:26.1116465+08:00||;True|2025-12-25T00:48:27.3087708+08:00||;True|2025-12-25T00:47:38.4835720+08:00||;</History>
|
||||
<LastFailureDetails />
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"deploy": "docker", //fn,docker
|
||||
"dbconn": "",
|
||||
"tagName": "beta_1.9.3", //arm,beta
|
||||
"tagName": "beta_1.9.4", //arm,beta
|
||||
"dbtype": "Sqlite",
|
||||
"fnVersion": "1.0.0"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace dy.net.dto
|
||||
{
|
||||
public class DeleteInvalidVideoDto
|
||||
{
|
||||
public string AwId { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string Path { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -318,5 +318,32 @@ namespace dy.net.service
|
||||
return await _dyCollectVideoRepository.GetTopsOrderBySyncTime(top);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 删除无效记录(记录存在,用户手动把目录下的视频删了的情况,视频记录依然存在)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<DeleteInvalidVideoDto>> DeleteInvalidVideo()
|
||||
{
|
||||
var videos=await _dyCollectVideoRepository.GetAllAsync();
|
||||
List<DeleteInvalidVideoDto> vList = new List<DeleteInvalidVideoDto>();
|
||||
|
||||
List<string> douyinVideoIds=new List<string>();
|
||||
foreach (var v in videos)
|
||||
{
|
||||
if (!File.Exists(v.VideoSavePath))
|
||||
{
|
||||
douyinVideoIds.Add(v.Id);
|
||||
vList.Add(new DeleteInvalidVideoDto { AwId = v.AwemeId, Title = v.VideoTitle, Path = v.VideoSavePath });
|
||||
}
|
||||
}
|
||||
|
||||
if (douyinVideoIds.Any())
|
||||
{
|
||||
await _dyCollectVideoRepository.DeleteByIdsAsync(douyinVideoIds);
|
||||
}
|
||||
|
||||
return vList;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user