关注博主列表同步bug修复
This commit is contained in:
@@ -87,6 +87,12 @@ namespace dy.net.service
|
||||
return await _cookieRepository.UpdateAsync(dyUserCookies);
|
||||
}
|
||||
|
||||
// 更新
|
||||
public async Task<bool> UpdateCookieAsync(DouyinCookie dyUserCookies)
|
||||
{
|
||||
return await _cookieRepository.UpdateCookie(dyUserCookies);
|
||||
}
|
||||
|
||||
// 删除(根据主键)
|
||||
public async Task<bool> DeleteByIdAsync(string id)
|
||||
{
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace dy.net.service
|
||||
"抖音关注博主作品同步任务")
|
||||
},
|
||||
{
|
||||
"follow_user",
|
||||
"关注列表",
|
||||
new JobConfig(
|
||||
typeof(DouyinFollowsAndCollnectsSyncJob),
|
||||
"dy.job.key.follow_user",
|
||||
@@ -101,7 +101,7 @@ namespace dy.net.service
|
||||
/// <param name="expression">Cron表达式或间隔分钟数(所有任务使用相同的执行频率)</param>
|
||||
/// <param name="isRestart"></param>
|
||||
/// <returns>是否启动成功</returns>
|
||||
public async Task<bool> InitOrReStartAllJobs(string expression,bool isRestart=false)
|
||||
public async Task<bool> InitOrReStartAllJobs(string expression)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(expression))
|
||||
{
|
||||
@@ -116,14 +116,9 @@ namespace dy.net.service
|
||||
// 移除所有已存在的任务(避免重复调度)
|
||||
await RemoveAllExistingJobs(scheduler);
|
||||
|
||||
// 遍历启动所有任务(独立执行,无顺序依赖)
|
||||
// 统一生成任务列表
|
||||
var jobKeys = isRestart
|
||||
? JobConfigs.Keys.Where(k => k != "follow_user_once").ToList()
|
||||
: JobConfigs.Keys.Where(k => k != "follow_user_once" && k != "follow_user").ToList();
|
||||
|
||||
// 执行任务启动逻辑
|
||||
foreach (var jobKey in jobKeys)
|
||||
foreach (var jobKey in JobConfigs.Keys)
|
||||
{
|
||||
if (jobKey == "follow_user") expression = "60";
|
||||
var startSuccess = await StartJobAsync(jobKey, expression);
|
||||
@@ -136,19 +131,11 @@ namespace dy.net.service
|
||||
Log.Error($"启动任务失败:{jobKey}");
|
||||
}
|
||||
}
|
||||
// 补充日志和单次任务
|
||||
if (isRestart)
|
||||
{
|
||||
Log.Information($"共启动 {jobKeys.Count} 个定时任务");
|
||||
}
|
||||
else
|
||||
{
|
||||
await StartOneTimeJobAsync("follow_user_once");
|
||||
}
|
||||
Log.Information($"共启动 {JobConfigs.Count} 个定时任务");
|
||||
|
||||
|
||||
//await StartJobAsync(VideoTypeEnum.dy_custom_collect.GetDesc(), expression);
|
||||
|
||||
//await StartFollowJobOnceAsync();
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -391,10 +391,10 @@ namespace dy.net.service
|
||||
Date = g.Key,
|
||||
Collect = g.Count(x => x.ViedoType == VideoTypeEnum.dy_collects || x.ViedoType == VideoTypeEnum.dy_custom_collect),
|
||||
Favorite = g.Count(x => x.ViedoType == VideoTypeEnum.dy_favorite),
|
||||
Follow = g.Count(x => x.ViedoType != VideoTypeEnum.dy_follows),
|
||||
Follow = g.Count(x => x.ViedoType == VideoTypeEnum.dy_follows),
|
||||
Graphic = g.Count(x => string.IsNullOrEmpty(x.FileHash)),
|
||||
Mix = g.Count(x => x.ViedoType != VideoTypeEnum.dy_mix),
|
||||
Series = g.Count(x => x.ViedoType != VideoTypeEnum.dy_series),
|
||||
Mix = g.Count(x => x.ViedoType == VideoTypeEnum.dy_mix),
|
||||
Series = g.Count(x => x.ViedoType == VideoTypeEnum.dy_series),
|
||||
})
|
||||
.ToList();
|
||||
return resultData;
|
||||
|
||||
Reference in New Issue
Block a user