diff --git a/ZR.Admin.WebApi/Controllers/Content/ArticleCategoryController.cs b/ZR.Admin.WebApi/Controllers/Content/ArticleCategoryController.cs
deleted file mode 100644
index 899dfb2..0000000
--- a/ZR.Admin.WebApi/Controllers/Content/ArticleCategoryController.cs
+++ /dev/null
@@ -1,174 +0,0 @@
-using Microsoft.AspNetCore.Mvc;
-using ZR.Model.Content;
-using ZR.Model.Content.Dto;
-using ZR.Service.Content.IService;
-
-namespace ZR.Admin.WebApi.Controllers
-{
- ///
- /// 文章目录Controller
- ///
- [Route("article/ArticleCategory")]
- [ApiExplorerSettings(GroupName = "article")]
- public class ArticleCategoryController : BaseController
- {
- ///
- /// 文章目录接口
- ///
- private readonly IArticleCategoryService _ArticleCategoryService;
-
- public ArticleCategoryController(IArticleCategoryService ArticleCategoryService)
- {
- _ArticleCategoryService = ArticleCategoryService;
- }
-
- ///
- /// 查询文章目录列表
- ///
- ///
- ///
- [HttpGet("list")]
- [AllowAnonymous]
- public IActionResult QueryArticleCategory([FromQuery] ArticleCategoryQueryDto parm)
- {
- var response = _ArticleCategoryService.GetList(parm);
- return SUCCESS(response);
- }
-
- ///
- /// 查询文章目录列表树
- ///
- ///
- ///
- [HttpGet("treeList")]
- [AllowAnonymous]
- public IActionResult QueryTreeArticleCategory([FromQuery] ArticleCategoryQueryDto parm)
- {
- var response = _ArticleCategoryService.GetTreeList(parm);
- return SUCCESS(response);
- }
-
- ///
- /// 查询文章目录详情
- ///
- ///
- ///
- [HttpGet("{CategoryId}")]
- [AllowAnonymous]
- //[ActionPermissionFilter(Permission = "articlecategory:query")]
- public IActionResult GetArticleCategory(int CategoryId)
- {
- var response = _ArticleCategoryService.GetFirst(x => x.CategoryId == CategoryId);
-
- return SUCCESS(response);
- }
-
- ///
- /// 查询目录分类
- ///
- ///
- ///
- [HttpGet("type{categoryType}")]
- //[ActionPermissionFilter(Permission = "articlecategory:query")]
- public IActionResult GetArticleCategoryByType(int categoryType)
- {
- var response = _ArticleCategoryService.GetFirst(x => x.CategoryType == categoryType);
-
- return SUCCESS(response);
- }
-
- ///
- /// 添加文章目录
- ///
- ///
- [HttpPost]
- [ActionPermissionFilter(Permission = "articlecategory:add")]
- [Log(Title = "文章目录", BusinessType = BusinessType.INSERT)]
- public IActionResult AddArticleCategory([FromBody] ArticleCategoryDto parm)
- {
- var modal = parm.Adapt().ToCreate(HttpContext);
- var response = _ArticleCategoryService.AddArticleCategory(modal);
-
- return ToResponse(response);
- }
-
- ///
- /// 更新文章目录
- ///
- ///
- [HttpPut]
- [ActionPermissionFilter(Permission = "articlecategory:edit")]
- [Log(Title = "文章目录", BusinessType = BusinessType.UPDATE)]
- public IActionResult UpdateArticleCategory([FromBody] ArticleCategoryDto parm)
- {
- var modal = parm.Adapt().ToUpdate(HttpContext);
- var response = _ArticleCategoryService.Update(modal);
-
- return ToResponse(response);
- }
-
- ///
- /// 删除文章目录
- ///
- ///
- [HttpDelete("{ids}")]
- [ActionPermissionFilter(Permission = "articlecategory:delete")]
- [Log(Title = "文章目录", BusinessType = BusinessType.DELETE)]
- public IActionResult DeleteArticleCategory(string ids)
- {
- int[] idsArr = Tools.SpitIntArrary(ids);
- if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
-
- var response = _ArticleCategoryService.Delete(idsArr);
-
- return ToResponse(response);
- }
-
- ///
- /// 导出文章目录
- ///
- ///
- [Log(Title = "文章目录", BusinessType = BusinessType.EXPORT, IsSaveResponseData = false)]
- [HttpGet("export")]
- [ActionPermissionFilter(Permission = "articlecategory:export")]
- public IActionResult Export([FromQuery] ArticleCategoryQueryDto parm)
- {
- parm.PageSize = 10000;
- var list = _ArticleCategoryService.GetList(parm).Result;
-
- string sFileName = ExportExcel(list, "ArticleCategory", "文章目录");
- return SUCCESS(new { path = "/export/" + sFileName, fileName = sFileName });
- }
-
- ///
- /// 获取文章目录
- ///
- ///
- [HttpGet("CategoryList")]
- public IActionResult CategoryList()
- {
- var response = _ArticleCategoryService.GetAll();
- return SUCCESS(response);
- }
-
- ///
- /// 保存排序
- ///
- ///
- ///
- ///
- [ActionPermissionFilter(Permission = "articlecategory:edit")]
- [HttpGet("ChangeSort")]
- [Log(Title = "保存排序", BusinessType = BusinessType.UPDATE)]
- public IActionResult ChangeSort(int id = 0, int value = 0)
- {
- if (id <= 0) { return ToResponse(ApiResult.Error(101, "请求参数错误")); }
- var response = _ArticleCategoryService.Update(w => w.CategoryId == id, it => new ArticleCategory ()
- {
- CategoryId = id,
- OrderNum = value
- });
- return ToResponse(response);
- }
- }
-}
\ No newline at end of file
diff --git a/ZR.Admin.WebApi/Controllers/Content/ArticleController.cs b/ZR.Admin.WebApi/Controllers/Content/ArticleController.cs
deleted file mode 100644
index 57b5b1f..0000000
--- a/ZR.Admin.WebApi/Controllers/Content/ArticleController.cs
+++ /dev/null
@@ -1,174 +0,0 @@
-using Microsoft.AspNetCore.Mvc;
-using ZR.Model.Content;
-using ZR.Model.Content.Dto;
-using ZR.Service.Content.IService;
-
-namespace ZR.Admin.WebApi.Controllers
-{
- ///
- /// 内容管理
- ///
- [Route("article")]
- [ApiExplorerSettings(GroupName = "article")]
- public class ArticleController : BaseController
- {
- ///
- /// 文章接口
- ///
- private readonly IArticleService _ArticleService;
- private readonly IArticleCategoryService _ArticleCategoryService;
-
- public ArticleController(
- IArticleService ArticleService,
- IArticleCategoryService articleCategoryService)
- {
- _ArticleService = ArticleService;
- _ArticleCategoryService = articleCategoryService;
- _ArticleService = ArticleService;
- }
-
- ///
- /// 查询文章列表
- ///
- ///
- [HttpGet("list")]
- [ActionPermissionFilter(Permission = "system:article:list")]
- public IActionResult Query([FromQuery] ArticleQueryDto parm)
- {
- var response = _ArticleService.GetList(parm);
-
- return SUCCESS(response);
- }
-
- ///
- /// 内容批量审核通过
- ///
- ///
- [HttpPut("pass/{ids}")]
- [ActionPermissionFilter(Permission = "article:audit")]
- [Log(Title = "内容审核", BusinessType = BusinessType.UPDATE)]
- public IActionResult PassedMonents(string ids)
- {
- long[] idsArr = Tools.SpitLongArrary(ids);
- if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"审核通过失败Id 不能为空")); }
-
- return ToResponse(_ArticleService.Passed(idsArr));
- }
-
- ///
- /// 内容批量审核拒绝
- ///
- ///
- [HttpPut("reject/{ids}")]
- [ActionPermissionFilter(Permission = "article:audit")]
- [Log(Title = "内容审核", BusinessType = BusinessType.UPDATE)]
- public IActionResult RejectMonents(string ids, string reason = "")
- {
- long[] idsArr = Tools.SpitLongArrary(ids);
- if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"審核拒绝失败Id 不能为空")); }
-
- int result = _ArticleService.Reject(reason, idsArr);
- return ToResponse(result);
- }
-
- ///
- /// 查询我的文章列表
- ///
- ///
- [HttpGet("mylist")]
- public IActionResult QueryMyList([FromQuery] ArticleQueryDto parm)
- {
- parm.UserId = HttpContext.GetUId();
- var response = _ArticleService.GetMyList(parm);
-
- return SUCCESS(response);
- }
-
- ///
- /// 查询文章详情
- ///
- ///
- ///
- [HttpGet("{id}")]
- public IActionResult Get(int id)
- {
- long userId = HttpContext.GetUId();
- var model = _ArticleService.GetArticle(id, userId);
-
- ApiResult apiResult = ApiResult.Success(model);
-
- return ToResponse(apiResult);
- }
-
- ///
- /// 发布文章
- ///
- ///
- [HttpPost("add")]
- [ActionPermissionFilter(Permission = "system:article:add")]
- //[Log(Title = "发布文章", BusinessType = BusinessType.INSERT)]
- public IActionResult Publish([FromBody] ArticleDto parm)
- {
- var addModel = parm.Adapt().ToCreate(context: HttpContext);
-
- return SUCCESS(_ArticleService.PublishArticle(addModel));
- }
-
- ///
- /// 更新文章
- ///
- ///
- [HttpPut("edit")]
- [ActionPermissionFilter(Permission = "system:article:update")]
- //[Log(Title = "文章修改", BusinessType = BusinessType.UPDATE)]
- public IActionResult Update([FromBody] ArticleDto parm)
- {
- parm.AuthorName = HttpContext.GetName();
- var modal = parm.Adapt().ToUpdate(HttpContext);
- var response = _ArticleService.UpdateArticle(modal);
-
- return SUCCESS(response);
- }
-
- ///
- /// 置顶
- ///
- ///
- [HttpPut("top")]
- [ActionPermissionFilter(Permission = "system:article:update")]
- [Log(Title = "置顶文章", BusinessType = BusinessType.UPDATE)]
- public IActionResult Top([FromBody] Article parm)
- {
- var response = _ArticleService.TopArticle(parm);
-
- return SUCCESS(response);
- }
-
- ///
- /// 是否公开
- ///
- ///
- [HttpPut("changePublic")]
- [ActionPermissionFilter(Permission = "system:article:update")]
- [Log(Title = "是否公开", BusinessType = BusinessType.UPDATE)]
- public IActionResult ChangePublic([FromBody] Article parm)
- {
- var response = _ArticleService.ChangeArticlePublic(parm);
-
- return SUCCESS(response);
- }
-
- ///
- /// 删除文章
- ///
- ///
- [HttpDelete("{id}")]
- [ActionPermissionFilter(Permission = "system:article:delete")]
- [Log(Title = "文章删除", BusinessType = BusinessType.DELETE)]
- public IActionResult Delete(int id = 0)
- {
- var response = _ArticleService.Delete(id);
- return SUCCESS(response);
- }
- }
-}
\ No newline at end of file
diff --git a/ZR.Admin.WebApi/Controllers/Content/ArticleTopicController.cs b/ZR.Admin.WebApi/Controllers/Content/ArticleTopicController.cs
deleted file mode 100644
index 3855fc3..0000000
--- a/ZR.Admin.WebApi/Controllers/Content/ArticleTopicController.cs
+++ /dev/null
@@ -1,120 +0,0 @@
-using Microsoft.AspNetCore.Mvc;
-using ZR.Model.Content;
-using ZR.Model.Content.Dto;
-using ZR.Service.Content.IService;
-
-//创建时间:2024-04-29
-namespace ZR.Admin.WebApi.Controllers
-{
- ///
- /// 文章话题
- ///
- [ApiExplorerSettings(GroupName = "article")]
- [Route("article/ArticleTopic")]
- public class ArticleTopicController : BaseController
- {
- ///
- /// 文章话题接口
- ///
- private readonly IArticleTopicService _ArticleTopicService;
-
- public ArticleTopicController(IArticleTopicService ArticleTopicService)
- {
- _ArticleTopicService = ArticleTopicService;
- }
-
- ///
- /// 查询文章话题列表
- ///
- ///
- ///
- [HttpGet("list")]
- [ActionPermissionFilter(Permission = "articletopic:list")]
- public IActionResult QueryArticleTopic([FromQuery] ArticleTopicQueryDto parm)
- {
- var response = _ArticleTopicService.GetList(parm);
- return SUCCESS(response);
- }
-
- ///
- /// 查询文章话题详情
- ///
- ///
- ///
- [HttpGet("{TopicId}")]
- [ActionPermissionFilter(Permission = "articletopic:query")]
- public IActionResult GetArticleTopic(long TopicId)
- {
- var response = _ArticleTopicService.GetInfo(TopicId);
-
- var info = response.Adapt();
- return SUCCESS(info);
- }
-
- ///
- /// 添加文章话题
- ///
- ///
- [HttpPost]
- [ActionPermissionFilter(Permission = "articletopic:add")]
- [Log(Title = "文章话题", BusinessType = BusinessType.INSERT)]
- public IActionResult AddArticleTopic([FromBody] ArticleTopicDto parm)
- {
- var modal = parm.Adapt().ToCreate(HttpContext);
-
- var response = _ArticleTopicService.AddArticleTopic(modal);
-
- return SUCCESS(response);
- }
-
- ///
- /// 更新文章话题
- ///
- ///
- [HttpPut]
- [ActionPermissionFilter(Permission = "articletopic:edit")]
- [Log(Title = "文章话题", BusinessType = BusinessType.UPDATE)]
- public IActionResult UpdateArticleTopic([FromBody] ArticleTopicDto parm)
- {
- var modal = parm.Adapt().ToUpdate(HttpContext);
- var response = _ArticleTopicService.UpdateArticleTopic(modal);
-
- return ToResponse(response);
- }
-
- ///
- /// 删除文章话题
- ///
- ///
- [HttpDelete("delete/{ids}")]
- [ActionPermissionFilter(Permission = "articletopic:delete")]
- [Log(Title = "文章话题", BusinessType = BusinessType.DELETE)]
- public IActionResult DeleteArticleTopic([FromRoute] string ids)
- {
- var idArr = Tools.SplitAndConvert(ids);
-
- return ToResponse(_ArticleTopicService.Delete(idArr));
- }
-
- ///
- /// 导出文章话题
- ///
- ///
- [Log(Title = "文章话题", BusinessType = BusinessType.EXPORT, IsSaveResponseData = false)]
- [HttpGet("export")]
- [ActionPermissionFilter(Permission = "articletopic:export")]
- public IActionResult Export([FromQuery] ArticleTopicQueryDto parm)
- {
- parm.PageNum = 1;
- parm.PageSize = 100000;
- var list = _ArticleTopicService.ExportList(parm).Result;
- if (list == null || list.Count <= 0)
- {
- return ToResponse(ResultCode.FAIL, "没有要导出的数据");
- }
- var result = ExportExcelMini(list, "文章话题", "文章话题");
- return ExportExcel(result.Item2, result.Item1);
- }
-
- }
-}
\ No newline at end of file
diff --git a/ZR.Admin.WebApi/Controllers/Content/FrontArticleController.cs b/ZR.Admin.WebApi/Controllers/Content/FrontArticleController.cs
deleted file mode 100644
index ec58007..0000000
--- a/ZR.Admin.WebApi/Controllers/Content/FrontArticleController.cs
+++ /dev/null
@@ -1,273 +0,0 @@
-using Microsoft.AspNetCore.Mvc;
-using ZR.Model.Content;
-using ZR.Model.Content.Dto;
-using ZR.Service.Content.IService;
-using ZR.Service.Social.IService;
-
-namespace ZR.Admin.WebApi.Controllers
-{
- ///
- /// 内容管理前端接口
- ///
- [Route("front/article")]
- [ApiExplorerSettings(GroupName = "article")]
- public class FrontArticleController : BaseController
- {
- ///
- /// 文章接口
- ///
- private readonly IArticleService _ArticleService;
- private readonly IArticleCategoryService _ArticleCategoryService;
- private readonly IArticlePraiseService _ArticlePraiseService;
- private readonly ISysUserService _SysUserService;
- private readonly IArticleTopicService _ArticleTopicService;
- private readonly IArticleUserCirclesService _ArticleUserCirclesService;
- private readonly ISocialFansInfoService _FansInfoService;
-
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- public FrontArticleController(
- IArticleService ArticleService,
- IArticleCategoryService articleCategoryService,
- IArticlePraiseService articlePraiseService,
- ISysUserService sysUserService,
- IArticleTopicService articleTopicService,
- IArticleUserCirclesService articleUserCirclesService,
- ISocialFansInfoService fansInfoService)
- {
- _ArticleService = ArticleService;
- _ArticleCategoryService = articleCategoryService;
- _ArticleService = ArticleService;
- _ArticlePraiseService = articlePraiseService;
- _SysUserService = sysUserService;
- _ArticleTopicService = articleTopicService;
- _ArticleUserCirclesService = articleUserCirclesService;
- _FansInfoService = fansInfoService;
- }
-
- ///
- /// 前台查询文章列表
- ///
- ///
- [HttpGet("homeList")]
- [AllowAnonymous]
- public IActionResult QueryHomeList([FromQuery] ArticleQueryDto parm)
- {
- parm.UserId = HttpContext.GetUId();
- var response = _ArticleService.GetArticleList(parm);
-
- return SUCCESS(response);
- }
-
- ///
- /// 查询最新文章列表
- ///
- ///
- [HttpGet("newList")]
- [AllowAnonymous]
- public IActionResult QueryNew()
- {
- return SUCCESS(_ArticleService.GetNewArticleList());
- }
-
- ///
- /// 点赞
- ///
- ///
- ///
- ///
- [HttpPost("praise/{id}")]
- [ActionPermissionFilter(Permission = "common")]
- public IActionResult Praise(int id = 0, long authorId = 0)
- {
- ArticlePraise addModel = new()
- {
- UserId = HttpContext.GetUId(),
- UserIP = HttpContext.GetClientUserIp(),
- ArticleId = id,
- ToUserId = authorId
- };
- addModel.Location = HttpContextExtension.GetIpInfo(addModel.UserIP);
-
- return SUCCESS(_ArticlePraiseService.Praise(addModel));
- }
-
- ///
- /// 置顶
- ///
- ///
- [HttpPut("top")]
- [ActionPermissionFilter(Permission = "common")]
- public IActionResult Top([FromBody] Article parm)
- {
- var response = _ArticleService.TopArticle(parm);
-
- return SUCCESS(response);
- }
-
- ///
- /// 修改可见范围
- ///
- ///
- [HttpPut("changePublic")]
- [ActionPermissionFilter(Permission = "common")]
- public IActionResult ChangePublic([FromBody] Article parm)
- {
- if (parm == null) { return ToResponse(ResultCode.CUSTOM_ERROR); }
- var userId = HttpContext.GetUId();
- if (userId != parm.UserId)
- {
- return ToResponse(ResultCode.CUSTOM_ERROR, "操作失败");
- }
- var response = _ArticleService.ChangeArticlePublic(parm);
-
- return SUCCESS(response);
- }
-
- ///
- /// 修改评论权限
- ///
- ///
- [HttpPut("changeComment")]
- [ActionPermissionFilter(Permission = "common")]
- public IActionResult ChangeComment([FromBody] Article parm)
- {
- if (parm == null) { return ToResponse(ResultCode.CUSTOM_ERROR); }
- var userId = HttpContext.GetUId();
- if (userId != parm.UserId)
- {
- return ToResponse(ResultCode.CUSTOM_ERROR, "操作失败");
- }
- var response = _ArticleService.ChangeComment(parm);
-
- return SUCCESS(response);
- }
-
- ///
- /// 删除
- ///
- ///
- [HttpDelete("del/{id}")]
- [ActionPermissionFilter(Permission = "common")]
- public IActionResult Delete(long id = 0)
- {
- var userId = HttpContext.GetUId();
- var info = _ArticleService.GetId(id);
- if (info == null || info.UserId != userId)
- {
- return ToResponse(ResultCode.CUSTOM_ERROR, "删除失败(-1)");
- }
- var response = _ArticleService.Delete(id);
- return SUCCESS(response);
- }
-
- ///
- /// 查询文章详情
- ///
- ///
- ///
- [HttpGet("{id}")]
- [AllowAnonymous]
- public IActionResult Get(int id)
- {
- long userId = HttpContext.GetUId();
- var model = _ArticleService.GetArticle(id, userId);
- var user = _SysUserService.GetById(model.UserId);
- ApiResult apiResult = ApiResult.Success(model);
- model.User = new ArticleUser()
- {
- Avatar = user.Avatar,
- NickName = user.NickName,
- Sex = user.Sex,
- };
-
- return ToResponse(apiResult);
- }
-
- ///
- /// 前台查询话题
- ///
- ///
- ///
- [HttpGet("topicList")]
- [AllowAnonymous]
- public IActionResult QueryTopicList([FromQuery] ArticleTopicQueryDto parm)
- {
- var response = _ArticleTopicService.GetTopicList(parm);
-
- return SUCCESS(response);
- }
-
- ///
- /// 查询文章话题详情
- ///
- ///
- ///
- [HttpGet("topic/{TopicId}")]
- [AllowAnonymous]
- public IActionResult GetArticleTopic(long TopicId)
- {
- var response = _ArticleTopicService.GetInfo(TopicId);
-
- _ArticleTopicService.Update(w => w.TopicId == TopicId, it => new ArticleTopic() { ViewNum = it.ViewNum + 1 });
-
- var info = response.Adapt();
- return SUCCESS(info);
- }
-
- ///
- /// 查询文章目录详情
- ///
- ///
- ///
- [HttpGet("QueryCircle/{CategoryId}")]
- [AllowAnonymous]
- public IActionResult GetArticleCategory(int CategoryId)
- {
- var userId = HttpContext.GetUId();
- var info = _ArticleCategoryService.GetFirst(x => x.CategoryId == CategoryId);
- var infoDto = info.Adapt();
- if (infoDto != null)
- {
- infoDto.IsJoin = _ArticleUserCirclesService.IsJoin((int)userId, CategoryId);
- }
- return SUCCESS(infoDto);
- }
-
- ///
- /// 发布文章
- ///
- ///
- [HttpPost("publish")]
- [ActionPermissionFilter(Permission = "common")]
- public IActionResult Create([FromBody] ArticleDto parm)
- {
- if (parm == null) { return ToResponse(ResultCode.PARAM_ERROR); }
- var addModel = parm.Adapt().ToCreate(context: HttpContext);
- addModel.ArticleType = Model.Enum.ArticleTypeEnum.Article;
- addModel.Tags = parm.TopicName;
- return SUCCESS(_ArticleService.Publish(addModel));
- }
-
- ///
- /// 获取我的成就信息
- ///
- ///
- [HttpGet("GetUserWidget")]
- public IActionResult GetUserWidget(int toUserid)
- {
- var userId = HttpContext.GetUId();
- var fansInfo = _FansInfoService.GetFirst(f => f.Userid == toUserid) ?? new Model.social.SocialFansInfo() { };
-
- return SUCCESS(new { fansInfo });
- }
- }
-}
diff --git a/ZR.Admin.WebApi/Controllers/Content/FrontCommentController.cs b/ZR.Admin.WebApi/Controllers/Content/FrontCommentController.cs
deleted file mode 100644
index f139f09..0000000
--- a/ZR.Admin.WebApi/Controllers/Content/FrontCommentController.cs
+++ /dev/null
@@ -1,129 +0,0 @@
-using Microsoft.AspNetCore.Mvc;
-using ZR.Model;
-using ZR.Model.Content;
-using ZR.Model.Content.Dto;
-using ZR.Service.Content.IService;
-
-namespace ZR.Admin.WebApi.Controllers
-{
- ///
- /// 评论
- ///
- [Route("front/comment")]
- [ApiExplorerSettings(GroupName = "article")]
- [ApiController]
- public class FrontCommentController : BaseController
- {
- private readonly IArticleCommentService messageService;
- private readonly IArticleService articleService;
- ///
- ///
- ///
- ///
- ///
- public FrontCommentController(
- IArticleCommentService messageService, IArticleService articleService)
- {
- this.messageService = messageService;
- this.articleService = articleService;
- }
-
- ///
- /// 查询评论列表
- ///
- ///
- ///
- [HttpGet("list")]
- [AllowAnonymous]
- public IActionResult QueryList([FromQuery] MessageQueryDto parm)
- {
- parm.PageSize = 10;
- PagedInfo? response;
- //查询二级评论
- if (parm.CommentId > 0)
- {
- response = messageService.GetReplyComments(parm.CommentId, parm);
- }
- else
- {
- response = messageService.GetMessageList(parm);
- }
-
- return SUCCESS(response);
- }
-
- ///
- /// 评论
- ///
- ///
- [HttpPost("add")]
- [ActionPermissionFilter(Permission = "common")]
- public IActionResult Create([FromBody] ArticleCommentDto parm)
- {
- var uid = HttpContextExtension.GetUId(HttpContext);
- if (uid <= 0) { return ToResponse(ResultCode.DENY); }
-
- var addModel = parm.Adapt().ToCreate(context: HttpContext);
- addModel.UserIP = HttpContextExtension.GetClientUserIp(HttpContext);
- addModel.UserId = uid;
- return SUCCESS(messageService.AddMessage(addModel).Adapt());
- }
-
- ///
- /// 评论点赞
- ///
- ///
- ///
- [HttpPost("praise")]
- [ActionPermissionFilter(Permission = "common")]
- public IActionResult Praise([FromBody] ArticleCommentDto dto)
- {
- if (dto == null || dto.CommentId <= 0) return ToResponse(ResultCode.PARAM_ERROR);
- //var uid = HttpContextExtension.GetUId(HttpContext);
-
- return SUCCESS(messageService.PraiseMessage(dto.CommentId));
- }
-
- ///
- /// 评论删除
- ///
- ///
- ///
- [HttpDelete("delete/{mid}")]
- [ActionPermissionFilter(Permission = "common")]
- public IActionResult Delete(long mid)
- {
- var uid = HttpContextExtension.GetUId(HttpContext);
- if (uid <= 0) { return ToResponse(ResultCode.DENY); }
- return SUCCESS(messageService.DeleteMessage(mid.ParseToLong(), uid));
- }
-
- ///
- /// 查询我的评论列表
- ///
- ///
- ///
- [HttpGet("mylist")]
- public IActionResult QueryMyCommentList([FromQuery] MessageQueryDto parm)
- {
- PagedInfo response = messageService.GetMyMessageList(parm);
-
- return SUCCESS(response);
- }
-
- ///
- /// 评论置顶
- ///
- ///
- [HttpPut("top")]
- [ActionPermissionFilter(Permission = "common")]
- public IActionResult Top([FromBody] ArticleCommentDto parm)
- {
- var uid = HttpContextExtension.GetUId(HttpContext);
- if (uid <= 0) { return ToResponse(ResultCode.DENY); }
- var contentInfo = articleService.GetArticle(parm.TargetId, uid);
- if (contentInfo == null) { return ToResponse(ResultCode.CUSTOM_ERROR, "操作失败"); }
- return SUCCESS(messageService.TopMessage(parm.CommentId, parm.Top));
- }
- }
-}
diff --git a/ZR.Admin.WebApi/Controllers/Content/FrontUserCirclesController.cs b/ZR.Admin.WebApi/Controllers/Content/FrontUserCirclesController.cs
deleted file mode 100644
index 42eff83..0000000
--- a/ZR.Admin.WebApi/Controllers/Content/FrontUserCirclesController.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-using Microsoft.AspNetCore.Mvc;
-using ZR.Service.Content.IService;
-
-//创建时间:2025-04-07
-namespace ZR.Admin.WebApi.Controllers
-{
- ///
- /// 用户加入圈子
- ///
- [Route("front/circles")]
- [ApiExplorerSettings(GroupName = "userCircle")]
- [ApiController]
- public class ArticleUserCirclesController : BaseController
- {
- ///
- /// 用户加入圈子接口
- ///
- private readonly IArticleUserCirclesService _ArticleUserCirclesService;
-
- ///
- ///
- ///
- ///
- public ArticleUserCirclesController(
- IArticleUserCirclesService ArticleUserCirclesService)
- {
- _ArticleUserCirclesService = ArticleUserCirclesService;
- }
-
- ///
- /// 查询用户加入圈子列表
- ///
- ///
- [HttpGet("myCircleList")]
- public IActionResult QueryArticleUserCircles()
- {
- var userId = HttpContext.GetUId();
- var response = _ArticleUserCirclesService.GetMyJoinCircles((int)userId);
- return SUCCESS(response);
- }
-
- ///
- /// 用户加入圈子
- ///
- ///
- [HttpPost("join/{id}")]
- public IActionResult JoinCircles([FromRoute] int id)
- {
- var userId = HttpContext.GetUId();
- return ToResponse(_ArticleUserCirclesService.JoinCircle((int)userId, id));
- }
-
- ///
- /// 删除用户加入圈子
- ///
- ///
- [HttpPost("delete/{id}")]
- public IActionResult DeleteCircles([FromRoute] int id)
- {
- var userId = HttpContext.GetUId();
- return ToResponse(_ArticleUserCirclesService.RemoveCircle((int)userId, id));
- }
- }
-}
\ No newline at end of file
diff --git a/ZR.Admin.WebApi/Controllers/Content/MomentsController.cs b/ZR.Admin.WebApi/Controllers/Content/MomentsController.cs
deleted file mode 100644
index 20c7708..0000000
--- a/ZR.Admin.WebApi/Controllers/Content/MomentsController.cs
+++ /dev/null
@@ -1,88 +0,0 @@
-using Microsoft.AspNetCore.Mvc;
-using ZR.Model.Content;
-using ZR.Model.Content.Dto;
-using ZR.Model.Enum;
-using ZR.Service.Content.IService;
-
-namespace ZR.Admin.WebApi.Controllers
-{
- [Route("moment")]
- [ApiExplorerSettings(GroupName = "article")]
- public class MomentsController : BaseController
- {
- ///
- /// 动态接口
- ///
- private readonly IArticleService _ArticleService;
-
- ///
- ///
- ///
- ///
- public MomentsController(
- IArticleService ArticleService)
- {
- _ArticleService = ArticleService;
- }
-
- ///
- /// 查询我的(后台)
- ///
- ///
- [HttpGet("mylist")]
- public IActionResult QueryMyList([FromQuery] ArticleQueryDto parm)
- {
- parm.UserId = HttpContext.GetUId();
- parm.ArticleType = (int)ArticleTypeEnum.Monent;
- var response = _ArticleService.GetMyList(parm);
-
- return SUCCESS(response);
- }
-
- ///
- /// 查询动态列表
- ///
- ///
- [HttpGet("momentList")]
- [AllowAnonymous]
- public IActionResult QueryMonentList([FromQuery] ArticleQueryDto parm)
- {
- parm.UserId = HttpContext.GetUId();
- parm.ArticleType = (int)ArticleTypeEnum.Monent;
- parm.QueryMyJoin = parm.TabId == 100;//查询关注的圈子动态
-
- return SUCCESS(_ArticleService.GetMonentList(parm));
- }
-
- ///
- /// 动态发布
- ///
- ///
- [HttpPost("publishMoment")]
- [ActionPermissionFilter(Permission = "common")]
- public IActionResult PublishMoment([FromBody] ArticleDto parm)
- {
- if (parm == null) { return ToResponse(ResultCode.PARAM_ERROR); }
- var addModel = parm.Adapt().ToCreate(context: HttpContext);
- addModel.Tags = parm.TopicName;
- addModel.ArticleType = ArticleTypeEnum.Monent;
-
- return SUCCESS(_ArticleService.Publish(addModel));
- }
-
- ///
- /// 动态信息
- ///
- ///
- [HttpGet("getInfo")]
- public IActionResult GetInfo()
- {
- var userId = HttpContext.GetUId();
-
- var monentNum = _ArticleService.Queryable()
- .Count(f => f.UserId == userId && f.ArticleType == ArticleTypeEnum.Monent);
-
- return SUCCESS(new { monentNum, commentNum = 0 });
- }
- }
-}
diff --git a/ZR.Admin.WebApi/Controllers/Public/BannerConfigController.cs b/ZR.Admin.WebApi/Controllers/Public/BannerConfigController.cs
deleted file mode 100644
index d87d8f3..0000000
--- a/ZR.Admin.WebApi/Controllers/Public/BannerConfigController.cs
+++ /dev/null
@@ -1,151 +0,0 @@
-using Microsoft.AspNetCore.Mvc;
-using ZR.Model.Public;
-using ZR.Model.Public.Dto;
-using ZR.Service.Public.IPublicService;
-
-//创建时间:2024-05-11
-namespace ZR.Admin.WebApi.Controllers.Public
-{
- ///
- /// 广告管理
- ///
- [Route("public/BannerConfig")]
- public class BannerConfigController : BaseController
- {
- ///
- /// 广告管理接口
- ///
- private readonly IBannerConfigService _BannerConfigService;
-
- public BannerConfigController(IBannerConfigService BannerConfigService)
- {
- _BannerConfigService = BannerConfigService;
- }
-
- ///
- /// 查询广告管理列表
- ///
- ///
- ///
- [HttpGet("list")]
- [ActionPermissionFilter(Permission = "bannerconfig:list")]
- public IActionResult QueryBannerConfig([FromQuery] BannerConfigQueryDto parm)
- {
- var response = _BannerConfigService.GetList(parm);
- return SUCCESS(response);
- }
-
- ///
- /// 查询广告管理详情
- ///
- ///
- ///
- [HttpGet("{Id}")]
- [ActionPermissionFilter(Permission = "bannerconfig:query")]
- public IActionResult GetBannerConfig(int Id)
- {
- var response = _BannerConfigService.GetInfo(Id);
-
- var info = response.Adapt();
- return SUCCESS(info);
- }
-
- ///
- /// 添加广告管理
- ///
- ///
- [HttpPost]
- [ActionPermissionFilter(Permission = "bannerconfig:add")]
- [Log(Title = "广告管理", BusinessType = BusinessType.INSERT)]
- public IActionResult AddBannerConfig([FromBody] BannerConfigDto parm)
- {
- var modal = parm.Adapt().ToCreate(HttpContext);
-
- var response = _BannerConfigService.AddBannerConfig(modal);
-
- return SUCCESS(response);
- }
-
- ///
- /// 更新广告管理
- ///
- ///
- [HttpPut]
- [ActionPermissionFilter(Permission = "bannerconfig:edit")]
- [Log(Title = "广告管理", BusinessType = BusinessType.UPDATE)]
- public IActionResult UpdateBannerConfig([FromBody] BannerConfigDto parm)
- {
- var modal = parm.Adapt();
- var response = _BannerConfigService.UpdateBannerConfig(modal);
-
- return ToResponse(response);
- }
-
- ///
- /// 删除广告管理
- ///
- ///
- [HttpDelete("delete/{ids}")]
- [ActionPermissionFilter(Permission = "bannerconfig:delete")]
- [Log(Title = "广告管理", BusinessType = BusinessType.DELETE)]
- public IActionResult DeleteBannerConfig([FromRoute] string ids)
- {
- var idArr = Tools.SplitAndConvert(ids);
-
- return ToResponse(_BannerConfigService.Delete(idArr, "删除广告管理"));
- }
-
- ///
- /// 导出广告管理
- ///
- ///
- [Log(Title = "广告管理", BusinessType = BusinessType.EXPORT, IsSaveResponseData = false)]
- [HttpGet("export")]
- [ActionPermissionFilter(Permission = "bannerconfig:export")]
- public IActionResult Export([FromQuery] BannerConfigQueryDto parm)
- {
- parm.PageNum = 1;
- parm.PageSize = 100000;
- var list = _BannerConfigService.ExportList(parm).Result;
- if (list == null || list.Count <= 0)
- {
- return ToResponse(ResultCode.FAIL, "没有要导出的数据");
- }
- var result = ExportExcelMini(list, "广告管理", "广告管理");
- return ExportExcel(result.Item2, result.Item1);
- }
-
- ///
- /// 保存排序
- ///
- /// 主键
- /// 排序值
- ///
- [ActionPermissionFilter(Permission = "bannerconfig:edit")]
- [HttpGet("ChangeSort")]
- [Log(Title = "保存排序", BusinessType = BusinessType.UPDATE)]
- public IActionResult ChangeSort(int id = 0, int value = 0)
- {
- if (id <= 0) { return ToResponse(ApiResult.Error(101, "请求参数错误")); }
- var response = _BannerConfigService.Update(w => w.Id == id, it => new BannerConfig()
- {
- SortId = value,
- });
-
- return ToResponse(response);
- }
-
- ///
- /// 查询广告管理列表
- ///
- ///
- ///
- [HttpGet("bannerList")]
- [AllowAnonymous]
- public IActionResult QueryBannerList([FromQuery] BannerConfigQueryDto parm)
- {
- var response = _BannerConfigService.GetBannerList(parm);
- return SUCCESS(new { list = response });
- }
- }
-}
\ No newline at end of file
diff --git a/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj b/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj
index 3fc12a3..1cdf991 100644
--- a/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj
+++ b/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj
@@ -34,6 +34,7 @@
+
diff --git a/ZR.Model/Content/Article.cs b/ZR.Model/Content/Article.cs
deleted file mode 100644
index a318aec..0000000
--- a/ZR.Model/Content/Article.cs
+++ /dev/null
@@ -1,127 +0,0 @@
-using ZR.Model.Enum;
-
-namespace ZR.Model.Content
-{
- ///
- /// 文章表
- ///
- [SugarTable("article", "内容管理")]
- [Tenant("0")]
- public class Article
- {
- ///
- /// 文章id
- ///
- [SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
- public long Cid { get; set; }
- ///
- /// 文章标题
- ///
- [SugarColumn(ColumnDescription = "文章标题", Length = 254)]
- public string Title { get; set; }
- ///
- /// 发布时间
- ///
- [SugarColumn(ColumnDescription = "发布时间")]
- public DateTime? CreateTime { get; set; }
- ///
- /// 修改时间
- ///
- [SugarColumn(IsOnlyIgnoreInsert = true, ColumnDescription = "更新时间")]
- public DateTime? UpdateTime { get; set; }
- ///
- /// 文章内容
- ///
- [SugarColumn(ColumnDescription = "文章内容", ColumnDataType = StaticConfig.CodeFirst_BigString)]
- public string Content { get; set; }
- ///
- /// 作者名
- ///
- [SugarColumn(ColumnDescription = "作者名", Length = 20, ExtendedAttribute = ProteryConstant.NOTNULL)]
- public string AuthorName { get; set; }
- ///
- /// 发布者用户id
- ///
- [SugarColumn(ColumnDescription = "发布者用户id", ExtendedAttribute = ProteryConstant.NOTNULL)]
- public long UserId { get; set; }
- ///
- /// 文章状态 1、发布 2、草稿
- ///
- [SugarColumn(ColumnDescription = "文章状态 1、发布 2、草稿", Length = 20)]
- public string Status { get; set; }
- ///
- /// 编辑器类型 markdown,html
- ///
- [SugarColumn(ColumnDescription = "编辑器类型markdown,html", ColumnName = "editorType", Length = 20, IsNullable = true)]
- public string EditorType { get; set; }
- ///
- /// 文章标签eg:Net5,java
- ///
- [SugarColumn(ColumnDescription = "文章标签", Length = 20)]
- public string Tags { get; set; }
- ///
- /// 点击量
- ///
- [SugarColumn(ColumnDescription = "点击量", DefaultValue = "0")]
- public int Hits { get; set; }
- [SugarColumn(ColumnDescription = "目录id", ColumnName = "category_Id")]
- public int CategoryId { get; set; }
- ///
- /// 封面地址
- ///
- [SugarColumn(ColumnDescription = "封面地址", Length = 5000)]
- public string CoverUrl { get; set; }
- ///
- /// 是否公开 1、公开 0、不公开
- ///
- [SugarColumn(ColumnDescription = "是否公开 1、公开 0、不公开", DefaultValue = "0")]
- public int IsPublic { get; set; }
- ///
- /// 是否置顶
- ///
- public int IsTop { get; set; }
- ///
- /// 0、文章 1、随笔 2、动态
- ///
- [SugarColumn(ColumnDescription = "内容类型0、文章 1、随笔 2、动态", DefaultValue = "0")]
- public ArticleTypeEnum ArticleType { get; set; }
- ///
- /// 摘要
- ///
- public string AbstractText { get; set; }
- ///
- /// 分类
- ///
-
- [Navigate(NavigateType.OneToOne, nameof(CategoryId), nameof(ArticleCategory.CategoryId))] //自定义关系映射
- public ArticleCategory CategoryNav { get; set; }
- ///
- /// 评论数
- ///
- public int CommentNum { get; set; }
- ///
- /// 点赞数
- ///
- public int PraiseNum { get; set; }
- ///
- /// 用户IP
- ///
- public string UserIP { get; set; }
- ///
- /// 地理位置
- ///
- public string Location { get; set; }
- ///
- /// 话题ID
- ///
- public long TopicId { get; set; }
- ///
- /// 评论开关 0、所有人可评论 1、仅粉丝 2、仅自己
- ///
- public CommentSwitchEnum CommentSwitch { get; set; }
- ///
- /// 审核状态 0、待审核 1、通过 2、拒绝
- ///
- public AuditStatusEnum AuditStatus { get; set; }
- }
-}
diff --git a/ZR.Model/Content/ArticleBrowsingLog.cs b/ZR.Model/Content/ArticleBrowsingLog.cs
deleted file mode 100644
index 31b9e7b..0000000
--- a/ZR.Model/Content/ArticleBrowsingLog.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-namespace ZR.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; }
- ///
- /// 文章ID
- ///
- public long ArticleId { get; set; }
- public long UserId { get; set; }
- }
-}
diff --git a/ZR.Model/Content/ArticleCategory.cs b/ZR.Model/Content/ArticleCategory.cs
deleted file mode 100644
index 55b410f..0000000
--- a/ZR.Model/Content/ArticleCategory.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-namespace ZR.Model.Content
-{
- ///
- /// 文章目录
- ///
- [SugarTable("articleCategory", "文章目录")]
- [Tenant("0")]
- public class ArticleCategory
- {
- ///
- /// 目录id
- ///
- [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; }
- ///
- /// 排序id
- ///
- public int OrderNum { get; set; }
- public int? ParentId { get; set; }
- ///
- /// 背景图
- ///
- public string BgImg { get; set; }
- ///
- /// 介绍
- ///
- public string Introduce { get; set; }
- ///
- /// 分类类型 0、文章 1、圈子
- ///
- public int CategoryType { get; set; }
- ///
- /// 文章数
- ///
- [SugarColumn(DefaultValue = "0")]
- public int ArticleNum { get; set; }
- ///
- /// 加入人数
- ///
- [SugarColumn(DefaultValue = "0")]
- public int JoinNum { get; set; }
- ///
- /// 创建时间
- ///
- [SugarColumn(ColumnDescription = "创建时间", ColumnName = "create_time", InsertServerTime = true)]
- public DateTime? CreateTime { get; set; }
-
- [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
- [SugarColumn(IsIgnore = true)]
- public List Children { get; set; }
- }
-}
diff --git a/ZR.Model/Content/ArticleComment.cs b/ZR.Model/Content/ArticleComment.cs
deleted file mode 100644
index 4159885..0000000
--- a/ZR.Model/Content/ArticleComment.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-namespace ZR.Model.Content
-{
- [SugarTable("article_comment", "评论表")]
- [Tenant(0)]
- public class ArticleComment
- {
- ///
- /// 评论ID
- ///
- [SugarColumn(IsPrimaryKey = true)]
- [JsonConverter(typeof(ValueToStringConverter))]
- public long CommentId { get; set; }
- ///
- /// 用户id
- ///
- public long UserId { get; set; }
- ///
- /// 内容
- ///
- public string Content { get; set; }
- ///
- /// 最顶级留言id
- ///
- public long ParentId { get; set; } = 0;
- ///
- /// 评论时间
- ///
- public DateTime AddTime { get; set; }
- ///
- /// 回复用户id
- ///
- public long ReplyUserId { get; set; }
- ///
- /// 回复留言id
- ///
- public long ReplyId { get; set; }
- ///
- /// 用户ip
- ///
- public string UserIP { get; set; }
- ///
- /// 地理位置
- ///
- public string Location { get; set; } = string.Empty;
- ///
- /// 喜欢次数
- ///
- public int PraiseNum { get; set; } = 0;
-
- ///
- /// 评论次数
- ///
- public int ReplyNum { get; set; } = 0;
- ///
- /// 审核状态 0、待审核 1、通过 -1、未通过
- ///
- public int AuditStatus { get; set; }
- ///
- /// 描述 :是否删除 1、删除 0、正常
- /// 空值 : true
- ///
- [JsonIgnore]
- public int IsDelete { get; set; } = 0;
- ///
- /// 聊天图片
- ///
- public string ChatImg { get; set; }
- ///
- /// 分类id(可以对应表)
- ///
- public int ClassifyId { get; set; }
- ///
- /// 目标id(内容id)
- ///
- public long TargetId { get; set; }
- ///
- /// 是否置顶
- ///
- public long Top { get; set; }
- ///
- /// 作者回复过
- ///
- public int AuthorReply { get; set; }
- }
-}
diff --git a/ZR.Model/Content/ArticlePraise.cs b/ZR.Model/Content/ArticlePraise.cs
deleted file mode 100644
index dbfdc5f..0000000
--- a/ZR.Model/Content/ArticlePraise.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-namespace ZR.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; }
- }
-}
diff --git a/ZR.Model/Content/ArticleTopic.cs b/ZR.Model/Content/ArticleTopic.cs
deleted file mode 100644
index 4f1ba3d..0000000
--- a/ZR.Model/Content/ArticleTopic.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-
-namespace ZR.Model.Content
-{
- ///
- /// 话题
- ///
- [SugarTable("article_topic", TableDescription = "文章话题")]
- [Tenant(0)]
- public class ArticleTopic
- {
- ///
- /// 话题ID
- ///
- [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
- public long TopicId { get; set; }
-
- ///
- /// 话题名
- ///
- public string TopicName { get; set; }
-
- ///
- /// 话题描述
- ///
- public string TopicDescription { get; set; }
-
- ///
- /// 参与/发起次数
- ///
- public int JoinNum { get; set; }
-
- ///
- /// 浏览次数
- ///
- public int ViewNum { get; set; }
-
- ///
- /// 创建时间
- ///
- public DateTime? AddTime { get; set; }
-
- ///
- /// 话题分类
- ///
- public int? TopicType { get; set; }
-
- }
-}
\ No newline at end of file
diff --git a/ZR.Model/Content/ArticleUserCircles.cs b/ZR.Model/Content/ArticleUserCircles.cs
deleted file mode 100644
index b332ce7..0000000
--- a/ZR.Model/Content/ArticleUserCircles.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-
-namespace ZR.Model.Content
-{
- ///
- /// 用户加入圈子
- ///
- [SugarTable("article_userCircles")]
- [Tenant(0)]
- public class ArticleUserCircles
- {
- ///
- /// 主键
- ///
- [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
- public int Id { get; set; }
-
- ///
- /// 圈子ID
- ///
- public int CategoryId { get; set; }
-
- ///
- /// 用户ID
- ///
- public int UserId { get; set; }
-
- ///
- /// 加入时间
- ///
- public DateTime? JoinTime { get; set; }
-
- ///
- /// 状态 0=待审核,1=已加入,2=已拒绝
- ///
- public int Status { get; set; }
- }
-}
\ No newline at end of file
diff --git a/ZR.Model/Content/Dto/ArticleCategoryDto.cs b/ZR.Model/Content/Dto/ArticleCategoryDto.cs
deleted file mode 100644
index e45fdba..0000000
--- a/ZR.Model/Content/Dto/ArticleCategoryDto.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-namespace ZR.Model.Content.Dto
-{
- ///
- /// 文章目录输入对象
- ///
- 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; }
- ///
- /// 背景图
- ///
- public string BgImg { get; set; }
- ///
- /// 介绍
- ///
- public string Introduce { get; set; }
- ///
- /// 文章数
- ///
- public int ArticleNum { get; set; }
- ///
- /// 加入人数
- ///
- public int JoinNum { get; set; }
- public List Children { get; set; }
- }
-
- ///
- /// 文章目录查询对象
- ///
- public class ArticleCategoryQueryDto : PagerInfo
- {
- public int? CategoryType { get; set; }
- public int? ParentId { get; set; }
- }
-}
diff --git a/ZR.Model/Content/Dto/ArticleCommentDto.cs b/ZR.Model/Content/Dto/ArticleCommentDto.cs
deleted file mode 100644
index fe796de..0000000
--- a/ZR.Model/Content/Dto/ArticleCommentDto.cs
+++ /dev/null
@@ -1,117 +0,0 @@
-namespace ZR.Model.Content.Dto
-{
- ///
- /// 评论
- ///
- 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; }
- ///
- /// 用户id
- ///
- public long UserId { get; set; }
- ///
- /// 留言内容
- ///
- public string Content { get; set; }
- ///
- /// 最顶级留言id
- ///
- [JsonConverter(typeof(ValueToStringConverter))]
- public long ParentId { get; set; }
- ///
- /// 评论时间
- ///
- public DateTime AddTime { get; set; }
- ///
- /// 回复用户id
- ///
- public int ReplyUserId { get; set; }
- public string ReplyNickName { get; set; }
- ///
- /// 回复留言id
- ///
- [JsonConverter(typeof(ValueToStringConverter))]
- public long ReplyId { get; set; }
- ///
- /// 用户ip
- ///
- [JsonIgnore]
- public string UserIP { get; set; }
- ///
- /// 地理位置
- ///
- [JsonIgnore]
- public string Location { get; set; } = string.Empty;
- ///
- /// 喜欢次数
- ///
- public int PraiseNum { get; set; }
-
- ///
- /// 评论次数
- ///
- public int ReplyNum { get; set; }
- /////
- ///// 审核状态 0、待审核 1、通过 -1、未通过
- /////
- //public int AuditStatus { get; set; }
- ///
- /// 描述 :是否删除 1、删除 0、正常
- /// 空值 : true
- ///
- [JsonIgnore]
- public int IsDelete { get; set; } = 0;
- public string NickName { get; set; }
-
- /////
- ///// 分享次数
- /////
- //public int ShareNunm { get; set; }
- public string Avatar { get; set; } = string.Empty;
- public string ChatImg { get; set; }
- ///
- /// 分类id
- ///
- public int ClassifyId { get; set; }
- ///
- /// 目标id
- ///
- public long TargetId { get; set; }
- ///
- /// 置顶
- ///
- 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("省", "");
- }
- }
- ///
- /// 回复列表
- ///
- public List ReplyList { get; set; }
- }
-}
diff --git a/ZR.Model/Content/Dto/ArticleDto.cs b/ZR.Model/Content/Dto/ArticleDto.cs
deleted file mode 100644
index 5e9ace9..0000000
--- a/ZR.Model/Content/Dto/ArticleDto.cs
+++ /dev/null
@@ -1,157 +0,0 @@
-using ZR.Model.Enum;
-
-namespace ZR.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; }
- ///
- /// 1、最新 2、私密 3、热门
- ///
- public int TabId { get; set; }
- ///
- /// 话题ID
- ///
- public int? TopicId { get; set; }
- ///
- /// 排序 1、热门 2、最新
- ///
- public int? OrderBy { get; set; }
- ///
- /// 审核状态
- ///
- public AuditStatusEnum? AuditStatus { get; set; }
- ///
- /// 查询我加入的圈子
- ///
- public bool QueryMyJoin { get; set; }
- ///
- /// 搜索内容
- ///
- public string SearchText { get; set; }
- }
-
- ///
- /// 输入输出对象
- ///
- 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();
- }
- }
- public int IsPublic { get; set; } = 1;
- public string AbstractText { get; set; }
- public int IsTop { get; set; }
- ///
- /// 内容类型
- ///
- public ArticleTypeEnum ArticleType { get; set; }
- ///
- /// 点赞数
- ///
- public int PraiseNum { get; set; }
- ///
- /// 评论数
- ///
- public int CommentNum { get; set; }
- ///
- /// 分享数
- ///
- public int ShareNum { get; set; }
- ///
- /// 用户IP
- ///
- [JsonIgnore]
- public string UserIP { get; set; }
- ///
- /// 地理位置
- ///
- [JsonIgnore]
- public string Location { get; set; }
- ///
- /// 封面图片集合
- ///
- public string[] CoverImgList
- {
- get
- {
- return CoverUrl?.Split(',', StringSplitOptions.RemoveEmptyEntries) ?? Array.Empty();
- }
- }
- ///
- /// 地理位置
- ///
- public string Position
- {
- get
- {
- var temp_location = Location?.Split("-")?[0];
-
- if (temp_location == "0")
- {
- return "IP未知";
- }
- return temp_location?.Replace("省", "");
- }
- }
- ///
- /// 是否点赞
- ///
- public int IsPraise { get; set; }
- public long TopicId { get; set; }
- public string TopicName { get; set; }
- public ArticleUser User { get; set; }
- ///
- /// 审核状态
- ///
- 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; }
- }
-}
diff --git a/ZR.Model/Content/Dto/ArticlePraiseDto.cs b/ZR.Model/Content/Dto/ArticlePraiseDto.cs
deleted file mode 100644
index 23f94d7..0000000
--- a/ZR.Model/Content/Dto/ArticlePraiseDto.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-namespace ZR.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; }
- }
-}
diff --git a/ZR.Model/Content/Dto/ArticleTopicDto.cs b/ZR.Model/Content/Dto/ArticleTopicDto.cs
deleted file mode 100644
index f19332c..0000000
--- a/ZR.Model/Content/Dto/ArticleTopicDto.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-
-namespace ZR.Model.Content.Dto
-{
- ///
- /// 话题查询对象
- ///
- public class ArticleTopicQueryDto : PagerInfo
- {
- public string TopicName { get; set; }
- public DateTime? BeginAddTime { get; set; }
- public DateTime? EndAddTime { get; set; }
- public int? TopicType { get; set; }
- }
-
- ///
- /// 话题输入输出对象
- ///
- 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; }
- }
-}
\ No newline at end of file
diff --git a/ZR.Model/Content/Dto/ArticleUserCirclesDto.cs b/ZR.Model/Content/Dto/ArticleUserCirclesDto.cs
deleted file mode 100644
index 442f248..0000000
--- a/ZR.Model/Content/Dto/ArticleUserCirclesDto.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-
-namespace ZR.Model.Content.Dto
-{
- ///
- /// 用户加入圈子查询对象
- ///
- public class ArticleUserCirclesQueryDto : PagerInfo
- {
- }
-
- ///
- /// 用户加入圈子输入输出对象
- ///
- public class ArticleUserCirclesDto
- {
- [Required(ErrorMessage = "主键不能为空")]
- public int Id { get; set; }
-
- [Required(ErrorMessage = "圈子ID不能为空")]
- public int CategoryId { get; set; }
-
- [Required(ErrorMessage = "用户ID不能为空")]
- public int UserId { get; set; }
-
- public DateTime? JoinTime { get; set; }
-
- public int? Status { get; set; }
-
-
-
- [ExcelColumn(Name = "状态")]
- public string StatusLabel { get; set; }
- }
-}
\ No newline at end of file
diff --git a/ZR.Model/Content/Dto/CircleInfoDto.cs b/ZR.Model/Content/Dto/CircleInfoDto.cs
deleted file mode 100644
index c3177b1..0000000
--- a/ZR.Model/Content/Dto/CircleInfoDto.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-namespace ZR.Model.Content.Dto
-{
- public class CircleInfoDto
- {
- public int CategoryId { get; set; }
- public string Name { get; set; }
- public string Icon { get; set; }
- ///
- /// 背景图
- ///
- public string BgImg { get; set; }
- ///
- /// 介绍
- ///
- public string Introduce { get; set; }
- ///
- /// 文章数
- ///
- public int ArticleNum { get; set; }
- ///
- /// 加入人数
- ///
- public int JoinNum { get; set; }
- ///
- /// 是否加入
- ///
- public int IsJoin { get; set; }
- }
-}
diff --git a/ZR.Model/Social/Dto/SocialFansDto.cs b/ZR.Model/Social/Dto/SocialFansDto.cs
deleted file mode 100644
index e765e05..0000000
--- a/ZR.Model/Social/Dto/SocialFansDto.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using ZR.Model.Content.Dto;
-
-namespace ZR.Model.social
-{
- ///
- /// 粉丝表
- ///
- public class SocialFansDto
- {
- [JsonIgnore]
- public long PId { get; set; }
- public long Userid { get; set; }
- public long ToUserid { get; set; }
- [JsonIgnore]
- public DateTime FollowTime { get; set; }
- [JsonIgnore]
- public string UserIP { get; set; }
- public int Status { get; set; }
-
- public ArticleUser User { get; set; }
- }
-
- public class FansQueryDto : PagerInfo
- {
- public int SelectType { get; set; }
- }
-}
diff --git a/ZR.Model/Social/Dto/SocialFansInfoDto.cs b/ZR.Model/Social/Dto/SocialFansInfoDto.cs
deleted file mode 100644
index 624ddcf..0000000
--- a/ZR.Model/Social/Dto/SocialFansInfoDto.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-namespace ZR.Model.social
-{
- public class SocialFansInfoDto
- {
- public int Userid { get; set; }
- public int FollowNum { get; set; }
- public int FansNum { get; set; }
- }
-}
diff --git a/ZR.Model/Social/SocialFans.cs b/ZR.Model/Social/SocialFans.cs
deleted file mode 100644
index 80016ed..0000000
--- a/ZR.Model/Social/SocialFans.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-namespace ZR.Model.social
-{
- ///
- /// 粉丝表
- ///
- [SugarTable("social_fans")]
- public class SocialFans
- {
- [SugarColumn(IsPrimaryKey = true)]
- public long PId { get; set; }
- public long Userid { get; set; }
- public long ToUserid { get; set; }
- ///
- /// 备注名
- ///
- public string RemarkName { get; set; }
- public DateTime FollowTime { get; set; }
- public string UserIP { get; set; }
- }
-}
diff --git a/ZR.Model/Social/SocialFansInfo.cs b/ZR.Model/Social/SocialFansInfo.cs
deleted file mode 100644
index c5c4af8..0000000
--- a/ZR.Model/Social/SocialFansInfo.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-namespace ZR.Model.social
-{
- ///
- /// 粉丝信息表
- ///
- [SugarTable("social_fans_info")]
- public class SocialFansInfo
- {
- [SugarColumn(IsPrimaryKey = true)]
- public long Userid { get; set; }
- ///
- /// 关注数
- ///
- public int FollowNum { get; set; }
- ///
- /// 粉丝数
- ///
- public int FansNum { get; set; }
- [JsonIgnore]
- public DateTime UpdateTime { get; set; }
- }
-}
diff --git a/ZR.Model/System/Model/Dto/SysUserMsgDto.cs b/ZR.Model/System/Model/Dto/SysUserMsgDto.cs
index b2263e2..d8a6380 100644
--- a/ZR.Model/System/Model/Dto/SysUserMsgDto.cs
+++ b/ZR.Model/System/Model/Dto/SysUserMsgDto.cs
@@ -1,3 +1,5 @@
+
+
using ZR.Model.Content.Dto;
namespace ZR.Model.Dto
diff --git a/ZR.Service/Content/ArticleCategoryService.cs b/ZR.Service/Content/ArticleCategoryService.cs
deleted file mode 100644
index 7bb308b..0000000
--- a/ZR.Service/Content/ArticleCategoryService.cs
+++ /dev/null
@@ -1,89 +0,0 @@
-using Infrastructure.Attribute;
-using Infrastructure.Extensions;
-using Mapster;
-using ZR.Model.Content;
-using ZR.Model.Content.Dto;
-using ZR.Repository;
-using ZR.Service.Content.IService;
-
-namespace ZR.Service.Content
-{
- ///
- /// 文章目录Service业务层处理
- ///
- [AppService(ServiceType = typeof(IArticleCategoryService), ServiceLifetime = LifeTime.Transient)]
- public class ArticleCategoryService : BaseService, IArticleCategoryService
- {
- ///
- /// 查询文章目录列表
- ///
- ///
- ///
- public PagedInfo GetList(ArticleCategoryQueryDto parm)
- {
- var predicate = Expressionable.Create();
- predicate.AndIF(parm.CategoryType != null, m => m.CategoryType == parm.CategoryType);
- predicate.AndIF(parm.ParentId != null, m => m.ParentId == parm.ParentId);
-
- var response = Queryable()
- .Where(predicate.ToExpression())
- .WithCache(60 * 5)
- .ToPage(parm);
-
- return response;
- }
-
- ///
- /// 查询文章目录树列表
- ///
- ///
- ///
- public List GetTreeList(ArticleCategoryQueryDto parm)
- {
- var predicate = Expressionable.Create();
- predicate.AndIF(parm.CategoryType != null, m => m.CategoryType == parm.CategoryType);
-
- var response = Queryable()
- .Where(predicate.ToExpression());
-
- if (parm.Sort.IsNotEmpty())
- {
- response = response.OrderByPropertyName(parm.Sort, parm.SortType.Contains("desc") ? OrderByType.Desc : OrderByType.Asc);
- }
- var treeList = response.ToTree(it => it.Children, it => it.ParentId, 0);
-
- return treeList.Adapt>();
- }
-
- ///
- /// 添加文章目录
- ///
- ///
- ///
- public int AddArticleCategory(ArticleCategory parm)
- {
- var response = Add(parm);
- return response;
- }
-
- ///
- /// 增加加入圈子人数
- ///
- ///
- ///
- public int PlusJoinNum(int categoryId)
- {
- return Update(w => w.CategoryId == categoryId, w => new ArticleCategory() { JoinNum = w.JoinNum +1 });
- }
-
- ///
- /// 减少加入圈子人数
- ///
- ///
- ///
- public int ReduceJoinNum(int categoryId)
- {
- return Update(w => w.CategoryId == categoryId, w => new ArticleCategory() { JoinNum = w.JoinNum - 1 });
- }
- }
-}
diff --git a/ZR.Service/Content/ArticleCommentService.cs b/ZR.Service/Content/ArticleCommentService.cs
deleted file mode 100644
index f01e583..0000000
--- a/ZR.Service/Content/ArticleCommentService.cs
+++ /dev/null
@@ -1,278 +0,0 @@
-using Infrastructure;
-using Infrastructure.Attribute;
-using Infrastructure.Extensions;
-using ZR.Model.Content;
-using ZR.Model.Content.Dto;
-using ZR.Model.System;
-using ZR.Repository;
-using ZR.Service.Content.IService;
-using ZR.ServiceCore.Services;
-
-namespace ZR.Service.Content
-{
- [AppService(ServiceType = typeof(IArticleCommentService), ServiceLifetime = LifeTime.Transient)]
- public class ArticleCommentService : BaseService, IArticleCommentService
- {
- private ISysUserService UserService;
- private IEmailLogService EmailLogService;
- private IArticleService ArticleService;
- private ISysConfigService SysConfigService;
- private ISysUserMsgService UserMsgService;
- public ArticleCommentService(
- ISysUserService userService,
- IEmailLogService emailLogService,
- IArticleService articleService,
- ISysConfigService sysConfigService,
- ISysUserMsgService sysUserMsgService)
- {
- this.UserService = userService;
- EmailLogService = emailLogService;
- ArticleService = articleService;
- SysConfigService = sysConfigService;
- UserMsgService = sysUserMsgService;
- }
-
- ///
- /// 获取评论列表
- ///
- ///
- ///
- public PagedInfo GetMessageList(MessageQueryDto dto)
- {
- var predicate = Expressionable.Create();
- predicate.And(it => it.IsDelete == 0);
- predicate.And(it => it.ParentId == dto.CommentId);
- predicate.AndIF(dto.UserId != null, it => it.UserId == dto.UserId);
- predicate.AndIF(dto.CommentId > 0, it => it.CommentId > dto.CommentId);//分页使用
- //predicate.AndIF(dto.ClassifyId > 0, it => it.ClassifyId == dto.ClassifyId);
- //predicate.AndIF(dto.ClassifyId == 0, it => it.ClassifyId == 0);
- predicate.AndIF(dto.TargetId > 0, it => it.TargetId == dto.TargetId);
-
- var list = Queryable()
- .LeftJoin((it, u) => it.UserId == u.UserId)
- .OrderByDescending(it => it.Top)
- .OrderByIF(dto.OrderBy == 1, it => it.PraiseNum, OrderByType.Desc)
- .OrderByIF(dto.OrderBy == 2, it => it.CommentId, OrderByType.Desc)
- .Where(predicate.ToExpression())
- .WithCache(60 * 30)
- .Select((it, u) => new ArticleCommentDto()
- {
- NickName = u.NickName,
- Avatar = u.Avatar
- }, true)
- .ToPage(dto);
-
- foreach (var item in list.Result)
- {
- int take = 1;
- if (item.ReplyNum > 0)
- {
- item.ReplyList = GetCommentQueryable(item.CommentId).Take(take).ToList();
- }
- if (item.ReplyNum > take)
- {
- item.HasMore = true;
- }
- }
-
- return list;
- }
-
- ///
- /// 获取评论回复列表
- ///
- /// 分页
- ///
- ///
- public PagedInfo GetReplyComments(long cid, MessageQueryDto pager)
- {
- PagedInfo list = GetCommentQueryable(cid).ToPage(pager);
- //Context.ThenMapper(list.Result, f =>
- //{
- // if (f.ReplyId > 0 && f.ReplyUserId > 0)
- // {
- // f.ReplyNickName = UserService.GetFirst(x => x.UserId == f.ReplyUserId).NickName;
- // }
- //});
- return list;
- }
-
- private ISugarQueryable GetCommentQueryable(long cid)
- {
- return Queryable()
- .LeftJoin((f, u) => f.UserId == u.UserId)
- .Where(f => f.ParentId == cid && f.IsDelete == 0)
- //.WhereIF(cid > 0, f => f.MId > cid)
- //.Includes(f => f.User.MappingField(z => z.Useridx, () => f.Useridx))
- .OrderBy(f => f.CommentId)
- .Select((f, u) => new ArticleCommentDto()
- {
- NickName = u.NickName,
- Avatar = u.Avatar
- }, true);
- }
-
- ///
- /// 评论
- ///
- ///
- ///
- public ArticleComment AddMessage(ArticleComment message)
- {
- var configInfo = SysConfigService.GetFirst(f => f.ConfigKey == "article.comment") ?? throw new CustomException(ResultCode.CUSTOM_ERROR, "评论失败,请联系管理员");
- var userInfo = UserService.GetById(message.UserId);
-
- if (configInfo.ConfigValue == "1" && userInfo.Phonenumber.IsEmpty())
- {
- throw new CustomException(ResultCode.PHONE_BIND, "请绑定手机号");
- }
- var contentInfo = ArticleService.GetById(message.TargetId);
- switch (contentInfo.CommentSwitch)
- {
- case Model.Enum.CommentSwitchEnum.ALL:
- break;
- case Model.Enum.CommentSwitchEnum.FANS:
- break;
- case Model.Enum.CommentSwitchEnum.SELF:
- if (message.UserId != contentInfo.UserId)
- {
- throw new CustomException("仅作者才能评论");
- }
- break;
- default:
- break;
- }
- var ipInfo = HttpContextExtension.GetIpInfo(message.UserIP);
- message.Location = ipInfo;
- message.AddTime = DateTime.Now;
- ArticleComment result = null;
- var r = UseTran(() =>
- {
- result = InsertReturnEntity(message);
- if (result != null && result.CommentId > 0)
- {
- if (message.ParentId > 0)
- {
- //评论表 评论数 + 1
- Update(it => it.CommentId == message.ParentId, it => new ArticleComment() { ReplyNum = it.ReplyNum + 1 });
- }
-
- //内容表评论数加1
- if (message.TargetId > 0)
- {
- ArticleService.Update(it => it.Cid == (int)message.TargetId, it => new Article() { CommentNum = it.CommentNum + 1 });
- }
- }
- });
- //查询出评论的内容信息找出作者
- var targetInfo = GetFirst(f => f.CommentId == message.TargetId);
- if (targetInfo != null && targetInfo.UserId != message.UserId)
- {
- //IM消息
- UserMsgService.AddSysUserMsg(targetInfo.UserId, message.Content, UserMsgType.COMMENT);
- }
- if (message.UserId != contentInfo?.UserId)
- {
- //给作者发送IM消息
- UserMsgService.AddSysUserMsg(contentInfo.UserId, message.Content, UserMsgType.COMMENT);
- }
-
- return result;
- }
-
- ///
- /// 评论点赞
- ///
- ///
- ///
- public int PraiseMessage(long mid)
- {
- return Context.Updateable()
- .SetColumns(it => it.PraiseNum == it.PraiseNum + 1)
- .Where(it => it.CommentId == mid)
- .ExecuteCommand();
- }
-
- ///
- /// 删除评论
- ///
- /// 评论ID
- /// 当前登录用户
- ///
- public int DeleteMessage(long commentId, long userId)
- {
- var info = GetById(commentId) ?? throw new CustomException("评论不存在");
- var postInfo = ArticleService.GetById(info.TargetId);
- if (userId != info.UserId && userId != postInfo.UserId)
- {
- return 0;
- }
- var deleteNum = 0;
- var result = UseTran(() =>
- {
- Update(it => it.CommentId == commentId, it => new ArticleComment() { IsDelete = 1 });
- if (info.ParentId > 0)
- {
- //评论表 评论数 - 1
- Update(it => it.CommentId == info.ParentId, it => new ArticleComment() { ReplyNum = it.ReplyNum - 1 });
- }
- //减少文章评论次数
- if (info.TargetId > 0)
- {
- deleteNum = info.ReplyNum > 0 ? info.ReplyNum + 1 : 1;
-
- ArticleService.Update(it => it.Cid == (int)info.TargetId, it => new Article()
- {
- CommentNum = it.CommentNum - deleteNum
- });
- }
- });
- return result.IsSuccess ? deleteNum : 0;
- }
-
- ///
- /// 获取评论列表
- ///
- ///
- ///
- public PagedInfo GetMyMessageList(MessageQueryDto dto)
- {
- var predicate = Expressionable.Create();
- predicate.And(it => it.IsDelete == 0);
- //predicate.And(it => it.ParentId == dto.MId);
- predicate.AndIF(dto.UserId != null, it => it.UserId == dto.UserId);
- predicate.AndIF(dto.CommentId > 0, it => it.CommentId > dto.CommentId);//分页使用
- predicate.AndIF(dto.BeginAddTime != null, it => it.AddTime >= dto.BeginAddTime && it.AddTime <= dto.EndAddTime);//分页使用
-
- return Queryable()
- .WithCache(60)
- .OrderByIF(dto.OrderBy == 1, it => it.PraiseNum, OrderByType.Desc)
- .OrderByIF(dto.OrderBy == 2, it => it.CommentId, OrderByType.Desc)
- .Where(predicate.ToExpression())
- //.Select((it, u) => new MessageDto()
- //{
- // MId = it.MId.SelectAll(),
- // //NickName = u.NickName,
- // //Avatar = u.Avatar
- //}, true)
- .ToPage(dto);
- }
-
- ///
- /// 置顶评论
- ///
- ///
- ///
- ///
- public long TopMessage(long commentId, long top)
- {
- long time = 0;
- if (top <= 0)
- {
- time = DateTimeHelper.GetUnixTimeStamp(DateTime.Now);
- }
- Update(it => it.CommentId == commentId, it => new ArticleComment() { Top = time });
- return time;
- }
- }
-}
diff --git a/ZR.Service/Content/ArticlePraiseService.cs b/ZR.Service/Content/ArticlePraiseService.cs
deleted file mode 100644
index 492fb0e..0000000
--- a/ZR.Service/Content/ArticlePraiseService.cs
+++ /dev/null
@@ -1,104 +0,0 @@
-using Infrastructure.Attribute;
-using ZR.Model.Content;
-using ZR.Service.Content.IService;
-using ZR.ServiceCore.Services;
-
-namespace ZR.Service.Content
-{
- [AppService(ServiceType = typeof(IArticlePraiseService), ServiceLifetime = LifeTime.Transient)]
- public class ArticlePraiseService : BaseService, IArticlePraiseService
- {
- private IArticleService _articleService;
- private ISysUserMsgService _sysUserMsgService;
-
- ///
- ///
- ///
- ///
- ///
- public ArticlePraiseService(IArticleService articleService, ISysUserMsgService userMsgService)
- {
- _articleService = articleService;
- _sysUserMsgService = userMsgService;
- }
-
- ///
- /// 点赞
- ///
- ///
- ///
- public int Praise(ArticlePraise dto)
- {
- int result = 0;
- var praiseInfo = GetFirst(f => f.UserId == dto.UserId && f.ArticleId == dto.ArticleId);
- var isPraise = 0;
- var r = UseTran(() =>
- {
- //第一次点赞插入数据
- if (praiseInfo == null)
- {
- Insertable(dto).ExecuteReturnSnowflakeId();
- result = _articleService.PraiseArticle(dto.ArticleId);
- isPraise = 1;
-
- if (dto.UserId != dto.ToUserId)
- {
- _sysUserMsgService.AddSysUserMsg(new SysUserMsg()
- {
- FromUserid = dto.UserId,
- UserId = dto.ToUserId,
- Content = "赞了你的内容",
- MsgType = UserMsgType.PRAISE,
- TargetId = dto.ArticleId,
- });
- }
- }
- else
- {
- if (praiseInfo.IsDelete == 0)
- {
- result = CanclePraise(dto.UserId, dto.ArticleId);
- //文章点赞-1
- _articleService.CancelPraise(dto.ArticleId);
- }
- else
- {
- //文章点赞+1
- _articleService.PraiseArticle(dto.ArticleId);
- //恢复点赞为未删除状态
- PlusPraise(praiseInfo.PId);
- isPraise = 1;
- }
- }
- });
- return r.IsSuccess && isPraise == 1 ? 1 : 0;
- }
-
- ///
- /// 取消点赞点赞
- ///
- ///
- ///
- ///
- public int CanclePraise(long userid, long articleId)
- {
- return Deleteable()
- .Where(f => f.ArticleId == articleId && f.UserId == userid)
- .IsLogic()
- .ExecuteCommand(deleteValue: 1);
- }
-
- ///
- /// 恢复点赞
- ///
- ///
- ///
- public int PlusPraise(long pid)
- {
- return Deleteable()
- .Where(f => f.PId == pid)
- .IsLogic()
- .ExecuteCommand(deleteValue: 0);
- }
- }
-}
diff --git a/ZR.Service/Content/ArticleService.cs b/ZR.Service/Content/ArticleService.cs
deleted file mode 100644
index bb7ebb9..0000000
--- a/ZR.Service/Content/ArticleService.cs
+++ /dev/null
@@ -1,500 +0,0 @@
-using Infrastructure;
-using Infrastructure.Attribute;
-using Infrastructure.Extensions;
-using Mapster;
-using ZR.Common;
-using ZR.Model.Content;
-using ZR.Model.Content.Dto;
-using ZR.Model.Enum;
-using ZR.Model.System;
-using ZR.Repository;
-using ZR.Service.Content.IService;
-using ZR.ServiceCore.Services;
-
-namespace ZR.Service.Content
-{
- ///
- ///
- ///
- [AppService(ServiceType = typeof(IArticleService), ServiceLifetime = LifeTime.Transient)]
- public class ArticleService : BaseService, IArticleService
- {
- private readonly IArticleCategoryService _categoryService;
- private readonly IArticleTopicService _topicService;
- private readonly ISysUserMsgService _userMsgService;
-
- ///
- ///
- ///
- ///
- ///
- ///
- public ArticleService(
- IArticleCategoryService categoryService,
- IArticleTopicService topicService,
- ISysUserMsgService userMsgService)
- {
- _categoryService = categoryService;
- _topicService = topicService;
- _userMsgService = userMsgService;
- }
-
- ///
- /// 查询文章管理列表
- ///
- ///
- ///
- public PagedInfo GetList(ArticleQueryDto parm)
- {
- var predicate = Expressionable.Create();
-
- predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.Title), m => m.Title.Contains(parm.Title));
- predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.AbstractText), m => m.AbstractText.Contains(parm.AbstractText));
- predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.Status), m => m.Status == parm.Status);
- predicate = predicate.AndIF(parm.IsPublic != null, m => m.IsPublic == parm.IsPublic);
- predicate = predicate.AndIF(parm.IsTop != null, m => m.IsTop == parm.IsTop);
- predicate = predicate.AndIF(parm.ArticleType != null, m => (int)m.ArticleType == parm.ArticleType);
- predicate = predicate.AndIF(parm.TopicId != null, m => m.TopicId == parm.TopicId);
- predicate = predicate.AndIF(parm.AuditStatus != null, m => m.AuditStatus == parm.AuditStatus);
-
- if (parm.CategoryId != null)
- {
- var allChildCategory = Context.Queryable()
- .ToChildList(m => m.ParentId, parm.CategoryId);
- var categoryIdList = allChildCategory.Select(x => x.CategoryId).ToArray();
- predicate = predicate.And(m => categoryIdList.Contains(m.CategoryId));
- }
-
- var response = Queryable()
- .WithCache(60 * 24)
- .IgnoreColumns(x => new { x.Content })
- .Includes(x => x.CategoryNav) //填充子对象
- .Where(predicate.ToExpression())
- //.OrderBy(x => x.CreateTime, OrderByType.Desc)
- .ToPage(parm);
-
- return response;
- }
-
- ///
- /// 前台查询文章列表
- ///
- ///
- ///
- public PagedInfo GetArticleList(ArticleQueryDto parm)
- {
- var predicate = Expressionable.Create();
- predicate = predicate.And(m => m.Status == "1");
- predicate = predicate.And(m => m.IsPublic == 1);
- predicate = predicate.And(m => m.AuditStatus == AuditStatusEnum.Passed);
- predicate = predicate.And(m => m.ArticleType == ArticleTypeEnum.Article);
- predicate = predicate.AndIF(parm.SearchText.IsNotEmpty(), m => m.Title.Contains(parm.SearchText) || m.AbstractText.Contains(parm.SearchText));
- predicate = predicate.AndIF(parm.TopicId != null, m => m.TopicId == parm.TopicId);
-
- if (parm.CategoryId != null)
- {
- var allChildCategory = Context.Queryable()
- .ToChildList(m => m.ParentId, parm.CategoryId);
- var categoryIdList = allChildCategory.Select(x => x.CategoryId).ToArray();
- predicate = predicate.And(m => categoryIdList.Contains(m.CategoryId));
- }
-
- var response = Queryable()
- .WithCache(60 * 30)
- .Includes(x => x.CategoryNav)
- .LeftJoin((m, u) => m.UserId == u.UserId).Filter(null, true)
- .Where(predicate.ToExpression())
- .OrderByDescending(m => m.Cid)
- .Select((m, u) => new ArticleDto()
- {
- User = new ArticleUser()
- {
- Avatar = u.Avatar,
- NickName = u.NickName,
- Sex = u.Sex,
- },
- Content = string.Empty,
- UserIP = string.Empty
- }, true)
- .ToPage(parm);
-
- if (parm.UserId > 0)
- {
- Context.ThenMapper(response.Result, item =>
- {
- item.IsPraise = Context.Queryable()
- .Where(f => f.UserId == parm.UserId && f.IsDelete == 0)
- .SetContext(scl => scl.ArticleId, () => item.Cid, item).Any() ? 1 : 0;
- });
- }
-
- return response;
- }
-
- ///
- /// 查询最新文章列表
- ///
- ///
- public List GetNewArticleList()
- {
- var predicate = Expressionable.Create();
- predicate = predicate.And(m => m.Status == "1");
- predicate = predicate.And(m => m.IsPublic == 1);
- predicate = predicate.And(m => m.ArticleType == ArticleTypeEnum.Article);
- predicate = predicate.And(m => m.AuditStatus == AuditStatusEnum.Passed);
-
- var response = Queryable()
- .Where(predicate.ToExpression())
- .Includes(x => x.CategoryNav) //填充子对象
- .Take(10)
- .OrderBy(f => f.CreateTime, OrderByType.Desc)
- .ToList();
- return response.Adapt>();
- }
-
- ///
- /// 前台查询动态列表
- ///
- ///
- ///
- public PagedInfo GetMonentList(ArticleQueryDto parm)
- {
- var predicate = Expressionable.Create();
- predicate = predicate.And(m => m.Status == "1");
- predicate = predicate.And(m => m.IsPublic == 1);
- predicate = predicate.And(m => m.ArticleType == ArticleTypeEnum.Monent);
- predicate = predicate.And(m => m.AuditStatus == AuditStatusEnum.Passed);
- predicate = predicate.AndIF(parm.TopicId != null, m => m.TopicId == parm.TopicId);
- predicate = predicate.AndIF(parm.CategoryId != null, m => m.CategoryId == parm.CategoryId);
-
- //获取我的圈子
- if (parm.QueryMyJoin)
- {
- var myJoin = Context.Queryable()
- .Where(m => m.UserId == parm.UserId)
- .Select(m => m.CategoryId)
- .ToList();
- predicate = predicate.And(m => myJoin.Contains(m.CategoryId));
- }
- var response = Queryable()
- .Includes(x => x.CategoryNav) //填充子对象
- .LeftJoin((m, u) => m.UserId == u.UserId).Filter(null, true)
- .Where(predicate.ToExpression())
- .OrderByIF(parm.OrderBy == 1, m => new { m.PraiseNum, m.CommentNum }, OrderByType.Desc)
- .OrderByIF(parm.OrderBy == 2, m => new { m.Cid }, OrderByType.Desc)
- .OrderBy(m => m.Cid, OrderByType.Desc)
- .Select((m, u) => new ArticleDto()
- {
- User = new ArticleUser()
- {
- Avatar = u.Avatar,
- NickName = u.NickName,
- Sex = u.Sex,
- },
- }, true)
- .ToPage(parm);
-
- if (parm.UserId > 0)
- {
- Context.ThenMapper(response.Result, item =>
- {
- item.IsPraise = Context.Queryable()
- .Where(f => f.UserId == parm.UserId && f.IsDelete == 0)
- .SetContext(scl => scl.ArticleId, () => item.Cid, item).Any() ? 1 : 0;
- });
- }
-
- return response;
- }
-
- ///
- /// 查询我的文章列表
- ///
- ///
- ///
- public PagedInfo GetMyList(ArticleQueryDto parm)
- {
- var predicate = Expressionable.Create();
-
- predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.Title), m => m.Title.Contains(parm.Title));
- predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.Status), m => m.Status == parm.Status);
- predicate = predicate.AndIF(parm.BeginTime != null, m => m.CreateTime >= parm.BeginTime);
- predicate = predicate.AndIF(parm.EndTime != null, m => m.CreateTime <= parm.EndTime);
- predicate = predicate.And(m => m.UserId == parm.UserId);
- predicate = predicate.AndIF(parm.ArticleType != null, m => (int)m.ArticleType == parm.ArticleType);
- predicate = predicate.AndIF(parm.TabId == 2, m => m.IsPublic == 0 && m.UserId == parm.UserId);
-
- var response = Queryable()
- //.IgnoreColumns(x => new { x.Content })
- .Includes(x => x.CategoryNav)
- .Where(predicate.ToExpression())
- .OrderByIF(parm.TabId == 3, m => new { m.IsTop, m.PraiseNum }, OrderByType.Desc)
- .OrderByDescending(m => new { m.IsTop, m.Cid })
- .Select((x) => new ArticleDto()
- {
- Content = x.ArticleType == 0 ? string.Empty : x.Content,
- }, true)
- .ToPage(parm);
-
- return response;
- }
-
- ///
- /// 修改文章管理
- ///
- ///
- ///
- public int UpdateArticle(Article model)
- {
- var response = Update(w => w.Cid == model.Cid, it => new Article()
- {
- Title = model.Title,
- Content = model.Content,
- Status = model.Status,
- Tags = model.Tags,
- UpdateTime = DateTime.Now,
- CoverUrl = model.CoverUrl,
- CategoryId = model.CategoryId,
- IsPublic = model.IsPublic,
- AbstractText = model.AbstractText,
- });
- return response;
- }
-
- ///
- /// 置顶文章
- ///
- ///
- ///
- public int TopArticle(Article model)
- {
- var response = Update(w => w.Cid == model.Cid, it => new Article()
- {
- IsTop = model.IsTop,
- });
- return response;
- }
-
- ///
- /// 评论权限
- ///
- ///
- ///
- public int ChangeComment(Article model)
- {
- var response = Update(w => w.Cid == model.Cid, it => new Article()
- {
- CommentSwitch = model.CommentSwitch,
- });
- return response;
- }
-
- ///
- /// 是否公开
- ///
- ///
- ///
- public int ChangeArticlePublic(Article model)
- {
- var response = Update(w => w.Cid == model.Cid, it => new Article()
- {
- IsPublic = model.IsPublic,
- });
- return response;
- }
-
- ///
- /// 修改文章访问量
- ///
- ///
- ///
- public int UpdateArticleHit(long cid)
- {
- var response = Update(w => w.Cid == cid, it => new Article() { Hits = it.Hits + 1 });
- return response;
- }
-
- ///
- /// 点赞
- ///
- ///
- ///
- public int PraiseArticle(long cid)
- {
- return Update(w => w.Cid == cid, it => new Article() { PraiseNum = it.PraiseNum + 1 });
- }
- public int CancelPraise(long cid)
- {
- return Update(w => w.Cid == cid, it => new Article() { PraiseNum = it.PraiseNum - 1 });
- }
-
- public Article PublishArticle(Article article)
- {
- return Publish(article);
- }
-
- ///
- /// 前端-发布动态,文章
- ///
- ///
- ///
- public Article Publish(Article article)
- {
- var httpContext = App.HttpContext;
- article.AuthorName = HttpContextExtension.GetName(httpContext);
- article.UserId = HttpContextExtension.GetUId(httpContext);
- article.UserIP = HttpContextExtension.GetClientUserIp(httpContext);
- article.Location = HttpContextExtension.GetIpInfo(article.UserIP);
- article.AuditStatus = AuditStatusEnum.Passed;
-
- article = InsertReturnEntity(article);
- if (article.Status == "1")
- {
- //跟新话题加入数
- if (article.Cid > 0 && article.TopicId > 0)
- {
- _topicService.Update(w => w.TopicId == article.TopicId, it => new ArticleTopic() { JoinNum = it.JoinNum + 1 });
- }
- //更新发布文章数
- if (article.Cid > 0 && article.CategoryId > 0)
- {
- _categoryService.Update(w => w.CategoryId == article.CategoryId, it => new ArticleCategory() { ArticleNum = it.ArticleNum + 1 });
- }
- }
- return article;
- }
-
- ///
- /// 获取文章详情
- ///
- /// 内容id
- /// 当前用户id
- ///
- ///
- public ArticleDto GetArticle(long cid, long userId)
- {
- var response = GetId(cid);
- var model = response.Adapt() ?? throw new CustomException(ResultCode.FAIL, "内容不存在");
- if (model.IsPublic == 0 && userId != model.UserId)
- {
- throw new CustomException(ResultCode.CUSTOM_ERROR, "访问失败");
- }
- if (model != null)
- {
- model.CategoryNav = _categoryService.GetById(model.CategoryId).Adapt();
- }
-
- var webContext = App.HttpContext;
- var CK = "ARTICLE_DETAILS_" + userId + HttpContextExtension.GetClientUserIp(webContext);
- if (!CacheHelper.Exists(CK))
- {
- UpdateArticleHit(cid);
- var userIP = HttpContextExtension.GetClientUserIp(webContext);
- var location = HttpContextExtension.GetIpInfo(userIP);
- itenant.InsertableWithAttr(new ArticleBrowsingLog()
- {
- ArticleId = cid,
- UserId = userId,
- Location = location,
- UserIP = userIP,
- AddTime = DateTime.Now,
- }).ExecuteReturnSnowflakeId();
- }
- CacheHelper.SetCache(CK, 1, 10);
- if (userId > 0)
- {
- model.IsPraise = Context.Queryable()
- .Where(f => f.UserId == userId && f.ArticleId == cid && f.IsDelete == 0)
- .Any() ? 1 : 0;
- }
-
- return model;
- }
-
- ///
- /// 审核通过
- ///
- ///
- ///
- public int Passed(long[] idsArr)
- {
- int result = 0;
- List monents = [];
- foreach (var item in idsArr)
- {
- var model = GetFirst(x => x.Cid == item && x.AuditStatus == 0);
- if (model == null) continue;
-
- //model.Auditor = HttpContext.GetName();
- model.AuditStatus = AuditStatusEnum.Passed;
- var response = Update(w => w.Cid == model.Cid, it => new Article()
- {
- AuditStatus = model.AuditStatus,
- //Auditor = model.Auditor,
- });
- result += response;
- monents.Add(model);
- }
- var data = from a in monents
- group a by new { a.UserId } into grp
- select new
- {
- userid = grp.Key.UserId,
- num = grp.Count()
- };
- foreach (var item in data)
- {
- _userMsgService.AddSysUserMsg(item.userid, "您发布的内容已通过审核", UserMsgType.SYSTEM);
- }
-
- return result;
- }
-
- ///
- /// 审核不通过
- ///
- ///
- ///
- ///
- public int Reject(string reason, long[] idsArr)
- {
- int result = 0;
- List monents = new();
- foreach (var item in idsArr)
- {
- var model = GetFirst(x => x.Cid == item && x.AuditStatus == 0);
- if (model == null) continue;
-
- //model.Auditor = HttpContext.GetName();
- model.AuditStatus = AuditStatusEnum.Reject;
- var response = Update(w => w.Cid == model.Cid, it => new Article()
- {
- AuditStatus = model.AuditStatus,
- //Auditor = model.Auditor,
- });
- result += response;
- monents.Add(model);
- }
- var data = from a in monents
- group a by new { a.UserId } into grp
- select new
- {
- userid = grp.Key.UserId,
- num = grp.Count()
- };
- foreach (var item in data)
- {
- //Console.WriteLine(item.useridx +"," + item.num);
- string content = $"您发布的内容未通过审核。";
- if (!string.IsNullOrEmpty(reason))
- {
- content += $"原因:{reason}";
- }
- _userMsgService.AddSysUserMsg(item.userid, content, UserMsgType.SYSTEM);
- }
-
- return result;
- }
-
- }
-}
diff --git a/ZR.Service/Content/ArticleTopicService.cs b/ZR.Service/Content/ArticleTopicService.cs
deleted file mode 100644
index a1e2c38..0000000
--- a/ZR.Service/Content/ArticleTopicService.cs
+++ /dev/null
@@ -1,118 +0,0 @@
-using Infrastructure;
-using Infrastructure.Attribute;
-using Mapster;
-using ZR.Model;
-using ZR.Model.Content;
-using ZR.Model.Content.Dto;
-using ZR.Repository;
-using ZR.Service.Content.IService;
-
-namespace ZR.Service.Content
-{
- ///
- /// 文章话题Service业务层处理
- ///
- [AppService(ServiceType = typeof(IArticleTopicService), ServiceLifetime = LifeTime.Transient)]
- public class ArticleTopicService : BaseService, IArticleTopicService
- {
- ///
- /// 查询文章话题列表
- ///
- ///
- ///
- public PagedInfo GetList(ArticleTopicQueryDto parm)
- {
- var predicate = QueryExp(parm);
-
- var response = Queryable()
- .Where(predicate.ToExpression())
- .ToPage(parm);
-
- return response;
- }
-
- ///
- /// 获取详情
- ///
- ///
- ///
- public ArticleTopic GetInfo(long TopicId)
- {
- var response = Queryable()
- .Where(x => x.TopicId == TopicId)
- .First();
-
- return response;
- }
-
- ///
- /// 添加文章话题
- ///
- ///
- ///
- public ArticleTopic AddArticleTopic(ArticleTopic model)
- {
- if (Any(f => f.TopicName == model.TopicName))
- {
- throw new CustomException("话题名已存在");
- }
- return Insertable(model).ExecuteReturnEntity();
- }
-
- ///
- /// 修改文章话题
- ///
- ///
- ///
- public int UpdateArticleTopic(ArticleTopic model)
- {
- return Update(model, true);
- }
-
- ///
- /// 导出文章话题
- ///
- ///
- ///
- public PagedInfo ExportList(ArticleTopicQueryDto parm)
- {
- var predicate = QueryExp(parm);
-
- var response = Queryable()
- .Where(predicate.ToExpression())
- .Select((it) => new ArticleTopicDto()
- {
- }, true)
- .ToPage(parm);
-
- return response;
- }
-
- ///
- /// 查询导出表达式
- ///
- ///
- ///
- private static Expressionable QueryExp(ArticleTopicQueryDto parm)
- {
- var predicate = Expressionable.Create();
-
- return predicate;
- }
-
- ///
- /// 查询热门文章话题列表
- ///
- ///
- ///
- public List GetTopicList(ArticleTopicQueryDto parm)
- {
- var predicate = Expressionable.Create();
- var response = Queryable()
- .Where(predicate.ToExpression())
- .ToList();
-
- return response.Adapt>();
- }
- }
-}
\ No newline at end of file
diff --git a/ZR.Service/Content/ArticleUserCirclesService.cs b/ZR.Service/Content/ArticleUserCirclesService.cs
deleted file mode 100644
index db06c1f..0000000
--- a/ZR.Service/Content/ArticleUserCirclesService.cs
+++ /dev/null
@@ -1,150 +0,0 @@
-using Infrastructure;
-using Infrastructure.Attribute;
-using ZR.Model.Content;
-using ZR.Model.Content.Dto;
-using ZR.Repository;
-using ZR.Service.Content.IService;
-
-namespace ZR.Service.Content
-{
- ///
- /// 用户加入圈子Service业务层处理
- ///
- [AppService(ServiceType = typeof(IArticleUserCirclesService), ServiceLifetime = LifeTime.Transient)]
- public class ArticleUserCirclesService : BaseService, IArticleUserCirclesService
- {
- private readonly IArticleCategoryService _articleCategoryService;
- public ArticleUserCirclesService(IArticleCategoryService articleCategoryService)
- {
- _articleCategoryService = articleCategoryService;
- }
-
- ///
- /// 查询用户加入圈子列表
- ///
- ///
- ///
- public PagedInfo GetList(ArticleUserCirclesQueryDto parm)
- {
- var predicate = QueryExp(parm);
-
- var response = Queryable()
- .Where(predicate.ToExpression())
- .ToPage(parm);
-
- return response;
- }
-
- ///
- /// 获取详情
- ///
- ///
- ///
- public ArticleUserCircles GetInfo(int Id)
- {
- var response = Queryable()
- .Where(x => x.Id == Id)
- .First();
-
- return response;
- }
-
- ///
- /// 查询表达式
- ///
- ///
- ///
- private static Expressionable QueryExp(ArticleUserCirclesQueryDto parm)
- {
- var predicate = Expressionable.Create();
-
- return predicate;
- }
-
-
- #region 前端接口
-
- ///
- /// 用户加入圈子
- ///
- ///
- ///
- ///
- public int JoinCircle(int userId, int categoryId)
- {
- var join = IsJoin(userId, categoryId);
- if (join == 1)
- {
- throw new CustomException("您已加入");
- }
- var entity = new ArticleUserCircles
- {
- UserId = userId,
- CategoryId = categoryId,
- JoinTime = DateTime.Now,
- Status = 1
- };
- var result = UseTran2(() =>
- {
- // 插入用户圈子
- Insert(entity);
- // 更新圈子加入人数
- _articleCategoryService.PlusJoinNum(categoryId);
- });
-
- return result ? 1 : 0;
- }
-
- ///
- /// 删除用户加入圈子
- ///
- ///
- ///
- ///
- public int RemoveCircle(int userId, int categoryId)
- {
- var result = UseTran2(() =>
- {
- Delete(x => x.CategoryId == categoryId && x.UserId == userId);
- // 更新圈子加入人数
- _articleCategoryService.ReduceJoinNum(categoryId);
- });
-
- return result ? 1 : 0;
- }
-
- ///
- /// 是否加入
- ///
- ///
- ///
- ///
- public int IsJoin(int userId, int categoryId)
- {
- var query = Queryable()
- .Where(x => x.UserId == userId && x.CategoryId == categoryId)
- .First();
- return query == null ? 0 : 1;
- }
-
- ///
- /// 查询我的圈子
- ///
- ///
- ///
- public List GetMyJoinCircles(int userId)
- {
- var response = Queryable()
- .LeftJoin((it, c) => it.CategoryId == c.CategoryId)
- .Where((it,c) => it.UserId == userId)
- .Select((it, c) => new ArticleCategoryDto()
- {
-
- }, true)
- .ToList();
-
- return response;
- }
- #endregion
- }
-}
\ No newline at end of file
diff --git a/ZR.Service/Content/IService/IArticleCategoryService.cs b/ZR.Service/Content/IService/IArticleCategoryService.cs
deleted file mode 100644
index 50005b6..0000000
--- a/ZR.Service/Content/IService/IArticleCategoryService.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using ZR.Model.Content;
-using ZR.Model.Content.Dto;
-
-namespace ZR.Service.Content.IService
-{
- public interface IArticleCategoryService : IBaseService
- {
- PagedInfo GetList(ArticleCategoryQueryDto parm);
- List GetTreeList(ArticleCategoryQueryDto parm);
- int AddArticleCategory(ArticleCategory parm);
-
- int PlusJoinNum(int categoryId);
- int ReduceJoinNum(int categoryId);
- }
-}
diff --git a/ZR.Service/Content/IService/IArticleCommentService.cs b/ZR.Service/Content/IService/IArticleCommentService.cs
deleted file mode 100644
index e4b6cc4..0000000
--- a/ZR.Service/Content/IService/IArticleCommentService.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using ZR.Model;
-using ZR.Model.Content;
-using ZR.Model.Content.Dto;
-
-namespace ZR.Service.Content.IService
-{
- public interface IArticleCommentService
- {
- PagedInfo GetMessageList(MessageQueryDto dto);
- ArticleComment AddMessage(ArticleComment message);
- int PraiseMessage(long mid);
- int DeleteMessage(long mid, long userId);
- PagedInfo GetReplyComments(long mid, MessageQueryDto pager);
- PagedInfo GetMyMessageList(MessageQueryDto dto);
- long TopMessage(long commentId, long top);
- }
-}
diff --git a/ZR.Service/Content/IService/IArticlePraiseService.cs b/ZR.Service/Content/IService/IArticlePraiseService.cs
deleted file mode 100644
index 3319bc0..0000000
--- a/ZR.Service/Content/IService/IArticlePraiseService.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using ZR.Model.Content;
-
-namespace ZR.Service.Content.IService
-{
- public interface IArticlePraiseService : IBaseService
- {
- int Praise(ArticlePraise dto);
- int CanclePraise(long userid, long articleId);
- int PlusPraise(long pid);
- }
-}
diff --git a/ZR.Service/Content/IService/IArticleService.cs b/ZR.Service/Content/IService/IArticleService.cs
deleted file mode 100644
index f3aef2f..0000000
--- a/ZR.Service/Content/IService/IArticleService.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using ZR.Model.Content;
-using ZR.Model.Content.Dto;
-
-namespace ZR.Service.Content.IService
-{
- public interface IArticleService : IBaseService
- {
- PagedInfo GetList(ArticleQueryDto parm);
- PagedInfo GetMyList(ArticleQueryDto parm);
- ///
- /// 修改文章管理
- ///
- ///
- ///
- public int UpdateArticle(Article model);
- PagedInfo GetArticleList(ArticleQueryDto parm);
- List GetNewArticleList();
- PagedInfo GetMonentList(ArticleQueryDto parm);
- int TopArticle(Article model);
- int ChangeComment(Article model);
- int ChangeArticlePublic(Article model);
- int UpdateArticleHit(long cid);
- int PraiseArticle(long cid);
- int CancelPraise(long cid);
- Article PublishArticle(Article article);
- Article Publish(Article article);
-
- ArticleDto GetArticle(long cid, long userId);
- int Passed(long[] idsArr);
- int Reject(string reason, long[] idsArr);
- }
-}
diff --git a/ZR.Service/Content/IService/IArticleTopicService.cs b/ZR.Service/Content/IService/IArticleTopicService.cs
deleted file mode 100644
index 71665b4..0000000
--- a/ZR.Service/Content/IService/IArticleTopicService.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using ZR.Model;
-using ZR.Model.Content;
-using ZR.Model.Content.Dto;
-
-namespace ZR.Service.Content.IService
-{
- ///
- /// 文章话题service接口
- ///
- public interface IArticleTopicService : IBaseService
- {
- PagedInfo GetList(ArticleTopicQueryDto parm);
-
- ArticleTopic GetInfo(long TopicId);
-
-
- ArticleTopic AddArticleTopic(ArticleTopic parm);
- int UpdateArticleTopic(ArticleTopic parm);
-
- List GetTopicList(ArticleTopicQueryDto parm);
- PagedInfo ExportList(ArticleTopicQueryDto parm);
- }
-}
diff --git a/ZR.Service/Content/IService/IArticleUserCirclesService.cs b/ZR.Service/Content/IService/IArticleUserCirclesService.cs
deleted file mode 100644
index 681a22e..0000000
--- a/ZR.Service/Content/IService/IArticleUserCirclesService.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using ZR.Model.Content.Dto;
-using ZR.Model.Content;
-
-namespace ZR.Service.Content.IService
-{
- ///
- /// 用户加入圈子service接口
- ///
- public interface IArticleUserCirclesService : IBaseService
- {
- PagedInfo GetList(ArticleUserCirclesQueryDto parm);
-
- ArticleUserCircles GetInfo(int Id);
-
- int JoinCircle(int userId, int categoryId);
- int RemoveCircle(int userId, int categoryId);
- int IsJoin(int userId, int categoryId);
- List GetMyJoinCircles(int userId);
- }
-}
diff --git a/ZR.Service/HelloService.cs b/ZR.Service/HelloService.cs
deleted file mode 100644
index 76212cf..0000000
--- a/ZR.Service/HelloService.cs
+++ /dev/null
@@ -1,93 +0,0 @@
-using Infrastructure;
-using Infrastructure.Attribute;
-using Infrastructure.Model;
-using Microsoft.AspNetCore.Authorization;
-using Microsoft.AspNetCore.Mvc;
-using SqlSugar.IOC;
-using ZR.Admin.WebApi.Filters;
-using ZR.Model.Content;
-using ZR.Model.System;
-using ZR.Model.System.Dto;
-using ZR.Repository;
-using ZR.Service.IService;
-using ZR.ServiceCore.Services;
-
-namespace ZR.Service
-{
- ///
- /// 动态api示例,继承IDynamicApi,使用看swagger生成的地址
- ///
- [AppService(ServiceType = typeof(IHelloService), ServiceLifetime = LifeTime.Transient)]
- public class HelloService : BaseService, IHelloService, IDynamicApi
- {
- ///
- /// 引用User服务
- ///
- private readonly ISysUserService userService;
-
- ///
- ///
- ///
- ///
- public HelloService(ISysUserService userService)
- {
- this.userService = userService;
- }
- ///
- /// 数据库使用案例
- ///
- ///
- ///
- public string SayHello(string name)
- {
- //构造函数式使用
- var user = JsonConvert.SerializeObject(userService.GetFirst(f => f.UserId == 1));
- Console.WriteLine(user);
-
- var postService = App.GetRequiredService();
- Console.WriteLine(JsonConvert.SerializeObject(postService.GetId(1)));
-
- BaseRepository deptRepo = new();
- Console.WriteLine(JsonConvert.SerializeObject(deptRepo.GetId(1)));
-
- var result = DbScoped.SugarScope.Queryable().Where(f => f.DictId == 1).First();
- Console.WriteLine(JsonConvert.SerializeObject(result));
-
- //切换库
- //DbScoped.SugarScope.GetConnectionScope(2);
-
- GetFirst(x => x.CategoryId == 1);
- Context.Queryable().First(f => f.UserId == 1);
-
- return "Hello:" + name;
- }
-
- ///
- /// 返回json内容
- ///
- ///
- ///
- [Verify]
- public ApiResult SayHello2([FromBody]SysUserDto userDto)
- {
- var user = userService.GetFirst(f => f.UserId == 2);
- return new ApiResult(100, "success", user);
- }
-
- public ApiResult SayHello3()
- {
- throw new CustomException("自定义异常");
- }
-
- ///
- /// 返回json内容
- ///
- ///
- ///
- [AllowAnonymous]
- public ApiResult SayHelloJson([FromBody] SysUserDto userDto)
- {
- return new ApiResult(100, "success", userDto);
- }
- }
-}
diff --git a/ZR.Service/IService/IHelloService.cs b/ZR.Service/IService/IHelloService.cs
deleted file mode 100644
index a3a6588..0000000
--- a/ZR.Service/IService/IHelloService.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using Infrastructure.Model;
-using Microsoft.AspNetCore.Mvc;
-using ZR.Model.Content;
-using ZR.Model.System.Dto;
-
-namespace ZR.Service.IService
-{
- ///
- /// Hello接口
- ///
- public interface IHelloService : IBaseService
- {
- ///
- ///
- ///
- ///
- ///
- string SayHello(string name);
- ApiResult SayHello2([FromBody] SysUserDto userDto);
- ApiResult SayHello3();
- ApiResult SayHelloJson([FromBody] SysUserDto userDto);
- }
-}
diff --git a/ZR.Service/Public/BannerConfigService.cs b/ZR.Service/Public/BannerConfigService.cs
deleted file mode 100644
index 068d135..0000000
--- a/ZR.Service/Public/BannerConfigService.cs
+++ /dev/null
@@ -1,122 +0,0 @@
-using Infrastructure.Attribute;
-using Mapster;
-using ZR.Model.Public;
-using ZR.Model.Public.Dto;
-using ZR.Repository;
-using ZR.Service.Public.IPublicService;
-
-namespace ZR.Service.Public
-{
- ///
- /// 广告管理Service业务层处理
- ///
- [AppService(ServiceType = typeof(IBannerConfigService), ServiceLifetime = LifeTime.Transient)]
- public class BannerConfigService : BaseService, IBannerConfigService
- {
- ///
- /// 查询广告管理列表
- ///
- ///
- ///
- public PagedInfo GetList(BannerConfigQueryDto parm)
- {
- var predicate = QueryExp(parm);
-
- var response = Queryable()
- .Where(predicate.ToExpression())
- .ToPage(parm);
-
- return response;
- }
-
- ///
- /// 获取详情
- ///
- ///
- ///
- public BannerConfig GetInfo(int Id)
- {
- var response = Queryable()
- .Where(x => x.Id == Id)
- .First();
-
- return response;
- }
-
- ///
- /// 添加广告管理
- ///
- ///
- ///
- public BannerConfig AddBannerConfig(BannerConfig model)
- {
- return Insertable(model).ExecuteReturnEntity();
- }
-
- ///
- /// 修改广告管理
- ///
- ///
- ///
- public int UpdateBannerConfig(BannerConfig model)
- {
- return Update(model, false, "修改广告管理");
- }
-
- ///
- /// 导出广告管理
- ///
- ///
- ///
- public PagedInfo ExportList(BannerConfigQueryDto parm)
- {
- var predicate = QueryExp(parm);
-
- var response = Queryable()
- .Where(predicate.ToExpression())
- .Select((it) => new BannerConfigDto()
- {
- ShowStatusLabel = it.ShowStatus.GetConfigValue("sys_common_status"),
- }, true)
- .ToPage(parm);
-
- return response;
- }
-
- ///
- /// 查询导出表达式
- ///
- ///
- ///
- private static Expressionable QueryExp(BannerConfigQueryDto parm)
- {
- var predicate = Expressionable.Create();
-
- predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.Title), it => it.Title.Contains(parm.Title));
- predicate = predicate.AndIF(parm.JumpType != null, it => it.JumpType == parm.JumpType);
- predicate = predicate.AndIF(parm.ShowStatus != null, it => it.ShowStatus == parm.ShowStatus);
- predicate = predicate.AndIF(parm.AdType != null, it => it.AdType == parm.AdType);
- return predicate;
- }
-
- ///
- /// 查询广告管理列表
- ///
- ///
- ///
- public List GetBannerList(BannerConfigQueryDto parm)
- {
- var predicate = Expressionable.Create();
- var now = DateTime.Now;
- predicate = predicate.And(it => it.ShowStatus == 0);
- predicate = predicate.AndIF(parm.AdType != null, it => it.AdType == parm.AdType);
- predicate = predicate.And(it => it.BeginTime <= now && it.EndTime >= now);
-
- var response = Queryable()
- .Where(predicate.ToExpression())
- .ToList();
-
- return response.Adapt>();
- }
- }
-}
\ No newline at end of file
diff --git a/ZR.Service/Public/IPublicService/IBannerConfigService.cs b/ZR.Service/Public/IPublicService/IBannerConfigService.cs
deleted file mode 100644
index 8bce109..0000000
--- a/ZR.Service/Public/IPublicService/IBannerConfigService.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using ZR.Model.Public.Dto;
-using ZR.Model.Public;
-
-namespace ZR.Service.Public.IPublicService
-{
- ///
- /// 广告管理service接口
- ///
- public interface IBannerConfigService : IBaseService
- {
- PagedInfo GetList(BannerConfigQueryDto parm);
-
- BannerConfig GetInfo(int Id);
-
- BannerConfig AddBannerConfig(BannerConfig parm);
- int UpdateBannerConfig(BannerConfig parm);
-
- List GetBannerList(BannerConfigQueryDto parm);
- PagedInfo ExportList(BannerConfigQueryDto parm);
- }
-}
diff --git a/ZR.Service/Social/IService/ISocialFansInfoService.cs b/ZR.Service/Social/IService/ISocialFansInfoService.cs
deleted file mode 100644
index c93b36f..0000000
--- a/ZR.Service/Social/IService/ISocialFansInfoService.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using ZR.Model.social;
-
-namespace ZR.Service.Social.IService
-{
- public interface ISocialFansInfoService : IBaseService
- {
- }
-}
diff --git a/ZR.Service/Social/IService/ISocialFansService.cs b/ZR.Service/Social/IService/ISocialFansService.cs
deleted file mode 100644
index dc022fb..0000000
--- a/ZR.Service/Social/IService/ISocialFansService.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using ZR.Model.social;
-
-namespace ZR.Service.Social.IService
-{
- public interface ISocialFansService : IBaseService
- {
- }
-}
diff --git a/ZR.Service/Social/SocialFansInfoService.cs b/ZR.Service/Social/SocialFansInfoService.cs
deleted file mode 100644
index 7b811a0..0000000
--- a/ZR.Service/Social/SocialFansInfoService.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using Infrastructure.Attribute;
-using ZR.Model.social;
-using ZR.Service.Social.IService;
-
-namespace ZR.Service.Social
-{
- [AppService(ServiceType = typeof(ISocialFansInfoService), ServiceLifetime = LifeTime.Transient)]
- public class SocialFansInfoService : BaseService, ISocialFansInfoService
- {
- }
-}
diff --git a/ZR.Service/Social/SocialFansService.cs b/ZR.Service/Social/SocialFansService.cs
deleted file mode 100644
index 6df21a6..0000000
--- a/ZR.Service/Social/SocialFansService.cs
+++ /dev/null
@@ -1,191 +0,0 @@
-using Infrastructure;
-using Infrastructure.Attribute;
-using Infrastructure.Extensions;
-using Infrastructure.Model;
-using Microsoft.AspNetCore.Mvc;
-using ZR.Model.Content.Dto;
-using ZR.Model.social;
-using ZR.Model.System;
-using ZR.Repository;
-using ZR.Service.Social.IService;
-
-namespace ZR.Service.Social
-{
- ///
- /// 粉丝
- ///
- [AppService(ServiceType = typeof(ISocialFansService))]
- public class SocialFansService : BaseService, ISocialFansService, IDynamicApi
- {
- ///
- /// 查询关注/粉丝列表
- ///
- ///
- ///
- [HttpGet]
- public ApiResult FollowList([FromQuery] FansQueryDto dto)
- {
- var userid = (int)HttpContextExtension.GetUId(App.HttpContext);
- PagedInfo list = dto.SelectType == 1 ? GetFollow(dto, userid) : GetFans(dto, userid);
-
- return ApiResult.Success(list);
- }
-
- ///
- /// 是否关注
- ///
- ///
- ///
- public ApiResult IsFollow([FromQuery] int toUserid)
- {
- var userid = (int)HttpContextExtension.GetUId(App.HttpContext);
- if (userid == toUserid || toUserid <= 0)
- {
- return ApiResult.Success("");
- }
- var isFollow = Any(f => f.Userid == userid && f.ToUserid == toUserid);
-
- return ApiResult.Success(isFollow);
- }
-
- ///
- /// 关注
- ///
- ///
- ///
- [HttpPost]
- public ApiResult Follow([FromBody] SocialFansDto dto)
- {
- dto.Userid = (int)HttpContextExtension.GetUId(App.HttpContext);
- if (dto.Userid == dto.ToUserid)
- {
- throw new CustomException("不能关注自己");
- };
- if (dto.ToUserid <= 0)
- {
- return ApiResult.Error("关注失败");
- }
- //TODO 判断用户是否存在
-
- var isFollow = GetFirst(x => x.Userid == dto.Userid && x.ToUserid == dto.ToUserid);
- if (isFollow != null)
- {
- throw new CustomException("已关注");
- }
- var fans = new SocialFans
- {
- Userid = dto.Userid,
- ToUserid = dto.ToUserid,
- FollowTime = DateTime.Now,
- UserIP = HttpContextExtension.GetClientUserIp(App.HttpContext)
- };
- var result = UseTran2(() =>
- {
- //添加粉丝
- InsertReturnSnowflakeId(fans);
-
- UpdateFollowInfo(dto.Userid, isFollowNum: true);
- UpdateFollowInfo(dto.ToUserid, isFollowNum: false);
- });
-
- if (!result)
- {
- return ApiResult.Error("关注失败");
- }
- var data = Context.Queryable()
- .Where(x => x.Userid == dto.Userid)
- .First();
- return ApiResult.Success("关注成功", data);
- }
-
- ///
- /// 取消关注
- ///
- ///
- ///
- [HttpPost]
- public ApiResult CancelFollow([FromBody] SocialFansDto dto)
- {
- dto.Userid = (int)HttpContextExtension.GetUId(App.HttpContext);
- var result = UseTran(() =>
- {
- //删除粉丝
- Delete(f => f.Userid == dto.Userid && f.ToUserid == dto.ToUserid);
-
- Context.Updateable()
- .SetColumns(x => x.FollowNum == x.FollowNum - 1)
- .Where(x => x.Userid == dto.Userid)
- .ExecuteCommand();
-
- Context.Updateable()
- .SetColumns(x => x.FansNum == x.FansNum - 1)
- .Where(x => x.Userid == dto.ToUserid)
- .ExecuteCommand();
- });
-
- if (!result.IsSuccess)
- {
- return ApiResult.Error("取消关注失败");
- }
- var data = Context.Queryable()
- .Where(x => x.Userid == dto.Userid)
- .First();
- return ApiResult.Success("取消关注成功", data);
- }
-
- private void UpdateFollowInfo(long userId, bool isFollowNum)
- {
- var count = Context.Updateable()
- .SetColumnsIF(isFollowNum, x => x.FollowNum == x.FollowNum + 1)
- .SetColumnsIF(!isFollowNum, x => x.FansNum == x.FansNum + 1)
- .Where(x => x.Userid == userId)
- .ExecuteCommand();
-
- if (count > 0) return;
-
- Context.Insertable(new SocialFansInfo
- {
- Userid = userId,
- FollowNum = isFollowNum ? 1 : 0,
- FansNum = isFollowNum ? 0 : 1,
- UpdateTime = DateTime.Now
- }).ExecuteCommand();
- }
-
- private PagedInfo GetFollow(FansQueryDto dto, int userid)
- {
- return Queryable()
- .LeftJoin((it, u) => it.ToUserid == u.UserId)
- .Where(it => it.Userid == userid)
- .Select((it, u) => new SocialFansDto()
- {
- User = new ArticleUser()
- {
- Avatar = u.Avatar,
- NickName = u.NickName,
- Sex = u.Sex,
- },
- Status = 1,
- ToUserid = it.ToUserid,
- })
- .ToPage(dto);
- }
- private PagedInfo GetFans(FansQueryDto dto, int userid)
- {
- return Queryable()
- .LeftJoin((it, u) => it.Userid == u.UserId)
- .Where(it => it.ToUserid == userid)
- .Select((it, u) => new SocialFansDto()
- {
- User = new ArticleUser()
- {
- Avatar = u.Avatar,
- NickName = u.NickName,
- Sex = u.Sex,
- },
- Userid = it.Userid,
- })
- .ToPage(dto);
- }
- }
-}
diff --git a/ZR.Service/ZR.Service.csproj b/ZR.Service/ZR.Service.csproj
index 35209bc..c4b32ce 100644
--- a/ZR.Service/ZR.Service.csproj
+++ b/ZR.Service/ZR.Service.csproj
@@ -11,5 +11,8 @@
+
+
+
diff --git a/ZR.ServiceCore/Services/SeedDataService.cs b/ZR.ServiceCore/Services/SeedDataService.cs
index 07c9e56..e90ae82 100644
--- a/ZR.ServiceCore/Services/SeedDataService.cs
+++ b/ZR.ServiceCore/Services/SeedDataService.cs
@@ -184,40 +184,9 @@ namespace ZR.ServiceCore.Services
return (msg, x.ErrorList, x.IgnoreList);
}
- ///
- /// 文章目录
- ///
- ///
- ///
- public (string, object, object) InitArticleCategoryData(List data)
- {
- var db = DbScoped.SugarScope;
- var x = db.Storageable(data)
- //.SplitInsert(it => it.NotAny())
- .WhereColumns(it => it.Name)
- .ToStorage();
- x.AsInsertable.ExecuteCommand();
- x.AsUpdateable.ExecuteCommand();
- string msg = $"[文章目录] 插入{x.InsertList.Count} 更新{x.UpdateList.Count} 错误{x.ErrorList.Count} 总共{x.TotalList.Count}";
- return (msg, x.ErrorList, x.IgnoreList);
- }
- ///
- /// 文章话题
- ///
- ///
- ///
- public (string, object, object) InitArticleTopicData(List data)
- {
- var db = DbScoped.SugarScope;
- var x = db.Storageable(data)
- .WhereColumns(it => it.TopicName)
- .ToStorage();
- x.AsInsertable.ExecuteCommand();
- x.AsUpdateable.ExecuteCommand();
- string msg = $"[文章话题] 插入{x.InsertList.Count} 更新{x.UpdateList.Count} 错误{x.ErrorList.Count} 总共{x.TotalList.Count}";
- return (msg, x.ErrorList, x.IgnoreList);
- }
+
+
///
/// 任务
@@ -321,13 +290,6 @@ namespace ZR.ServiceCore.Services
var result10 = InitDeptData(sysDept);
result.Add(result10.Item1);
- var sysArticleCategory = MiniExcel.Query(path, sheetName: "article_category").ToList();
- var result11 = InitArticleCategoryData(sysArticleCategory);
- result.Add(result11.Item1);
-
- var sysArticleTopic = MiniExcel.Query(path, sheetName: "article_topic").ToList();
- var result13 = InitArticleTopicData(sysArticleTopic);
- result.Add(result13.Item1);
var sysNotice = MiniExcel.Query(path, sheetName: "notice").ToList();
var result12 = InitNoticeData(sysNotice);
diff --git a/ZR.ServiceCore/SqlSugar/InitTable.cs b/ZR.ServiceCore/SqlSugar/InitTable.cs
index 8aa4bb4..4527ce4 100644
--- a/ZR.ServiceCore/SqlSugar/InitTable.cs
+++ b/ZR.ServiceCore/SqlSugar/InitTable.cs
@@ -3,7 +3,7 @@ using ZR.Model;
using ZR.Model.Content;
using ZR.Model.Models;
using ZR.Model.Public;
-using ZR.Model.social;
+
using ZR.Model.System;
using ZR.Model.System.Generate;
using ZR.Model.System.Model;
@@ -55,12 +55,7 @@ namespace ZR.ServiceCore.SqlSugar
db.CodeFirst.InitTables(typeof(EmailTpl));
db.CodeFirst.InitTables(typeof(SmsCodeLog));
db.CodeFirst.InitTables(typeof(EmailLog));
- db.CodeFirst.InitTables(typeof(Article));
- db.CodeFirst.InitTables(typeof(ArticleCategory));
- db.CodeFirst.InitTables(typeof(ArticleBrowsingLog));
- db.CodeFirst.InitTables(typeof(ArticlePraise));
- db.CodeFirst.InitTables(typeof(ArticleComment));
- db.CodeFirst.InitTables(typeof(ArticleTopic));
+
db.CodeFirst.InitTables(typeof(BannerConfig));
db.CodeFirst.InitTables(typeof(SysUserMsg));
db.CodeFirst.InitTables(typeof(SysFileGroup));