This commit is contained in:
qianhao.xu
2024-12-03 09:25:16 +08:00
parent 96e44cfc4e
commit 586d2e60dc
661 changed files with 996 additions and 28248 deletions

View File

@@ -0,0 +1,127 @@
using DOAN.Model.Enum;
namespace DOAN.Model.Content
{
/// <summary>
/// 文章表
/// </summary>
[SugarTable("article", "内容管理")]
[Tenant("0")]
public class Article
{
/// <summary>
/// 文章id
/// </summary>
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
public long Cid { get; set; }
/// <summary>
/// 文章标题
/// </summary>
[SugarColumn(ColumnDescription = "文章标题", Length = 254)]
public string Title { get; set; }
/// <summary>
/// 发布时间
/// </summary>
[SugarColumn(ColumnDescription = "发布时间")]
public DateTime? CreateTime { get; set; }
/// <summary>
/// 修改时间
/// </summary>
[SugarColumn(IsOnlyIgnoreInsert = true, ColumnDescription = "更新时间")]
public DateTime? UpdateTime { get; set; }
/// <summary>
/// 文章内容
/// </summary>
[SugarColumn(ColumnDescription = "文章内容", ColumnDataType = StaticConfig.CodeFirst_BigString)]
public string Content { get; set; }
/// <summary>
/// 作者名
/// </summary>
[SugarColumn(ColumnDescription = "作者名", Length = 20, ExtendedAttribute = ProteryConstant.NOTNULL)]
public string AuthorName { get; set; }
/// <summary>
/// 发布者用户id
/// </summary>
[SugarColumn(ColumnDescription = "发布者用户id", ExtendedAttribute = ProteryConstant.NOTNULL)]
public long UserId { get; set; }
/// <summary>
/// 文章状态 1、发布 2、草稿
/// </summary>
[SugarColumn(ColumnDescription = "文章状态 1、发布 2、草稿", Length = 20)]
public string Status { get; set; }
/// <summary>
/// 编辑器类型 markdown,html
/// </summary>
[SugarColumn(ColumnDescription = "编辑器类型markdown,html", ColumnName = "editorType", Length = 20, IsNullable = true)]
public string EditorType { get; set; }
/// <summary>
/// 文章标签egNet5,java
/// </summary>
[SugarColumn(ColumnDescription = "文章标签", Length = 20)]
public string Tags { get; set; }
/// <summary>
/// 点击量
/// </summary>
[SugarColumn(ColumnDescription = "点击量", DefaultValue = "0")]
public int Hits { get; set; }
[SugarColumn(ColumnDescription = "目录id", ColumnName = "category_Id")]
public int CategoryId { get; set; }
/// <summary>
/// 封面地址
/// </summary>
[SugarColumn(ColumnDescription = "封面地址", Length = 5000)]
public string CoverUrl { get; set; }
/// <summary>
/// 是否公开 1、公开 0、不公开
/// </summary>
[SugarColumn(ColumnDescription = "是否公开 1、公开 0、不公开", DefaultValue = "0")]
public int IsPublic { get; set; }
/// <summary>
/// 是否置顶
/// </summary>
public int IsTop { get; set; }
/// <summary>
/// 0、文章 1、随笔 2、动态
/// </summary>
[SugarColumn(ColumnDescription = "内容类型0、文章 1、随笔 2、动态", DefaultValue = "0")]
public ArticleTypeEnum ArticleType { get; set; }
/// <summary>
/// 摘要
/// </summary>
public string AbstractText { get; set; }
/// <summary>
/// 分类
/// </summary>
[Navigate(NavigateType.OneToOne, nameof(CategoryId), nameof(ArticleCategory.CategoryId))] //自定义关系映射
public ArticleCategory ArticleCategoryNav { get; set; }
/// <summary>
/// 评论数
/// </summary>
public int CommentNum { get; set; }
/// <summary>
/// 点赞数
/// </summary>
public int PraiseNum { get; set; }
/// <summary>
/// 用户IP
/// </summary>
public string UserIP { get; set; }
/// <summary>
/// 地理位置
/// </summary>
public string Location { get; set; }
/// <summary>
/// 话题ID
/// </summary>
public long TopicId { get; set; }
/// <summary>
/// 评论开关 0、所有人可评论 1、仅粉丝 2、仅自己
/// </summary>
public CommentSwitchEnum CommentSwitch { get; set; }
/// <summary>
/// 审核状态 0、待审核 1、通过 2、拒绝
/// </summary>
public AuditStatusEnum AuditStatus { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
namespace DOAN.Model.Content
{
[SugarTable("article_browsing_log", "内容浏览记录")]
[Tenant("0")]
public class ArticleBrowsingLog
{
[SugarColumn(IsPrimaryKey = true)]
public long LogId { get; set; }
public string Location { get; set; }
public string UserIP { get; set; }
public DateTime AddTime { get; set; }
/// <summary>
/// 文章ID
/// </summary>
public long ArticleId { get; set; }
public long UserId { get; set; }
}
}

View File

@@ -0,0 +1,55 @@
namespace DOAN.Model.Content
{
/// <summary>
/// 文章目录
/// </summary>
[SugarTable("articleCategory", "文章目录")]
[Tenant("0")]
public class ArticleCategory
{
/// <summary>
/// 目录id
/// </summary>
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "category_id")]
public int CategoryId { get; set; }
[SugarColumn(ColumnDescription = "目录名", Length = 20, ExtendedAttribute = ProteryConstant.NOTNULL)]
public string Name { get; set; }
[SugarColumn(ColumnDescription = "图标")]
public string Icon { get; set; }
/// <summary>
/// 排序id
/// </summary>
public int OrderNum { get; set; }
public int? ParentId { get; set; }
/// <summary>
/// 背景图
/// </summary>
public string BgImg { get; set; }
/// <summary>
/// 介绍
/// </summary>
public string Introduce { get; set; }
/// <summary>
/// 分类类型 0、文章 1、圈子
/// </summary>
public int CategoryType { get; set; }
/// <summary>
/// 文章数
/// </summary>
public int ArticleNum { get; set; }
/// <summary>
/// 加入人数
/// </summary>
public int JoinNum { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[SugarColumn(ColumnDescription = "创建时间", ColumnName = "create_time", InsertServerTime = true)]
public DateTime CreateTime { get; set; }
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
[SugarColumn(IsIgnore = true)]
public List<ArticleCategory> Children { get; set; }
}
}

View File

@@ -0,0 +1,85 @@
namespace DOAN.Model.Content
{
[SugarTable("article_comment", "评论表")]
[Tenant(0)]
public class ArticleComment
{
/// <summary>
/// 评论ID
/// </summary>
[SugarColumn(IsPrimaryKey = true)]
[JsonConverter(typeof(ValueToStringConverter))]
public long CommentId { get; set; }
/// <summary>
/// 用户id
/// </summary>
public long UserId { get; set; }
/// <summary>
/// 内容
/// </summary>
public string Content { get; set; }
/// <summary>
/// 最顶级留言id
/// </summary>
public long ParentId { get; set; } = 0;
/// <summary>
/// 评论时间
/// </summary>
public DateTime AddTime { get; set; }
/// <summary>
/// 回复用户id
/// </summary>
public long ReplyUserId { get; set; }
/// <summary>
/// 回复留言id
/// </summary>
public long ReplyId { get; set; }
/// <summary>
/// 用户ip
/// </summary>
public string UserIP { get; set; }
/// <summary>
/// 地理位置
/// </summary>
public string Location { get; set; } = string.Empty;
/// <summary>
/// 喜欢次数
/// </summary>
public int PraiseNum { get; set; } = 0;
/// <summary>
/// 评论次数
/// </summary>
public int ReplyNum { get; set; } = 0;
/// <summary>
/// 审核状态 0、待审核 1、通过 -1、未通过
/// </summary>
public int AuditStatus { get; set; }
/// <summary>
/// 描述 :是否删除 1、删除 0、正常
/// 空值 : true
/// </summary>
[JsonIgnore]
public int IsDelete { get; set; } = 0;
/// <summary>
/// 聊天图片
/// </summary>
public string ChatImg { get; set; }
/// <summary>
/// 分类id可以对应表)
/// </summary>
public int ClassifyId { get; set; }
/// <summary>
/// 目标id(内容id)
/// </summary>
public long TargetId { get; set; }
/// <summary>
/// 是否置顶
/// </summary>
public long Top { get; set; }
/// <summary>
/// 作者回复过
/// </summary>
public int AuthorReply { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
namespace DOAN.Model.Content
{
[SugarTable("article_praise", "内容点赞记录")]
[Tenant("0")]
public class ArticlePraise
{
[SugarColumn(IsPrimaryKey = true)]
public long PId { get; set; }
public long UserId { get; set; }
public long ArticleId { get; set; }
public string UserIP { get; set; }
public long ToUserId { get; set; }
public int IsDelete { get; set; }
[SugarColumn(InsertServerTime = true)]
public DateTime AddTime { get; set; }
public string Location { get; set; }
}
}

View File

@@ -0,0 +1,48 @@
namespace DOAN.Model.Content
{
/// <summary>
/// 话题
/// </summary>
[SugarTable("article_topic", TableDescription = "文章话题")]
[Tenant(0)]
public class ArticleTopic
{
/// <summary>
/// 话题ID
/// </summary>
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
public long TopicId { get; set; }
/// <summary>
/// 话题名
/// </summary>
public string TopicName { get; set; }
/// <summary>
/// 话题描述
/// </summary>
public string TopicDescription { get; set; }
/// <summary>
/// 参与/发起次数
/// </summary>
public int JoinNum { get; set; }
/// <summary>
/// 浏览次数
/// </summary>
public int ViewNum { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime? AddTime { get; set; }
/// <summary>
/// 话题分类
/// </summary>
public int? TopicType { get; set; }
}
}

View File

@@ -0,0 +1,43 @@
namespace DOAN.Model.Content.Dto
{
/// <summary>
/// 文章目录输入对象
/// </summary>
public class ArticleCategoryDto
{
[Required(ErrorMessage = "目录id不能为空")]
public int CategoryId { get; set; }
[Required(ErrorMessage = "目录名不能为空")]
public string Name { get; set; }
public string Icon { get; set; }
public int OrderNum { get; set; }
public DateTime? CreateTime { get; set; }
public int? ParentId { get; set; }
public int CategoryType { get; set; }
/// <summary>
/// 背景图
/// </summary>
public string BgImg { get; set; }
/// <summary>
/// 介绍
/// </summary>
public string Introduce { get; set; }
/// <summary>
/// 文章数
/// </summary>
public int ArticleNum { get; set; }
/// <summary>
/// 加入人数
/// </summary>
public int JoinNum { get; set; }
}
/// <summary>
/// 文章目录查询对象
/// </summary>
public class ArticleCategoryQueryDto : PagerInfo
{
public int? CategoryType { get; set; }
public int? ParentId { get; set; }
}
}

View File

@@ -0,0 +1,117 @@
namespace DOAN.Model.Content.Dto
{
/// <summary>
/// 评论
/// </summary>
public class MessageQueryDto : PagerInfo
{
public long CommentId { get; set; }
public long ParentId { get; set; }
public int OrderBy { get; set; }
public long? UserId { get; set; }
public int ClassifyId { get; set; }
public long TargetId { get; set; }
public DateTime? BeginAddTime { get; set; }
public DateTime? EndAddTime { get; set; }
}
public class ArticleCommentDto
{
[JsonConverter(typeof(ValueToStringConverter))]
public long CommentId { get; set; }
/// <summary>
/// 用户id
/// </summary>
public long UserId { get; set; }
/// <summary>
/// 留言内容
/// </summary>
public string Content { get; set; }
/// <summary>
/// 最顶级留言id
/// </summary>
[JsonConverter(typeof(ValueToStringConverter))]
public long ParentId { get; set; }
/// <summary>
/// 评论时间
/// </summary>
public DateTime AddTime { get; set; }
/// <summary>
/// 回复用户id
/// </summary>
public int ReplyUserId { get; set; }
public string ReplyNickName { get; set; }
/// <summary>
/// 回复留言id
/// </summary>
[JsonConverter(typeof(ValueToStringConverter))]
public long ReplyId { get; set; }
/// <summary>
/// 用户ip
/// </summary>
[JsonIgnore]
public string UserIP { get; set; }
/// <summary>
/// 地理位置
/// </summary>
[JsonIgnore]
public string Location { get; set; } = string.Empty;
/// <summary>
/// 喜欢次数
/// </summary>
public int PraiseNum { get; set; }
/// <summary>
/// 评论次数
/// </summary>
public int ReplyNum { get; set; }
///// <summary>
///// 审核状态 0、待审核 1、通过 -1、未通过
///// </summary>
//public int AuditStatus { get; set; }
/// <summary>
/// 描述 :是否删除 1、删除 0、正常
/// 空值 : true
/// </summary>
[JsonIgnore]
public int IsDelete { get; set; } = 0;
public string NickName { get; set; }
///// <summary>
///// 分享次数
///// </summary>
//public int ShareNunm { get; set; }
public string Avatar { get; set; } = string.Empty;
public string ChatImg { get; set; }
/// <summary>
/// 分类id
/// </summary>
public int ClassifyId { get; set; }
/// <summary>
/// 目标id
/// </summary>
public long TargetId { get; set; }
/// <summary>
/// 置顶
/// </summary>
public long Top { get; set; }
public bool HasMore { get; set; } = false;
public string Position
{
get
{
var temp_location = Location.Split("-")?[0];
if (temp_location == "0")
{
return "IP未知";
}
return temp_location?.Replace("省", "");
}
}
/// <summary>
/// 回复列表
/// </summary>
public List<ArticleCommentDto> ReplyList { get; set; }
}
}

View File

@@ -0,0 +1,149 @@
using DOAN.Model.Enum;
namespace DOAN.Model.Content.Dto
{
public class ArticleQueryDto : PagerInfo
{
public long? UserId { get; set; }
public string Status { get; set; }
public string Title { get; set; }
public string AbstractText { get; set; }
public int? IsPublic { get; set; }
public int? IsTop { get; set; }
public int? CategoryId { get; set; }
public DateTime? BeginTime { get; set; }
public DateTime? EndTime { get; set; }
public int? ArticleType { get; set; }
/// <summary>
/// 1、最新 2、私密 3、热门
/// </summary>
public int TabId { get; set; }
/// <summary>
/// 话题ID
/// </summary>
public int? TopicId { get; set; }
/// <summary>
/// 排序 1、热门 2、最新
/// </summary>
public int? OrderBy { get; set; }
/// <summary>
/// 审核状态
/// </summary>
public AuditStatusEnum? AuditStatus { get; set; }
}
/// <summary>
/// 输入输出对象
/// </summary>
public class ArticleDto
{
[Required(ErrorMessage = "Cid不能为空")]
public long Cid { get; set; }
//[Required(ErrorMessage = "标题不能为空")]
public string Title { get; set; }
[Required(ErrorMessage = "内容不能为空")]
public string Content { get; set; }
public long? UserId { get; set; }
public string Status { get; set; }
public string EditorType { get; set; }
public string Tags { get; set; }
public int Hits { get; set; }
public int? CategoryId { get; set; }
public DateTime? CreateTime { get; set; }
public DateTime? UpdateTime { get; set; }
public string AuthorName { get; set; }
public string CoverUrl { get; set; }
public ArticleCategoryDto CategoryNav { get; set; }
public string[] TagList
{
get
{
return Tags?.Split(',', StringSplitOptions.RemoveEmptyEntries) ?? Array.Empty<string>();
}
}
public int IsPublic { get; set; } = 1;
public string AbstractText { get; set; }
public int IsTop { get; set; }
/// <summary>
/// 内容类型
/// </summary>
public ArticleTypeEnum ArticleType { get; set; }
/// <summary>
/// 点赞数
/// </summary>
public int PraiseNum { get; set; }
/// <summary>
/// 评论数
/// </summary>
public int CommentNum { get; set; }
/// <summary>
/// 分享数
/// </summary>
public int ShareNum { get; set; }
/// <summary>
/// 用户IP
/// </summary>
[JsonIgnore]
public string UserIP { get; set; }
/// <summary>
/// 地理位置
/// </summary>
[JsonIgnore]
public string Location { get; set; }
/// <summary>
/// 封面图片集合
/// </summary>
public string[] CoverImgList
{
get
{
return CoverUrl?.Split(',', StringSplitOptions.RemoveEmptyEntries) ?? Array.Empty<string>();
}
}
/// <summary>
/// 地理位置
/// </summary>
public string Position
{
get
{
var temp_location = Location?.Split("-")?[0];
if (temp_location == "0")
{
return "IP未知";
}
return temp_location?.Replace("省", "");
}
}
/// <summary>
/// 是否点赞
/// </summary>
public int IsPraise { get; set; }
public long TopicId { get; set; }
public string TopicName { get; set; }
public ArticleUser User { get; set; }
/// <summary>
/// 审核状态
/// </summary>
public AuditStatusEnum? AuditStatus { get; set; }
public CommentSwitchEnum? CommentSwitch { get; set; }
}
public class ArticleUser
{
public string Avatar { get; set; } = string.Empty;
public string NickName { get; set; }
public int Sex { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
namespace DOAN.Model.Content.Dto
{
public class ArticlePraiseDto
{
public long UserId { get; set; }
public long ArticleId { get; set; }
public string UserIP { get; set; }
public long ToUserId { get; set; }
public int IsDelete { get; set; }
public string Location { get; set; }
}
}

View File

@@ -0,0 +1,54 @@
namespace DOAN.Model.Content.Dto
{
/// <summary>
/// 话题查询对象
/// </summary>
public class ArticleTopicQueryDto : PagerInfo
{
public string TopicName { get; set; }
public DateTime? BeginAddTime { get; set; }
public DateTime? EndAddTime { get; set; }
public int? TopicType { get; set; }
}
/// <summary>
/// 话题输入输出对象
/// </summary>
public class ArticleTopicDto
{
[Required(ErrorMessage = "话题ID不能为空")]
[ExcelColumn(Name = "话题ID")]
[ExcelColumnName("话题ID")]
public long TopicId { get; set; }
[ExcelColumn(Name = "话题名")]
[ExcelColumnName("话题名")]
public string TopicName { get; set; }
[ExcelColumn(Name = "话题描述")]
[ExcelColumnName("话题描述")]
public string TopicDescription { get; set; }
[ExcelColumn(Name = "参与/发起次数")]
[ExcelColumnName("参与/发起次数")]
public int? JoinNum { get; set; }
[ExcelColumn(Name = "浏览次数")]
[ExcelColumnName("浏览次数")]
public int? ViewNum { get; set; }
[ExcelColumn(Name = "创建时间", Format = "yyyy-MM-dd HH:mm:ss", Width = 20)]
[ExcelColumnName("创建时间")]
public DateTime? AddTime { get; set; }
[ExcelColumn(Name = "话题分类")]
[ExcelColumnName("话题分类")]
public int? TopicType { get; set; }
[ExcelColumn(Name = "话题分类")]
public string TopicTypeLabel { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
namespace DOAN.Model.Content.Dto
{
public class UserDto
{
public long UserId { get; set; }
public string UserName { get; set; }
public string NickName { get; set; }
public string Avatar { get; set; }
/// <summary>
/// 用户性别0男 1女 2未知
/// </summary>
public int Sex { get; set; }
}
}