增加同步指定博主的作品

This commit is contained in:
lijianyou
2025-10-19 01:11:55 +08:00
parent 14a709e691
commit 59ce4f59ed
25 changed files with 1865 additions and 277 deletions
+1 -1
View File
@@ -122,7 +122,7 @@ namespace dy.net.model
public string ViedoType { get; set; }
[SugarColumn(IsIgnore = true)]
public string ViedoTypeStr => ViedoType == "1" ? "喜欢的" : "我收藏的";
public string ViedoTypeStr => ViedoType == "1" ? "喜欢的" : (ViedoType == "2"? "收藏的":"关注的");
[SugarColumn(IsIgnore = true)]
public string ViedoCate =>(string.IsNullOrWhiteSpace(Tag1) ? "" : Tag1) + "/" + (string.IsNullOrWhiteSpace(Tag2) ? "" : Tag2);
+81 -2
View File
@@ -1,4 +1,6 @@
using SqlSugar;
using dy.net.dto;
using Newtonsoft.Json;
using SqlSugar;
namespace dy.net.model
{
@@ -6,7 +8,7 @@ namespace dy.net.model
public class DyUserCookies
{
[SqlSugar.SugarColumn(IsPrimaryKey = true)]
[SugarColumn(IsPrimaryKey = true)]
public string Id { get; set; }
/// <summary>
/// 用户账号-唯一就行,手机号啥的
@@ -52,5 +54,82 @@ namespace dy.net.model
///// </summary>
//[SugarColumn(Length = 500, IsNullable = true)]
//public string FavoriteMaxCursor { get; set; }
/// <summary>
/// 是否已经同步过了(就是是否是第一次同步) 0-未同步 1-已同步
/// 如果是0,则同步时会获取全部数据;如果是1,则同步时只获取最新的数据(也就是只查一次)
/// 接口可以将该值改为0,下次开始同步就会重新获取全部数据
/// </summary>
public int CollHasSyncd { get; set; }
public int FavHasSyncd { get; set; }
public int UperSyncd { get; set; }
/// <summary>
/// 关注的用户sec_user_id列表 json字符串存储
/// </summary>
[SugarColumn(Length =-1,IsNullable =true)]
public string UpSecUserIds { get; set; }
/// <summary>
/// Up主发布的视频存储路径
/// </summary>
[SugarColumn(Length = 500, IsNullable = true)]
public string UpSavePath { get; set; }
[SugarColumn(IsIgnore = true)]
public List<DyUpSecUserIdDto> UpSecUserIdsJson
{
get
{
// 反序列化逻辑(保持不变)
if (string.IsNullOrWhiteSpace(UpSecUserIds))
{
return new List<DyUpSecUserIdDto>();
}
try
{
return JsonConvert.DeserializeObject<List<DyUpSecUserIdDto>>(UpSecUserIds);
}
catch (JsonSerializationException ex)
{
// 日志记录(按需添加)
// Logger.Error($"反序列化失败:{ex.Message},原始值:{UpSecUserIds}");
return new List<DyUpSecUserIdDto>();
}
catch (Exception ex)
{
// 日志记录(按需添加)
// Logger.Error($"处理异常:{ex.Message}");
return new List<DyUpSecUserIdDto>();
}
}
set
{
// 序列化逻辑:将列表转为JSON字符串,赋值给UpSecUserIds
try
{
// 若传入的列表为null,直接设为空字符串(避免序列化后出现"null"字符串)
UpSecUserIds = value == null
? string.Empty
: JsonConvert.SerializeObject(value);
}
catch (JsonSerializationException ex)
{
// 捕获序列化异常(如对象循环引用、不支持的类型等)
// Logger.Error($"序列化失败:{ex.Message},列表值:{value}");
// 异常时默认设为空字符串,避免存储错误的JSON
UpSecUserIds = string.Empty;
}
catch (Exception ex)
{
// 捕获其他未知异常
// Logger.Error($"设置值异常:{ex.Message}");
UpSecUserIds = string.Empty;
}
}
}
}
}