完成前端改造
1、下一步实现各个分类下载视频中重复视频去除-可配置是否去重
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using ClockSnowFlake;
|
||||
using dy.net.dto;
|
||||
using dy.net.model;
|
||||
using dy.net.utils;
|
||||
using SqlSugar;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
@@ -18,7 +19,15 @@ namespace dy.net.service
|
||||
|
||||
public AppConfig GetConfig()
|
||||
{
|
||||
return sqlSugarClient.Queryable<AppConfig>().First();
|
||||
var config= sqlSugarClient.Queryable<AppConfig>().First();
|
||||
|
||||
var downImgConfig = Appsettings.Get(SystemStaticUtil.DOWN_IMAGE_VIDEO_ENABLE);
|
||||
if (!string.IsNullOrEmpty(downImgConfig))
|
||||
{
|
||||
downImgConfig = downImgConfig.ToLower();
|
||||
config.DownImageVideoFromEnv = downImgConfig == "1";
|
||||
}
|
||||
return config;
|
||||
}
|
||||
/// <summary>
|
||||
/// 初始化并返回配置
|
||||
@@ -42,7 +51,7 @@ namespace dy.net.service
|
||||
Cron = "30",
|
||||
BatchCount = 10,
|
||||
DownImageVideo = downLoadImage,
|
||||
KeepLogDay = 10
|
||||
LogKeepDay = 10
|
||||
};
|
||||
sqlSugarClient.Insertable(config).ExecuteCommand();
|
||||
return config;
|
||||
@@ -76,16 +85,28 @@ namespace dy.net.service
|
||||
/// </summary>
|
||||
public void UpdateCollectViedoType()
|
||||
{
|
||||
var collectViedos = sqlSugarClient.Queryable<DouyinVideo>().Where(x => string.IsNullOrWhiteSpace(x.ViedoType)).ToList();
|
||||
|
||||
if (collectViedos.Any())
|
||||
{
|
||||
collectViedos.ForEach(x =>
|
||||
{
|
||||
x.ViedoType = "2";
|
||||
});
|
||||
sqlSugarClient.Updateable(collectViedos).ExecuteCommand();
|
||||
}
|
||||
string sql= @"UPDATE dy_collect_video
|
||||
SET ViedoType = CASE
|
||||
WHEN ViedoType = '0' THEN 0
|
||||
WHEN ViedoType = '1' THEN 1
|
||||
WHEN ViedoType = '2' THEN 2
|
||||
WHEN ViedoType = '3' THEN 3
|
||||
WHEN ViedoType = '4' THEN 4
|
||||
ELSE NULL
|
||||
END;";
|
||||
|
||||
sqlSugarClient.Ado.ExecuteCommand(sql);
|
||||
//var collectViedos = sqlSugarClient.Queryable<DouyinVideo>().ToList();
|
||||
|
||||
//if (collectViedos.Any())
|
||||
//{
|
||||
// collectViedos.ForEach(x =>
|
||||
// {
|
||||
// x.ViedoType = x.;
|
||||
// });
|
||||
// sqlSugarClient.Updateable(collectViedos).ExecuteCommand();
|
||||
//}
|
||||
}
|
||||
/// <summary>
|
||||
/// 重置所有Cookie的同步状态为0
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace dy.net.service
|
||||
/// <returns></returns>
|
||||
public async Task StartJob(string expression,int delay=5000)
|
||||
{
|
||||
//await StartCollectJob(expression);
|
||||
await StartCollectJob(expression);
|
||||
|
||||
await Task.Delay(delay);
|
||||
//如果是数字则加1分钟,减少并发
|
||||
@@ -37,7 +37,7 @@ namespace dy.net.service
|
||||
cron2++;
|
||||
expression = cron2.ToString();
|
||||
}
|
||||
//await StartUperPostJob(expression);
|
||||
await StartUperPostJob(expression);
|
||||
}
|
||||
|
||||
private async Task<bool> StartCollectJob(string expression)
|
||||
|
||||
@@ -67,17 +67,26 @@ namespace dy.net.service
|
||||
CategoryCount = list.Select(x => x.Tag1).Distinct().Count(),
|
||||
VideoCount = list.Count,
|
||||
Categories = Categories,
|
||||
FavoriteCount = list.Count(x => x.ViedoType == "1"),
|
||||
CollectCount = list.Count(x => x.ViedoType == "2"),
|
||||
FollowCount = list.Count(x => x.ViedoType == "3"),
|
||||
FavoriteCount = list.Count(x => x.ViedoType == VideoTypeEnum.Favorite),
|
||||
CollectCount = list.Count(x => x.ViedoType == VideoTypeEnum.Collect),
|
||||
FollowCount = list.Count(x => x.ViedoType == VideoTypeEnum.UperPost),
|
||||
GraphicVideoCount = list.Count(x => x.ViedoType == VideoTypeEnum.ImageVideo),
|
||||
|
||||
VideoSizeTotal = ByteToGbConverter.ConvertBytesToGb(list.Sum(x => x.FileSize)),
|
||||
VideoFavoriteSize = ByteToGbConverter.ConvertBytesToGb(list.Where(x => x.ViedoType == "1").Sum(x => x.FileSize)),
|
||||
VideoCollectSize = ByteToGbConverter.ConvertBytesToGb(list.Where(x => x.ViedoType == "2").Sum(x => x.FileSize)),
|
||||
VideoFollowSize = ByteToGbConverter.ConvertBytesToGb(list.Where(x => x.ViedoType == "3").Sum(x => x.FileSize)),
|
||||
VideoFavoriteSize = ByteToGbConverter.ConvertBytesToGb(list.Where(x => x.ViedoType == VideoTypeEnum.Favorite).Sum(x => x.FileSize)),
|
||||
VideoCollectSize = ByteToGbConverter.ConvertBytesToGb(list.Where(x => x.ViedoType == VideoTypeEnum.Collect).Sum(x => x.FileSize)),
|
||||
VideoFollowSize = ByteToGbConverter.ConvertBytesToGb(list.Where(x => x.ViedoType == VideoTypeEnum.UperPost).Sum(x => x.FileSize)),
|
||||
GraphicVideoSize = ByteToGbConverter.ConvertBytesToGb(list.Where(x => x.ViedoType == VideoTypeEnum.ImageVideo).Sum(x => x.FileSize)),
|
||||
|
||||
//TotalDiskSize= ByteToGbConverter.GetHostTotalDiskSpaceGB(),
|
||||
};
|
||||
if (data.GraphicVideoSize == "0.00")
|
||||
{
|
||||
if(list.Where(x => x.ViedoType == VideoTypeEnum.ImageVideo).Sum(x => x.FileSize) > 0)
|
||||
{
|
||||
data.GraphicVideoSize = "<0.01";//避免显示0.00误导用户
|
||||
}
|
||||
}
|
||||
data.Authors = list.GroupBy(x => x.Author).Select(x => new VideoStaticsItemDto { Name = x.Key, Count = x.LongCount(), Icon = x.FirstOrDefault().AuthorAvatarUrl }).OrderByDescending(d => d.Count).ToList();
|
||||
return data;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user