博主的视频 增加配置 用标题做文件名,但是要对标题进行处理后才可以做文件名。另外对于可能重复的标题进行处理

This commit is contained in:
jianzhichu
2025-11-18 22:38:25 +08:00
parent 8dcda7877e
commit 8048f7e1e6
8 changed files with 284 additions and 75 deletions
+48 -1
View File
@@ -1,5 +1,8 @@
using dy.net.model;
using dy.net.dto;
using dy.net.model;
using Quartz.Util;
using SqlSugar;
using System.Linq;
namespace dy.net.repository
{
@@ -59,5 +62,49 @@ namespace dy.net.repository
return (list, totalCount);
}
/// <summary>
///
/// </summary>
/// <param name="AuthorId"></param>
/// <param name="ViedoNameSimplify"></param>
/// <returns></returns>
public async Task<(string, string)> GetUperLastViedoFileName(string AuthorId,string ViedoNameSimplify)
{
var video= await this.Db.Queryable<DyCollectVideo>().Where(x => x.AuthorId == AuthorId && x.ViedoType == "3")
.Where(x => x.VideoTitleSimplify == ViedoNameSimplify)
.OrderByDescending(x => x.CreateTime).FirstAsync();
if (video != null)
{
if (string.IsNullOrWhiteSpace(video.VideoTitleSimplifyPrefix))
{
return (ViedoNameSimplify, "001");
}
else
{
//VideoTitleSimplifyPrefix的规则是从001开始
var prefixNumber = video.VideoTitleSimplifyPrefix.TrimEnd('-');
if (int.TryParse(prefixNumber, out int number))
{
number += 1;
return (ViedoNameSimplify, number.ToString("D3"));
}
else
{
return (ViedoNameSimplify, "001");
}
}
}
else
{
return (ViedoNameSimplify, "");
}
}
}
}