1、删除视频,永不下载
2、去重-优先级 3、视频合成优化 4、其他优化
This commit is contained in:
@@ -93,11 +93,11 @@ namespace dy.net.repository
|
||||
/// <param name="followInfos"></param>
|
||||
/// <param name="myselfUserId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> Sync(List<FollowingsItem> followInfos, string myselfUserId)
|
||||
public async Task<bool> Sync(List<FollowingsItem> followInfos, DouyinCookie ck)
|
||||
{
|
||||
// 基础参数校验
|
||||
if (followInfos == null) followInfos = new List<FollowingsItem>();
|
||||
if (string.IsNullOrWhiteSpace(myselfUserId))
|
||||
if (ck==null || string.IsNullOrWhiteSpace(ck.MyUserId))
|
||||
{
|
||||
Serilog.Log.Error("同步关注列表失败:当前用户ID为空");
|
||||
return false;
|
||||
@@ -107,7 +107,7 @@ namespace dy.net.repository
|
||||
{
|
||||
// 1. 查询现有关注列表
|
||||
List<DouyinFollowed> existFollows = await Db.Queryable<DouyinFollowed>()
|
||||
.Where(x => x.mySelfId == myselfUserId)
|
||||
.Where(x => x.mySelfId == ck.MyUserId)
|
||||
.Where(x=>!x.IsNoFollowed) //排除手动添加但未关注的用户
|
||||
.ToListAsync() ?? new List<DouyinFollowed>();
|
||||
|
||||
@@ -161,7 +161,7 @@ namespace dy.net.repository
|
||||
Id = IdGener.GetLong().ToString(),
|
||||
Enterprise = follow.EnterpriseVerifyReason,
|
||||
LastSyncTime = DateTime.UtcNow,
|
||||
mySelfId = myselfUserId,
|
||||
mySelfId = ck.MyUserId,
|
||||
SecUid = follow.SecUid,
|
||||
OpenSync = false,
|
||||
UperAvatar = follow.Avatar?.UrlList?.FirstOrDefault() ?? "",
|
||||
@@ -201,8 +201,6 @@ namespace dy.net.repository
|
||||
Serilog.Log.Error("同步关注列表失败:关注信息更新异常");
|
||||
return false;
|
||||
}
|
||||
|
||||
Serilog.Log.Debug($"同步关注列表:成功更新{toUpdateFollows.Count}条关注信息(用户ID:{myselfUserId})");
|
||||
}
|
||||
|
||||
// 6. 分批处理删除(单批200条)
|
||||
@@ -212,7 +210,7 @@ namespace dy.net.repository
|
||||
async batch =>
|
||||
{
|
||||
var secUids = batch.Select(x => x.SecUid).ToList();
|
||||
await DeleteAsync(x => x.mySelfId == myselfUserId && secUids.Contains(x.SecUid));
|
||||
await DeleteAsync(x => x.mySelfId == ck.MyUserId && secUids.Contains(x.SecUid));
|
||||
return true;
|
||||
});
|
||||
|
||||
@@ -223,12 +221,12 @@ namespace dy.net.repository
|
||||
}
|
||||
}
|
||||
|
||||
Serilog.Log.Debug($"同步关注列表完成(用户ID:{myselfUserId}):新增{toAddFollows.Count}条,更新{toUpdateFollows.Count}条,删除{toRemoveFollows.Count}条");
|
||||
Serilog.Log.Debug($"dy_followed_users({ck.UserName})关注列表同步完成:新增{toAddFollows.Count}条,更新{toUpdateFollows.Count}条,删除{toRemoveFollows.Count}条");
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Serilog.Log.Error(ex, $"同步关注列表失败(用户ID:{myselfUserId}):{ex.Message}");
|
||||
Serilog.Log.Error(ex, $"同步关注列表失败({ck.UserName}):{ex.Message}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,10 +33,11 @@ namespace dy.net.repository
|
||||
|
||||
|
||||
VideoTypeEnum? enumviedoType = null;
|
||||
if (!string.IsNullOrEmpty(dto.ViedoType) && dto.ViedoType != "*")
|
||||
if (!string.IsNullOrEmpty(dto.ViedoType) && dto.ViedoType != "*" && dto.ViedoType != "4")
|
||||
{
|
||||
enumviedoType = dto.ViedoType.ToVideoTypeEnum();
|
||||
}
|
||||
|
||||
var where = this.Db.Queryable<DouyinVideo>()
|
||||
//.WhereIF(!string.IsNullOrWhiteSpace(title), x => x.VideoTitle.Contains(title))
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(dto.Title), x => x.VideoTitle.Contains(dto.Title))
|
||||
@@ -45,7 +46,8 @@ namespace dy.net.repository
|
||||
.WhereIF(end.HasValue, x => x.SyncTime <= end.Value)
|
||||
.WhereIF(start2.HasValue, x => x.CreateTime >= start2.Value)
|
||||
.WhereIF(end2.HasValue, x => x.CreateTime <= end2.Value)
|
||||
.WhereIF(enumviedoType.HasValue, x => x.ViedoType == enumviedoType);
|
||||
.WhereIF(enumviedoType.HasValue, x => x.ViedoType == enumviedoType)
|
||||
.WhereIF(dto.ViedoType == "4", x => x.IsMergeVideo == 1);
|
||||
|
||||
|
||||
var totalCount = await where.CountAsync();
|
||||
@@ -90,7 +92,7 @@ namespace dy.net.repository
|
||||
public async Task<(string, string)> GetUperLastViedoFileName(string AuthorId, string ViedoNameSimplify)
|
||||
{
|
||||
|
||||
var video = await this.Db.Queryable<DouyinVideo>().Where(x => x.AuthorId == AuthorId && x.ViedoType == VideoTypeEnum.UperPost)
|
||||
var video = await this.Db.Queryable<DouyinVideo>().Where(x => x.AuthorId == AuthorId && x.ViedoType == VideoTypeEnum.dy_follows)
|
||||
.Where(x => x.VideoTitleSimplify == ViedoNameSimplify)
|
||||
.OrderByDescending(x => x.CreateTime).FirstAsync();
|
||||
|
||||
@@ -140,7 +142,7 @@ namespace dy.net.repository
|
||||
/// </summary>
|
||||
/// <param name="downs"></param>
|
||||
/// <returns></returns>
|
||||
public bool InsertReDowns(List<ViedoReDown> downs)
|
||||
public bool InsertReDowns(List<DouyinReDownload> downs)
|
||||
{
|
||||
if (downs != null)
|
||||
{
|
||||
@@ -169,9 +171,9 @@ namespace dy.net.repository
|
||||
}
|
||||
|
||||
// 构建更新条件(统一Where条件,避免重复代码)
|
||||
var updateable = Db.Updateable<ViedoReDown>()
|
||||
var updateable = Db.Updateable<DouyinReDownload>()
|
||||
.Where(it => it.Id == videoId)
|
||||
.SetColumns(it => new ViedoReDown
|
||||
.SetColumns(it => new DouyinReDownload
|
||||
{
|
||||
Status = status,
|
||||
UpdateTime = DateTime.Now
|
||||
@@ -197,9 +199,9 @@ namespace dy.net.repository
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<ViedoReDown>> GetViedoReDowns()
|
||||
public async Task<List<DouyinReDownload>> GetViedoReDowns()
|
||||
{
|
||||
return await this.Db.Queryable<ViedoReDown>()
|
||||
return await this.Db.Queryable<DouyinReDownload>()
|
||||
.Where(x => x.Status == 0 || x.Status == 2)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user