using dy.net.dto; using Newtonsoft.Json; using SqlSugar; namespace dy.net.model { [SugarTable(TableName = "dy_cookie")] public class DouyinUserCookie { [SugarColumn(IsPrimaryKey = true)] public string Id { get; set; } /// /// 用户账号-唯一就行,手机号啥的 /// //public string UserId { get; set; } /// /// 用户描述 /// public string UserName { get; set; } /// /// 用户抖音Cookie /// [SugarColumn(Length =-1,IsNullable =true)] public string Cookies { get; set; } /// /// 存储路径 /// [SugarColumn(Length =255,IsNullable =true)] public string SavePath { get; set; } public int Status { get; set; } /// /// 同步喜欢的视频需要sec_user_id /// [SugarColumn(Length =500,IsNullable =true)] public string SecUserId { get; set; } /// /// 喜欢的视频存储路径 /// [SugarColumn(Length =500,IsNullable =true)] public string FavSavePath { get; set; } ///// ///// 最新收藏夹的分页页码 ///// //[SugarColumn(Length =500,IsNullable =true)] //public string CollectMaxCursor { get; set; } ///// ///// 最新我喜欢的分页页码 ///// //[SugarColumn(Length = 500, IsNullable = true)] //public string FavoriteMaxCursor { get; set; } /// /// 是否已经同步过了(就是是否是第一次同步) 0-未同步 1-已同步 /// 如果是0,则同步时会获取全部数据;如果是1,则同步时只获取最新的数据(也就是只查一次) /// 接口可以将该值改为0,下次开始同步就会重新获取全部数据 /// public int CollHasSyncd { get; set; } public int FavHasSyncd { get; set; } public int UperSyncd { get; set; } /// /// 关注的用户sec_user_id列表 json字符串存储 /// [SugarColumn(Length =-1,IsNullable =true)] public string UpSecUserIds { get; set; } /// /// Up主发布的视频存储路径 /// [SugarColumn(Length = 500, IsNullable = true)] public string UpSavePath { get; set; } /// /// 图片视频存储路径 /// [SugarColumn(Length = 500, IsNullable = true)] public string ImgSavePath { get; set; } [SugarColumn(IsIgnore = true)] public List UpSecUserIdsJson { get { // 反序列化逻辑(保持不变) if (string.IsNullOrWhiteSpace(UpSecUserIds)) { return new List(); } try { return JsonConvert.DeserializeObject>(UpSecUserIds); } catch (JsonSerializationException ex) { // 日志记录(按需添加) // Logger.Error($"反序列化失败:{ex.Message},原始值:{UpSecUserIds}"); return new List(); } catch (Exception ex) { // 日志记录(按需添加) // Logger.Error($"处理异常:{ex.Message}"); return new List(); } } 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; } } } } }