33
This commit is contained in:
parent
8ec93dd42f
commit
45cb674557
|
|
@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 文章目录Controller
|
|
||||||
/// </summary>
|
|
||||||
[Route("article/ArticleCategory")]
|
|
||||||
[ApiExplorerSettings(GroupName = "article")]
|
|
||||||
public class ArticleCategoryController : BaseController
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 文章目录接口
|
|
||||||
/// </summary>
|
|
||||||
private readonly IArticleCategoryService _ArticleCategoryService;
|
|
||||||
|
|
||||||
public ArticleCategoryController(IArticleCategoryService ArticleCategoryService)
|
|
||||||
{
|
|
||||||
_ArticleCategoryService = ArticleCategoryService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询文章目录列表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parm"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet("list")]
|
|
||||||
[AllowAnonymous]
|
|
||||||
public IActionResult QueryArticleCategory([FromQuery] ArticleCategoryQueryDto parm)
|
|
||||||
{
|
|
||||||
var response = _ArticleCategoryService.GetList(parm);
|
|
||||||
return SUCCESS(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询文章目录列表树
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parm"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet("treeList")]
|
|
||||||
[AllowAnonymous]
|
|
||||||
public IActionResult QueryTreeArticleCategory([FromQuery] ArticleCategoryQueryDto parm)
|
|
||||||
{
|
|
||||||
var response = _ArticleCategoryService.GetTreeList(parm);
|
|
||||||
return SUCCESS(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询文章目录详情
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="CategoryId"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet("{CategoryId}")]
|
|
||||||
[AllowAnonymous]
|
|
||||||
//[ActionPermissionFilter(Permission = "articlecategory:query")]
|
|
||||||
public IActionResult GetArticleCategory(int CategoryId)
|
|
||||||
{
|
|
||||||
var response = _ArticleCategoryService.GetFirst(x => x.CategoryId == CategoryId);
|
|
||||||
|
|
||||||
return SUCCESS(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询目录分类
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="categoryType"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet("type{categoryType}")]
|
|
||||||
//[ActionPermissionFilter(Permission = "articlecategory:query")]
|
|
||||||
public IActionResult GetArticleCategoryByType(int categoryType)
|
|
||||||
{
|
|
||||||
var response = _ArticleCategoryService.GetFirst(x => x.CategoryType == categoryType);
|
|
||||||
|
|
||||||
return SUCCESS(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 添加文章目录
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost]
|
|
||||||
[ActionPermissionFilter(Permission = "articlecategory:add")]
|
|
||||||
[Log(Title = "文章目录", BusinessType = BusinessType.INSERT)]
|
|
||||||
public IActionResult AddArticleCategory([FromBody] ArticleCategoryDto parm)
|
|
||||||
{
|
|
||||||
var modal = parm.Adapt<ArticleCategory>().ToCreate(HttpContext);
|
|
||||||
var response = _ArticleCategoryService.AddArticleCategory(modal);
|
|
||||||
|
|
||||||
return ToResponse(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 更新文章目录
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPut]
|
|
||||||
[ActionPermissionFilter(Permission = "articlecategory:edit")]
|
|
||||||
[Log(Title = "文章目录", BusinessType = BusinessType.UPDATE)]
|
|
||||||
public IActionResult UpdateArticleCategory([FromBody] ArticleCategoryDto parm)
|
|
||||||
{
|
|
||||||
var modal = parm.Adapt<ArticleCategory>().ToUpdate(HttpContext);
|
|
||||||
var response = _ArticleCategoryService.Update(modal);
|
|
||||||
|
|
||||||
return ToResponse(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 删除文章目录
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 导出文章目录
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[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 });
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取文章目录
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet("CategoryList")]
|
|
||||||
public IActionResult CategoryList()
|
|
||||||
{
|
|
||||||
var response = _ArticleCategoryService.GetAll();
|
|
||||||
return SUCCESS(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 保存排序
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="id"></param>
|
|
||||||
/// <param name="value"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 内容管理
|
|
||||||
/// </summary>
|
|
||||||
[Route("article")]
|
|
||||||
[ApiExplorerSettings(GroupName = "article")]
|
|
||||||
public class ArticleController : BaseController
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 文章接口
|
|
||||||
/// </summary>
|
|
||||||
private readonly IArticleService _ArticleService;
|
|
||||||
private readonly IArticleCategoryService _ArticleCategoryService;
|
|
||||||
|
|
||||||
public ArticleController(
|
|
||||||
IArticleService ArticleService,
|
|
||||||
IArticleCategoryService articleCategoryService)
|
|
||||||
{
|
|
||||||
_ArticleService = ArticleService;
|
|
||||||
_ArticleCategoryService = articleCategoryService;
|
|
||||||
_ArticleService = ArticleService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询文章列表
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet("list")]
|
|
||||||
[ActionPermissionFilter(Permission = "system:article:list")]
|
|
||||||
public IActionResult Query([FromQuery] ArticleQueryDto parm)
|
|
||||||
{
|
|
||||||
var response = _ArticleService.GetList(parm);
|
|
||||||
|
|
||||||
return SUCCESS(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 内容批量审核通过
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[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));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 内容批量审核拒绝
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询我的文章列表
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet("mylist")]
|
|
||||||
public IActionResult QueryMyList([FromQuery] ArticleQueryDto parm)
|
|
||||||
{
|
|
||||||
parm.UserId = HttpContext.GetUId();
|
|
||||||
var response = _ArticleService.GetMyList(parm);
|
|
||||||
|
|
||||||
return SUCCESS(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询文章详情
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="id"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 发布文章
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost("add")]
|
|
||||||
[ActionPermissionFilter(Permission = "system:article:add")]
|
|
||||||
//[Log(Title = "发布文章", BusinessType = BusinessType.INSERT)]
|
|
||||||
public IActionResult Publish([FromBody] ArticleDto parm)
|
|
||||||
{
|
|
||||||
var addModel = parm.Adapt<Article>().ToCreate(context: HttpContext);
|
|
||||||
|
|
||||||
return SUCCESS(_ArticleService.PublishArticle(addModel));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 更新文章
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[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<Article>().ToUpdate(HttpContext);
|
|
||||||
var response = _ArticleService.UpdateArticle(modal);
|
|
||||||
|
|
||||||
return SUCCESS(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 置顶
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是否公开
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 删除文章
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 文章话题
|
|
||||||
/// </summary>
|
|
||||||
[ApiExplorerSettings(GroupName = "article")]
|
|
||||||
[Route("article/ArticleTopic")]
|
|
||||||
public class ArticleTopicController : BaseController
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 文章话题接口
|
|
||||||
/// </summary>
|
|
||||||
private readonly IArticleTopicService _ArticleTopicService;
|
|
||||||
|
|
||||||
public ArticleTopicController(IArticleTopicService ArticleTopicService)
|
|
||||||
{
|
|
||||||
_ArticleTopicService = ArticleTopicService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询文章话题列表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parm"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet("list")]
|
|
||||||
[ActionPermissionFilter(Permission = "articletopic:list")]
|
|
||||||
public IActionResult QueryArticleTopic([FromQuery] ArticleTopicQueryDto parm)
|
|
||||||
{
|
|
||||||
var response = _ArticleTopicService.GetList(parm);
|
|
||||||
return SUCCESS(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询文章话题详情
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="TopicId"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet("{TopicId}")]
|
|
||||||
[ActionPermissionFilter(Permission = "articletopic:query")]
|
|
||||||
public IActionResult GetArticleTopic(long TopicId)
|
|
||||||
{
|
|
||||||
var response = _ArticleTopicService.GetInfo(TopicId);
|
|
||||||
|
|
||||||
var info = response.Adapt<ArticleTopicDto>();
|
|
||||||
return SUCCESS(info);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 添加文章话题
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost]
|
|
||||||
[ActionPermissionFilter(Permission = "articletopic:add")]
|
|
||||||
[Log(Title = "文章话题", BusinessType = BusinessType.INSERT)]
|
|
||||||
public IActionResult AddArticleTopic([FromBody] ArticleTopicDto parm)
|
|
||||||
{
|
|
||||||
var modal = parm.Adapt<ArticleTopic>().ToCreate(HttpContext);
|
|
||||||
|
|
||||||
var response = _ArticleTopicService.AddArticleTopic(modal);
|
|
||||||
|
|
||||||
return SUCCESS(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 更新文章话题
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPut]
|
|
||||||
[ActionPermissionFilter(Permission = "articletopic:edit")]
|
|
||||||
[Log(Title = "文章话题", BusinessType = BusinessType.UPDATE)]
|
|
||||||
public IActionResult UpdateArticleTopic([FromBody] ArticleTopicDto parm)
|
|
||||||
{
|
|
||||||
var modal = parm.Adapt<ArticleTopic>().ToUpdate(HttpContext);
|
|
||||||
var response = _ArticleTopicService.UpdateArticleTopic(modal);
|
|
||||||
|
|
||||||
return ToResponse(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 删除文章话题
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpDelete("delete/{ids}")]
|
|
||||||
[ActionPermissionFilter(Permission = "articletopic:delete")]
|
|
||||||
[Log(Title = "文章话题", BusinessType = BusinessType.DELETE)]
|
|
||||||
public IActionResult DeleteArticleTopic([FromRoute] string ids)
|
|
||||||
{
|
|
||||||
var idArr = Tools.SplitAndConvert<long>(ids);
|
|
||||||
|
|
||||||
return ToResponse(_ArticleTopicService.Delete(idArr));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 导出文章话题
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 内容管理前端接口
|
|
||||||
/// </summary>
|
|
||||||
[Route("front/article")]
|
|
||||||
[ApiExplorerSettings(GroupName = "article")]
|
|
||||||
public class FrontArticleController : BaseController
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 文章接口
|
|
||||||
/// </summary>
|
|
||||||
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;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="ArticleService"></param>
|
|
||||||
/// <param name="articleCategoryService"></param>
|
|
||||||
/// <param name="articlePraiseService"></param>
|
|
||||||
/// <param name="sysUserService"></param>
|
|
||||||
/// <param name="articleTopicService"></param>
|
|
||||||
/// <param name="articleUserCirclesService"></param>
|
|
||||||
/// <param name="fansInfoService"></param>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 前台查询文章列表
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet("homeList")]
|
|
||||||
[AllowAnonymous]
|
|
||||||
public IActionResult QueryHomeList([FromQuery] ArticleQueryDto parm)
|
|
||||||
{
|
|
||||||
parm.UserId = HttpContext.GetUId();
|
|
||||||
var response = _ArticleService.GetArticleList(parm);
|
|
||||||
|
|
||||||
return SUCCESS(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询最新文章列表
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet("newList")]
|
|
||||||
[AllowAnonymous]
|
|
||||||
public IActionResult QueryNew()
|
|
||||||
{
|
|
||||||
return SUCCESS(_ArticleService.GetNewArticleList());
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 点赞
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="id"></param>
|
|
||||||
/// <param name="authorId"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[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));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 置顶
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPut("top")]
|
|
||||||
[ActionPermissionFilter(Permission = "common")]
|
|
||||||
public IActionResult Top([FromBody] Article parm)
|
|
||||||
{
|
|
||||||
var response = _ArticleService.TopArticle(parm);
|
|
||||||
|
|
||||||
return SUCCESS(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 修改可见范围
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 修改评论权限
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 删除
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询文章详情
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="id"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 前台查询话题
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parm"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet("topicList")]
|
|
||||||
[AllowAnonymous]
|
|
||||||
public IActionResult QueryTopicList([FromQuery] ArticleTopicQueryDto parm)
|
|
||||||
{
|
|
||||||
var response = _ArticleTopicService.GetTopicList(parm);
|
|
||||||
|
|
||||||
return SUCCESS(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询文章话题详情
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="TopicId"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[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<ArticleTopicDto>();
|
|
||||||
return SUCCESS(info);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询文章目录详情
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="CategoryId"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[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<CircleInfoDto>();
|
|
||||||
if (infoDto != null)
|
|
||||||
{
|
|
||||||
infoDto.IsJoin = _ArticleUserCirclesService.IsJoin((int)userId, CategoryId);
|
|
||||||
}
|
|
||||||
return SUCCESS(infoDto);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 发布文章
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost("publish")]
|
|
||||||
[ActionPermissionFilter(Permission = "common")]
|
|
||||||
public IActionResult Create([FromBody] ArticleDto parm)
|
|
||||||
{
|
|
||||||
if (parm == null) { return ToResponse(ResultCode.PARAM_ERROR); }
|
|
||||||
var addModel = parm.Adapt<Article>().ToCreate(context: HttpContext);
|
|
||||||
addModel.ArticleType = Model.Enum.ArticleTypeEnum.Article;
|
|
||||||
addModel.Tags = parm.TopicName;
|
|
||||||
return SUCCESS(_ArticleService.Publish(addModel));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取我的成就信息
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[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 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 评论
|
|
||||||
/// </summary>
|
|
||||||
[Route("front/comment")]
|
|
||||||
[ApiExplorerSettings(GroupName = "article")]
|
|
||||||
[ApiController]
|
|
||||||
public class FrontCommentController : BaseController
|
|
||||||
{
|
|
||||||
private readonly IArticleCommentService messageService;
|
|
||||||
private readonly IArticleService articleService;
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="messageService"></param>
|
|
||||||
/// <param name="articleService"></param>
|
|
||||||
public FrontCommentController(
|
|
||||||
IArticleCommentService messageService, IArticleService articleService)
|
|
||||||
{
|
|
||||||
this.messageService = messageService;
|
|
||||||
this.articleService = articleService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询评论列表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parm"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet("list")]
|
|
||||||
[AllowAnonymous]
|
|
||||||
public IActionResult QueryList([FromQuery] MessageQueryDto parm)
|
|
||||||
{
|
|
||||||
parm.PageSize = 10;
|
|
||||||
PagedInfo<ArticleCommentDto>? response;
|
|
||||||
//查询二级评论
|
|
||||||
if (parm.CommentId > 0)
|
|
||||||
{
|
|
||||||
response = messageService.GetReplyComments(parm.CommentId, parm);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
response = messageService.GetMessageList(parm);
|
|
||||||
}
|
|
||||||
|
|
||||||
return SUCCESS(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 评论
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[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<ArticleComment>().ToCreate(context: HttpContext);
|
|
||||||
addModel.UserIP = HttpContextExtension.GetClientUserIp(HttpContext);
|
|
||||||
addModel.UserId = uid;
|
|
||||||
return SUCCESS(messageService.AddMessage(addModel).Adapt<ArticleCommentDto>());
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 评论点赞
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dto"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[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));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 评论删除
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="mid"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[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));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询我的评论列表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parm"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet("mylist")]
|
|
||||||
public IActionResult QueryMyCommentList([FromQuery] MessageQueryDto parm)
|
|
||||||
{
|
|
||||||
PagedInfo<ArticleCommentDto> response = messageService.GetMyMessageList(parm);
|
|
||||||
|
|
||||||
return SUCCESS(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 评论置顶
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,64 +0,0 @@
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using ZR.Service.Content.IService;
|
|
||||||
|
|
||||||
//创建时间:2025-04-07
|
|
||||||
namespace ZR.Admin.WebApi.Controllers
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 用户加入圈子
|
|
||||||
/// </summary>
|
|
||||||
[Route("front/circles")]
|
|
||||||
[ApiExplorerSettings(GroupName = "userCircle")]
|
|
||||||
[ApiController]
|
|
||||||
public class ArticleUserCirclesController : BaseController
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 用户加入圈子接口
|
|
||||||
/// </summary>
|
|
||||||
private readonly IArticleUserCirclesService _ArticleUserCirclesService;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="ArticleUserCirclesService"></param>
|
|
||||||
public ArticleUserCirclesController(
|
|
||||||
IArticleUserCirclesService ArticleUserCirclesService)
|
|
||||||
{
|
|
||||||
_ArticleUserCirclesService = ArticleUserCirclesService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询用户加入圈子列表
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet("myCircleList")]
|
|
||||||
public IActionResult QueryArticleUserCircles()
|
|
||||||
{
|
|
||||||
var userId = HttpContext.GetUId();
|
|
||||||
var response = _ArticleUserCirclesService.GetMyJoinCircles((int)userId);
|
|
||||||
return SUCCESS(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 用户加入圈子
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost("join/{id}")]
|
|
||||||
public IActionResult JoinCircles([FromRoute] int id)
|
|
||||||
{
|
|
||||||
var userId = HttpContext.GetUId();
|
|
||||||
return ToResponse(_ArticleUserCirclesService.JoinCircle((int)userId, id));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 删除用户加入圈子
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost("delete/{id}")]
|
|
||||||
public IActionResult DeleteCircles([FromRoute] int id)
|
|
||||||
{
|
|
||||||
var userId = HttpContext.GetUId();
|
|
||||||
return ToResponse(_ArticleUserCirclesService.RemoveCircle((int)userId, id));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 动态接口
|
|
||||||
/// </summary>
|
|
||||||
private readonly IArticleService _ArticleService;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="ArticleService"></param>
|
|
||||||
public MomentsController(
|
|
||||||
IArticleService ArticleService)
|
|
||||||
{
|
|
||||||
_ArticleService = ArticleService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询我的(后台)
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询动态列表
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[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));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 动态发布
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost("publishMoment")]
|
|
||||||
[ActionPermissionFilter(Permission = "common")]
|
|
||||||
public IActionResult PublishMoment([FromBody] ArticleDto parm)
|
|
||||||
{
|
|
||||||
if (parm == null) { return ToResponse(ResultCode.PARAM_ERROR); }
|
|
||||||
var addModel = parm.Adapt<Article>().ToCreate(context: HttpContext);
|
|
||||||
addModel.Tags = parm.TopicName;
|
|
||||||
addModel.ArticleType = ArticleTypeEnum.Monent;
|
|
||||||
|
|
||||||
return SUCCESS(_ArticleService.Publish(addModel));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 动态信息
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[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 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 广告管理
|
|
||||||
/// </summary>
|
|
||||||
[Route("public/BannerConfig")]
|
|
||||||
public class BannerConfigController : BaseController
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 广告管理接口
|
|
||||||
/// </summary>
|
|
||||||
private readonly IBannerConfigService _BannerConfigService;
|
|
||||||
|
|
||||||
public BannerConfigController(IBannerConfigService BannerConfigService)
|
|
||||||
{
|
|
||||||
_BannerConfigService = BannerConfigService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询广告管理列表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parm"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet("list")]
|
|
||||||
[ActionPermissionFilter(Permission = "bannerconfig:list")]
|
|
||||||
public IActionResult QueryBannerConfig([FromQuery] BannerConfigQueryDto parm)
|
|
||||||
{
|
|
||||||
var response = _BannerConfigService.GetList(parm);
|
|
||||||
return SUCCESS(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询广告管理详情
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="Id"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet("{Id}")]
|
|
||||||
[ActionPermissionFilter(Permission = "bannerconfig:query")]
|
|
||||||
public IActionResult GetBannerConfig(int Id)
|
|
||||||
{
|
|
||||||
var response = _BannerConfigService.GetInfo(Id);
|
|
||||||
|
|
||||||
var info = response.Adapt<BannerConfigDto>();
|
|
||||||
return SUCCESS(info);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 添加广告管理
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost]
|
|
||||||
[ActionPermissionFilter(Permission = "bannerconfig:add")]
|
|
||||||
[Log(Title = "广告管理", BusinessType = BusinessType.INSERT)]
|
|
||||||
public IActionResult AddBannerConfig([FromBody] BannerConfigDto parm)
|
|
||||||
{
|
|
||||||
var modal = parm.Adapt<BannerConfig>().ToCreate(HttpContext);
|
|
||||||
|
|
||||||
var response = _BannerConfigService.AddBannerConfig(modal);
|
|
||||||
|
|
||||||
return SUCCESS(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 更新广告管理
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPut]
|
|
||||||
[ActionPermissionFilter(Permission = "bannerconfig:edit")]
|
|
||||||
[Log(Title = "广告管理", BusinessType = BusinessType.UPDATE)]
|
|
||||||
public IActionResult UpdateBannerConfig([FromBody] BannerConfigDto parm)
|
|
||||||
{
|
|
||||||
var modal = parm.Adapt<BannerConfig>();
|
|
||||||
var response = _BannerConfigService.UpdateBannerConfig(modal);
|
|
||||||
|
|
||||||
return ToResponse(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 删除广告管理
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpDelete("delete/{ids}")]
|
|
||||||
[ActionPermissionFilter(Permission = "bannerconfig:delete")]
|
|
||||||
[Log(Title = "广告管理", BusinessType = BusinessType.DELETE)]
|
|
||||||
public IActionResult DeleteBannerConfig([FromRoute] string ids)
|
|
||||||
{
|
|
||||||
var idArr = Tools.SplitAndConvert<int>(ids);
|
|
||||||
|
|
||||||
return ToResponse(_BannerConfigService.Delete(idArr, "删除广告管理"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 导出广告管理
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 保存排序
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="id">主键</param>
|
|
||||||
/// <param name="value">排序值</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询广告管理列表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parm"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet("bannerList")]
|
|
||||||
[AllowAnonymous]
|
|
||||||
public IActionResult QueryBannerList([FromQuery] BannerConfigQueryDto parm)
|
|
||||||
{
|
|
||||||
var response = _BannerConfigService.GetBannerList(parm);
|
|
||||||
return SUCCESS(new { list = response });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -34,6 +34,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Folder Include="Controllers\Public\" />
|
||||||
<Folder Include="Controllers\WebApi\" />
|
<Folder Include="Controllers\WebApi\" />
|
||||||
<Folder Include="Properties\PublishProfiles\" />
|
<Folder Include="Properties\PublishProfiles\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -1,127 +0,0 @@
|
||||||
using ZR.Model.Enum;
|
|
||||||
|
|
||||||
namespace ZR.Model.Content
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 文章表
|
|
||||||
/// </summary>
|
|
||||||
[SugarTable("article", "内容管理")]
|
|
||||||
[Tenant("0")]
|
|
||||||
public class Article
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 文章id
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
|
|
||||||
public long Cid { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 文章标题
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnDescription = "文章标题", Length = 254)]
|
|
||||||
public string Title { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 发布时间
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnDescription = "发布时间")]
|
|
||||||
public DateTime? CreateTime { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 修改时间
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(IsOnlyIgnoreInsert = true, ColumnDescription = "更新时间")]
|
|
||||||
public DateTime? UpdateTime { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 文章内容
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnDescription = "文章内容", ColumnDataType = StaticConfig.CodeFirst_BigString)]
|
|
||||||
public string Content { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 作者名
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnDescription = "作者名", Length = 20, ExtendedAttribute = ProteryConstant.NOTNULL)]
|
|
||||||
public string AuthorName { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 发布者用户id
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnDescription = "发布者用户id", ExtendedAttribute = ProteryConstant.NOTNULL)]
|
|
||||||
public long UserId { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 文章状态 1、发布 2、草稿
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnDescription = "文章状态 1、发布 2、草稿", Length = 20)]
|
|
||||||
public string Status { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 编辑器类型 markdown,html
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnDescription = "编辑器类型markdown,html", ColumnName = "editorType", Length = 20, IsNullable = true)]
|
|
||||||
public string EditorType { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 文章标签eg:Net5,java
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnDescription = "文章标签", Length = 20)]
|
|
||||||
public string Tags { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 点击量
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnDescription = "点击量", DefaultValue = "0")]
|
|
||||||
public int Hits { get; set; }
|
|
||||||
[SugarColumn(ColumnDescription = "目录id", ColumnName = "category_Id")]
|
|
||||||
public int CategoryId { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 封面地址
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnDescription = "封面地址", Length = 5000)]
|
|
||||||
public string CoverUrl { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 是否公开 1、公开 0、不公开
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnDescription = "是否公开 1、公开 0、不公开", DefaultValue = "0")]
|
|
||||||
public int IsPublic { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 是否置顶
|
|
||||||
/// </summary>
|
|
||||||
public int IsTop { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 0、文章 1、随笔 2、动态
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnDescription = "内容类型0、文章 1、随笔 2、动态", DefaultValue = "0")]
|
|
||||||
public ArticleTypeEnum ArticleType { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 摘要
|
|
||||||
/// </summary>
|
|
||||||
public string AbstractText { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 分类
|
|
||||||
/// </summary>
|
|
||||||
|
|
||||||
[Navigate(NavigateType.OneToOne, nameof(CategoryId), nameof(ArticleCategory.CategoryId))] //自定义关系映射
|
|
||||||
public ArticleCategory CategoryNav { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 评论数
|
|
||||||
/// </summary>
|
|
||||||
public int CommentNum { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 点赞数
|
|
||||||
/// </summary>
|
|
||||||
public int PraiseNum { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 用户IP
|
|
||||||
/// </summary>
|
|
||||||
public string UserIP { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 地理位置
|
|
||||||
/// </summary>
|
|
||||||
public string Location { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 话题ID
|
|
||||||
/// </summary>
|
|
||||||
public long TopicId { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 评论开关 0、所有人可评论 1、仅粉丝 2、仅自己
|
|
||||||
/// </summary>
|
|
||||||
public CommentSwitchEnum CommentSwitch { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 审核状态 0、待审核 1、通过 2、拒绝
|
|
||||||
/// </summary>
|
|
||||||
public AuditStatusEnum AuditStatus { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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; }
|
|
||||||
/// <summary>
|
|
||||||
/// 文章ID
|
|
||||||
/// </summary>
|
|
||||||
public long ArticleId { get; set; }
|
|
||||||
public long UserId { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,57 +0,0 @@
|
||||||
namespace ZR.Model.Content
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 文章目录
|
|
||||||
/// </summary>
|
|
||||||
[SugarTable("articleCategory", "文章目录")]
|
|
||||||
[Tenant("0")]
|
|
||||||
public class ArticleCategory
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 目录id
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "category_id")]
|
|
||||||
public int CategoryId { get; set; }
|
|
||||||
|
|
||||||
[SugarColumn(ColumnDescription = "目录名", Length = 20, ExtendedAttribute = ProteryConstant.NOTNULL)]
|
|
||||||
public string Name { get; set; }
|
|
||||||
[SugarColumn(ColumnDescription = "图标")]
|
|
||||||
public string Icon { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 排序id
|
|
||||||
/// </summary>
|
|
||||||
public int OrderNum { get; set; }
|
|
||||||
public int? ParentId { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 背景图
|
|
||||||
/// </summary>
|
|
||||||
public string BgImg { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 介绍
|
|
||||||
/// </summary>
|
|
||||||
public string Introduce { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 分类类型 0、文章 1、圈子
|
|
||||||
/// </summary>
|
|
||||||
public int CategoryType { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 文章数
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(DefaultValue = "0")]
|
|
||||||
public int ArticleNum { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 加入人数
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(DefaultValue = "0")]
|
|
||||||
public int JoinNum { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 创建时间
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnDescription = "创建时间", ColumnName = "create_time", InsertServerTime = true)]
|
|
||||||
public DateTime? CreateTime { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
|
|
||||||
[SugarColumn(IsIgnore = true)]
|
|
||||||
public List<ArticleCategory> Children { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,85 +0,0 @@
|
||||||
namespace ZR.Model.Content
|
|
||||||
{
|
|
||||||
[SugarTable("article_comment", "评论表")]
|
|
||||||
[Tenant(0)]
|
|
||||||
public class ArticleComment
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 评论ID
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(IsPrimaryKey = true)]
|
|
||||||
[JsonConverter(typeof(ValueToStringConverter))]
|
|
||||||
public long CommentId { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 用户id
|
|
||||||
/// </summary>
|
|
||||||
public long UserId { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 内容
|
|
||||||
/// </summary>
|
|
||||||
public string Content { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 最顶级留言id
|
|
||||||
/// </summary>
|
|
||||||
public long ParentId { get; set; } = 0;
|
|
||||||
/// <summary>
|
|
||||||
/// 评论时间
|
|
||||||
/// </summary>
|
|
||||||
public DateTime AddTime { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 回复用户id
|
|
||||||
/// </summary>
|
|
||||||
public long ReplyUserId { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 回复留言id
|
|
||||||
/// </summary>
|
|
||||||
public long ReplyId { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 用户ip
|
|
||||||
/// </summary>
|
|
||||||
public string UserIP { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 地理位置
|
|
||||||
/// </summary>
|
|
||||||
public string Location { get; set; } = string.Empty;
|
|
||||||
/// <summary>
|
|
||||||
/// 喜欢次数
|
|
||||||
/// </summary>
|
|
||||||
public int PraiseNum { get; set; } = 0;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 评论次数
|
|
||||||
/// </summary>
|
|
||||||
public int ReplyNum { get; set; } = 0;
|
|
||||||
/// <summary>
|
|
||||||
/// 审核状态 0、待审核 1、通过 -1、未通过
|
|
||||||
/// </summary>
|
|
||||||
public int AuditStatus { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 描述 :是否删除 1、删除 0、正常
|
|
||||||
/// 空值 : true
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
public int IsDelete { get; set; } = 0;
|
|
||||||
/// <summary>
|
|
||||||
/// 聊天图片
|
|
||||||
/// </summary>
|
|
||||||
public string ChatImg { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 分类id(可以对应表)
|
|
||||||
/// </summary>
|
|
||||||
public int ClassifyId { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 目标id(内容id)
|
|
||||||
/// </summary>
|
|
||||||
public long TargetId { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 是否置顶
|
|
||||||
/// </summary>
|
|
||||||
public long Top { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 作者回复过
|
|
||||||
/// </summary>
|
|
||||||
public int AuthorReply { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
||||||
|
|
||||||
namespace ZR.Model.Content
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 话题
|
|
||||||
/// </summary>
|
|
||||||
[SugarTable("article_topic", TableDescription = "文章话题")]
|
|
||||||
[Tenant(0)]
|
|
||||||
public class ArticleTopic
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 话题ID
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
|
||||||
public long TopicId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 话题名
|
|
||||||
/// </summary>
|
|
||||||
public string TopicName { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 话题描述
|
|
||||||
/// </summary>
|
|
||||||
public string TopicDescription { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 参与/发起次数
|
|
||||||
/// </summary>
|
|
||||||
public int JoinNum { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 浏览次数
|
|
||||||
/// </summary>
|
|
||||||
public int ViewNum { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 创建时间
|
|
||||||
/// </summary>
|
|
||||||
public DateTime? AddTime { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 话题分类
|
|
||||||
/// </summary>
|
|
||||||
public int? TopicType { get; set; }
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
||||||
|
|
||||||
namespace ZR.Model.Content
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 用户加入圈子
|
|
||||||
/// </summary>
|
|
||||||
[SugarTable("article_userCircles")]
|
|
||||||
[Tenant(0)]
|
|
||||||
public class ArticleUserCircles
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 主键
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
|
||||||
public int Id { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 圈子ID
|
|
||||||
/// </summary>
|
|
||||||
public int CategoryId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 用户ID
|
|
||||||
/// </summary>
|
|
||||||
public int UserId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 加入时间
|
|
||||||
/// </summary>
|
|
||||||
public DateTime? JoinTime { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 状态 0=待审核,1=已加入,2=已拒绝
|
|
||||||
/// </summary>
|
|
||||||
public int Status { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
||||||
namespace ZR.Model.Content.Dto
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 文章目录输入对象
|
|
||||||
/// </summary>
|
|
||||||
public class ArticleCategoryDto
|
|
||||||
{
|
|
||||||
[Required(ErrorMessage = "目录id不能为空")]
|
|
||||||
public int CategoryId { get; set; }
|
|
||||||
[Required(ErrorMessage = "目录名不能为空")]
|
|
||||||
public string Name { get; set; }
|
|
||||||
public string Icon { get; set; }
|
|
||||||
public int OrderNum { get; set; }
|
|
||||||
public DateTime? CreateTime { get; set; }
|
|
||||||
public int? ParentId { get; set; }
|
|
||||||
public int CategoryType { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 背景图
|
|
||||||
/// </summary>
|
|
||||||
public string BgImg { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 介绍
|
|
||||||
/// </summary>
|
|
||||||
public string Introduce { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 文章数
|
|
||||||
/// </summary>
|
|
||||||
public int ArticleNum { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 加入人数
|
|
||||||
/// </summary>
|
|
||||||
public int JoinNum { get; set; }
|
|
||||||
public List<ArticleCategory> Children { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 文章目录查询对象
|
|
||||||
/// </summary>
|
|
||||||
public class ArticleCategoryQueryDto : PagerInfo
|
|
||||||
{
|
|
||||||
public int? CategoryType { get; set; }
|
|
||||||
public int? ParentId { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,117 +0,0 @@
|
||||||
namespace ZR.Model.Content.Dto
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 评论
|
|
||||||
/// </summary>
|
|
||||||
public class MessageQueryDto : PagerInfo
|
|
||||||
{
|
|
||||||
public long CommentId { get; set; }
|
|
||||||
public long ParentId { get; set; }
|
|
||||||
public int OrderBy { get; set; }
|
|
||||||
public long? UserId { get; set; }
|
|
||||||
public int ClassifyId { get; set; }
|
|
||||||
public long TargetId { get; set; }
|
|
||||||
public DateTime? BeginAddTime { get; set; }
|
|
||||||
public DateTime? EndAddTime { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ArticleCommentDto
|
|
||||||
{
|
|
||||||
[JsonConverter(typeof(ValueToStringConverter))]
|
|
||||||
public long CommentId { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 用户id
|
|
||||||
/// </summary>
|
|
||||||
public long UserId { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 留言内容
|
|
||||||
/// </summary>
|
|
||||||
public string Content { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 最顶级留言id
|
|
||||||
/// </summary>
|
|
||||||
[JsonConverter(typeof(ValueToStringConverter))]
|
|
||||||
public long ParentId { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 评论时间
|
|
||||||
/// </summary>
|
|
||||||
public DateTime AddTime { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 回复用户id
|
|
||||||
/// </summary>
|
|
||||||
public int ReplyUserId { get; set; }
|
|
||||||
public string ReplyNickName { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 回复留言id
|
|
||||||
/// </summary>
|
|
||||||
[JsonConverter(typeof(ValueToStringConverter))]
|
|
||||||
public long ReplyId { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 用户ip
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
public string UserIP { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 地理位置
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
public string Location { get; set; } = string.Empty;
|
|
||||||
/// <summary>
|
|
||||||
/// 喜欢次数
|
|
||||||
/// </summary>
|
|
||||||
public int PraiseNum { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 评论次数
|
|
||||||
/// </summary>
|
|
||||||
public int ReplyNum { get; set; }
|
|
||||||
///// <summary>
|
|
||||||
///// 审核状态 0、待审核 1、通过 -1、未通过
|
|
||||||
///// </summary>
|
|
||||||
//public int AuditStatus { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 描述 :是否删除 1、删除 0、正常
|
|
||||||
/// 空值 : true
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
public int IsDelete { get; set; } = 0;
|
|
||||||
public string NickName { get; set; }
|
|
||||||
|
|
||||||
///// <summary>
|
|
||||||
///// 分享次数
|
|
||||||
///// </summary>
|
|
||||||
//public int ShareNunm { get; set; }
|
|
||||||
public string Avatar { get; set; } = string.Empty;
|
|
||||||
public string ChatImg { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 分类id
|
|
||||||
/// </summary>
|
|
||||||
public int ClassifyId { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 目标id
|
|
||||||
/// </summary>
|
|
||||||
public long TargetId { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 置顶
|
|
||||||
/// </summary>
|
|
||||||
public long Top { get; set; }
|
|
||||||
public bool HasMore { get; set; } = false;
|
|
||||||
public string Position
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
var temp_location = Location.Split("-")?[0];
|
|
||||||
|
|
||||||
if (temp_location == "0")
|
|
||||||
{
|
|
||||||
return "IP未知";
|
|
||||||
}
|
|
||||||
return temp_location?.Replace("省", "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// 回复列表
|
|
||||||
/// </summary>
|
|
||||||
public List<ArticleCommentDto> ReplyList { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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; }
|
|
||||||
/// <summary>
|
|
||||||
/// 1、最新 2、私密 3、热门
|
|
||||||
/// </summary>
|
|
||||||
public int TabId { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 话题ID
|
|
||||||
/// </summary>
|
|
||||||
public int? TopicId { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 排序 1、热门 2、最新
|
|
||||||
/// </summary>
|
|
||||||
public int? OrderBy { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 审核状态
|
|
||||||
/// </summary>
|
|
||||||
public AuditStatusEnum? AuditStatus { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 查询我加入的圈子
|
|
||||||
/// </summary>
|
|
||||||
public bool QueryMyJoin { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 搜索内容
|
|
||||||
/// </summary>
|
|
||||||
public string SearchText { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 输入输出对象
|
|
||||||
/// </summary>
|
|
||||||
public class ArticleDto
|
|
||||||
{
|
|
||||||
[Required(ErrorMessage = "Cid不能为空")]
|
|
||||||
public long Cid { get; set; }
|
|
||||||
//[Required(ErrorMessage = "标题不能为空")]
|
|
||||||
public string Title { get; set; }
|
|
||||||
[Required(ErrorMessage = "内容不能为空")]
|
|
||||||
public string Content { get; set; }
|
|
||||||
|
|
||||||
public long? UserId { get; set; }
|
|
||||||
|
|
||||||
public string Status { get; set; }
|
|
||||||
|
|
||||||
public string EditorType { get; set; }
|
|
||||||
|
|
||||||
public string Tags { get; set; }
|
|
||||||
|
|
||||||
public int Hits { get; set; }
|
|
||||||
|
|
||||||
public int? CategoryId { get; set; }
|
|
||||||
|
|
||||||
public DateTime? CreateTime { get; set; }
|
|
||||||
|
|
||||||
public DateTime? UpdateTime { get; set; }
|
|
||||||
|
|
||||||
public string AuthorName { get; set; }
|
|
||||||
|
|
||||||
public string CoverUrl { get; set; }
|
|
||||||
|
|
||||||
public ArticleCategoryDto CategoryNav { get; set; }
|
|
||||||
public string[] TagList
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Tags?.Split(',', StringSplitOptions.RemoveEmptyEntries) ?? Array.Empty<string>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public int IsPublic { get; set; } = 1;
|
|
||||||
public string AbstractText { get; set; }
|
|
||||||
public int IsTop { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 内容类型
|
|
||||||
/// </summary>
|
|
||||||
public ArticleTypeEnum ArticleType { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 点赞数
|
|
||||||
/// </summary>
|
|
||||||
public int PraiseNum { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 评论数
|
|
||||||
/// </summary>
|
|
||||||
public int CommentNum { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 分享数
|
|
||||||
/// </summary>
|
|
||||||
public int ShareNum { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 用户IP
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
public string UserIP { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 地理位置
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
public string Location { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 封面图片集合
|
|
||||||
/// </summary>
|
|
||||||
public string[] CoverImgList
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return CoverUrl?.Split(',', StringSplitOptions.RemoveEmptyEntries) ?? Array.Empty<string>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// 地理位置
|
|
||||||
/// </summary>
|
|
||||||
public string Position
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
var temp_location = Location?.Split("-")?[0];
|
|
||||||
|
|
||||||
if (temp_location == "0")
|
|
||||||
{
|
|
||||||
return "IP未知";
|
|
||||||
}
|
|
||||||
return temp_location?.Replace("省", "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// 是否点赞
|
|
||||||
/// </summary>
|
|
||||||
public int IsPraise { get; set; }
|
|
||||||
public long TopicId { get; set; }
|
|
||||||
public string TopicName { get; set; }
|
|
||||||
public ArticleUser User { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 审核状态
|
|
||||||
/// </summary>
|
|
||||||
public AuditStatusEnum? AuditStatus { get; set; }
|
|
||||||
public CommentSwitchEnum? CommentSwitch { get; set; }
|
|
||||||
}
|
|
||||||
public class ArticleUser
|
|
||||||
{
|
|
||||||
public string Avatar { get; set; } = string.Empty;
|
|
||||||
public string NickName { get; set; }
|
|
||||||
public int Sex { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,54 +0,0 @@
|
||||||
|
|
||||||
namespace ZR.Model.Content.Dto
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 话题查询对象
|
|
||||||
/// </summary>
|
|
||||||
public class ArticleTopicQueryDto : PagerInfo
|
|
||||||
{
|
|
||||||
public string TopicName { get; set; }
|
|
||||||
public DateTime? BeginAddTime { get; set; }
|
|
||||||
public DateTime? EndAddTime { get; set; }
|
|
||||||
public int? TopicType { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 话题输入输出对象
|
|
||||||
/// </summary>
|
|
||||||
public class ArticleTopicDto
|
|
||||||
{
|
|
||||||
[Required(ErrorMessage = "话题ID不能为空")]
|
|
||||||
[ExcelColumn(Name = "话题ID")]
|
|
||||||
[ExcelColumnName("话题ID")]
|
|
||||||
public long TopicId { get; set; }
|
|
||||||
|
|
||||||
[ExcelColumn(Name = "话题名")]
|
|
||||||
[ExcelColumnName("话题名")]
|
|
||||||
public string TopicName { get; set; }
|
|
||||||
|
|
||||||
[ExcelColumn(Name = "话题描述")]
|
|
||||||
[ExcelColumnName("话题描述")]
|
|
||||||
public string TopicDescription { get; set; }
|
|
||||||
|
|
||||||
[ExcelColumn(Name = "参与/发起次数")]
|
|
||||||
[ExcelColumnName("参与/发起次数")]
|
|
||||||
public int? JoinNum { get; set; }
|
|
||||||
|
|
||||||
[ExcelColumn(Name = "浏览次数")]
|
|
||||||
[ExcelColumnName("浏览次数")]
|
|
||||||
public int? ViewNum { get; set; }
|
|
||||||
|
|
||||||
[ExcelColumn(Name = "创建时间", Format = "yyyy-MM-dd HH:mm:ss", Width = 20)]
|
|
||||||
[ExcelColumnName("创建时间")]
|
|
||||||
public DateTime? AddTime { get; set; }
|
|
||||||
|
|
||||||
[ExcelColumn(Name = "话题分类")]
|
|
||||||
[ExcelColumnName("话题分类")]
|
|
||||||
public int? TopicType { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[ExcelColumn(Name = "话题分类")]
|
|
||||||
public string TopicTypeLabel { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
|
|
||||||
namespace ZR.Model.Content.Dto
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 用户加入圈子查询对象
|
|
||||||
/// </summary>
|
|
||||||
public class ArticleUserCirclesQueryDto : PagerInfo
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 用户加入圈子输入输出对象
|
|
||||||
/// </summary>
|
|
||||||
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; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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; }
|
|
||||||
/// <summary>
|
|
||||||
/// 背景图
|
|
||||||
/// </summary>
|
|
||||||
public string BgImg { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 介绍
|
|
||||||
/// </summary>
|
|
||||||
public string Introduce { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 文章数
|
|
||||||
/// </summary>
|
|
||||||
public int ArticleNum { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 加入人数
|
|
||||||
/// </summary>
|
|
||||||
public int JoinNum { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 是否加入
|
|
||||||
/// </summary>
|
|
||||||
public int IsJoin { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
using ZR.Model.Content.Dto;
|
|
||||||
|
|
||||||
namespace ZR.Model.social
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 粉丝表
|
|
||||||
/// </summary>
|
|
||||||
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; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
namespace ZR.Model.social
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 粉丝表
|
|
||||||
/// </summary>
|
|
||||||
[SugarTable("social_fans")]
|
|
||||||
public class SocialFans
|
|
||||||
{
|
|
||||||
[SugarColumn(IsPrimaryKey = true)]
|
|
||||||
public long PId { get; set; }
|
|
||||||
public long Userid { get; set; }
|
|
||||||
public long ToUserid { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 备注名
|
|
||||||
/// </summary>
|
|
||||||
public string RemarkName { get; set; }
|
|
||||||
public DateTime FollowTime { get; set; }
|
|
||||||
public string UserIP { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
namespace ZR.Model.social
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 粉丝信息表
|
|
||||||
/// </summary>
|
|
||||||
[SugarTable("social_fans_info")]
|
|
||||||
public class SocialFansInfo
|
|
||||||
{
|
|
||||||
[SugarColumn(IsPrimaryKey = true)]
|
|
||||||
public long Userid { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 关注数
|
|
||||||
/// </summary>
|
|
||||||
public int FollowNum { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 粉丝数
|
|
||||||
/// </summary>
|
|
||||||
public int FansNum { get; set; }
|
|
||||||
[JsonIgnore]
|
|
||||||
public DateTime UpdateTime { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
|
||||||
|
|
||||||
using ZR.Model.Content.Dto;
|
using ZR.Model.Content.Dto;
|
||||||
|
|
||||||
namespace ZR.Model.Dto
|
namespace ZR.Model.Dto
|
||||||
|
|
|
||||||
|
|
@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 文章目录Service业务层处理
|
|
||||||
/// </summary>
|
|
||||||
[AppService(ServiceType = typeof(IArticleCategoryService), ServiceLifetime = LifeTime.Transient)]
|
|
||||||
public class ArticleCategoryService : BaseService<ArticleCategory>, IArticleCategoryService
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 查询文章目录列表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parm"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public PagedInfo<ArticleCategoryDto> GetList(ArticleCategoryQueryDto parm)
|
|
||||||
{
|
|
||||||
var predicate = Expressionable.Create<ArticleCategory>();
|
|
||||||
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<ArticleCategory, ArticleCategoryDto>(parm);
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询文章目录树列表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parm"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public List<ArticleCategoryDto> GetTreeList(ArticleCategoryQueryDto parm)
|
|
||||||
{
|
|
||||||
var predicate = Expressionable.Create<ArticleCategory>();
|
|
||||||
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<List<ArticleCategoryDto>>();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 添加文章目录
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parm"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public int AddArticleCategory(ArticleCategory parm)
|
|
||||||
{
|
|
||||||
var response = Add(parm);
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 增加加入圈子人数
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="categoryId"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public int PlusJoinNum(int categoryId)
|
|
||||||
{
|
|
||||||
return Update(w => w.CategoryId == categoryId, w => new ArticleCategory() { JoinNum = w.JoinNum +1 });
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 减少加入圈子人数
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="categoryId"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public int ReduceJoinNum(int categoryId)
|
|
||||||
{
|
|
||||||
return Update(w => w.CategoryId == categoryId, w => new ArticleCategory() { JoinNum = w.JoinNum - 1 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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<ArticleComment>, 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取评论列表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dto"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public PagedInfo<ArticleCommentDto> GetMessageList(MessageQueryDto dto)
|
|
||||||
{
|
|
||||||
var predicate = Expressionable.Create<ArticleComment>();
|
|
||||||
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<SysUser>((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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取评论回复列表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="pager">分页</param>
|
|
||||||
/// <param name="cid"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public PagedInfo<ArticleCommentDto> GetReplyComments(long cid, MessageQueryDto pager)
|
|
||||||
{
|
|
||||||
PagedInfo<ArticleCommentDto> 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<ArticleCommentDto> GetCommentQueryable(long cid)
|
|
||||||
{
|
|
||||||
return Queryable()
|
|
||||||
.LeftJoin<SysUser>((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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 评论
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="message"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 评论点赞
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="mid"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public int PraiseMessage(long mid)
|
|
||||||
{
|
|
||||||
return Context.Updateable<ArticleComment>()
|
|
||||||
.SetColumns(it => it.PraiseNum == it.PraiseNum + 1)
|
|
||||||
.Where(it => it.CommentId == mid)
|
|
||||||
.ExecuteCommand();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 删除评论
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="commentId">评论ID</param>
|
|
||||||
/// <param name="userId">当前登录用户</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取评论列表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dto"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public PagedInfo<ArticleCommentDto> GetMyMessageList(MessageQueryDto dto)
|
|
||||||
{
|
|
||||||
var predicate = Expressionable.Create<ArticleComment>();
|
|
||||||
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<ArticleComment, ArticleCommentDto>(dto);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 置顶评论
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="commentId"></param>
|
|
||||||
/// <param name="top"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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<ArticlePraise>, IArticlePraiseService
|
|
||||||
{
|
|
||||||
private IArticleService _articleService;
|
|
||||||
private ISysUserMsgService _sysUserMsgService;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="articleService"></param>
|
|
||||||
/// <param name="userMsgService"></param>
|
|
||||||
public ArticlePraiseService(IArticleService articleService, ISysUserMsgService userMsgService)
|
|
||||||
{
|
|
||||||
_articleService = articleService;
|
|
||||||
_sysUserMsgService = userMsgService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 点赞
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dto"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 取消点赞点赞
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="userid"></param>
|
|
||||||
/// <param name="articleId"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public int CanclePraise(long userid, long articleId)
|
|
||||||
{
|
|
||||||
return Deleteable()
|
|
||||||
.Where(f => f.ArticleId == articleId && f.UserId == userid)
|
|
||||||
.IsLogic()
|
|
||||||
.ExecuteCommand(deleteValue: 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 恢复点赞
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="pid"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public int PlusPraise(long pid)
|
|
||||||
{
|
|
||||||
return Deleteable()
|
|
||||||
.Where(f => f.PId == pid)
|
|
||||||
.IsLogic()
|
|
||||||
.ExecuteCommand(deleteValue: 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
[AppService(ServiceType = typeof(IArticleService), ServiceLifetime = LifeTime.Transient)]
|
|
||||||
public class ArticleService : BaseService<Article>, IArticleService
|
|
||||||
{
|
|
||||||
private readonly IArticleCategoryService _categoryService;
|
|
||||||
private readonly IArticleTopicService _topicService;
|
|
||||||
private readonly ISysUserMsgService _userMsgService;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="categoryService"></param>
|
|
||||||
/// <param name="topicService"></param>
|
|
||||||
/// <param name="userMsgService"></param>
|
|
||||||
public ArticleService(
|
|
||||||
IArticleCategoryService categoryService,
|
|
||||||
IArticleTopicService topicService,
|
|
||||||
ISysUserMsgService userMsgService)
|
|
||||||
{
|
|
||||||
_categoryService = categoryService;
|
|
||||||
_topicService = topicService;
|
|
||||||
_userMsgService = userMsgService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询文章管理列表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parm"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public PagedInfo<ArticleDto> GetList(ArticleQueryDto parm)
|
|
||||||
{
|
|
||||||
var predicate = Expressionable.Create<Article>();
|
|
||||||
|
|
||||||
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<ArticleCategory>()
|
|
||||||
.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<Article, ArticleDto>(parm);
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 前台查询文章列表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parm"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public PagedInfo<ArticleDto> GetArticleList(ArticleQueryDto parm)
|
|
||||||
{
|
|
||||||
var predicate = Expressionable.Create<Article>();
|
|
||||||
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<ArticleCategory>()
|
|
||||||
.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<SysUser>((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<ArticlePraise>()
|
|
||||||
.Where(f => f.UserId == parm.UserId && f.IsDelete == 0)
|
|
||||||
.SetContext(scl => scl.ArticleId, () => item.Cid, item).Any() ? 1 : 0;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询最新文章列表
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public List<ArticleDto> GetNewArticleList()
|
|
||||||
{
|
|
||||||
var predicate = Expressionable.Create<Article>();
|
|
||||||
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<List<ArticleDto>>();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 前台查询动态列表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parm"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public PagedInfo<ArticleDto> GetMonentList(ArticleQueryDto parm)
|
|
||||||
{
|
|
||||||
var predicate = Expressionable.Create<Article>();
|
|
||||||
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<ArticleUserCircles>()
|
|
||||||
.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<SysUser>((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<ArticlePraise>()
|
|
||||||
.Where(f => f.UserId == parm.UserId && f.IsDelete == 0)
|
|
||||||
.SetContext(scl => scl.ArticleId, () => item.Cid, item).Any() ? 1 : 0;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询我的文章列表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parm"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public PagedInfo<ArticleDto> GetMyList(ArticleQueryDto parm)
|
|
||||||
{
|
|
||||||
var predicate = Expressionable.Create<Article>();
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 修改文章管理
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="model"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 置顶文章
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="model"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public int TopArticle(Article model)
|
|
||||||
{
|
|
||||||
var response = Update(w => w.Cid == model.Cid, it => new Article()
|
|
||||||
{
|
|
||||||
IsTop = model.IsTop,
|
|
||||||
});
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 评论权限
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="model"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public int ChangeComment(Article model)
|
|
||||||
{
|
|
||||||
var response = Update(w => w.Cid == model.Cid, it => new Article()
|
|
||||||
{
|
|
||||||
CommentSwitch = model.CommentSwitch,
|
|
||||||
});
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是否公开
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="model"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public int ChangeArticlePublic(Article model)
|
|
||||||
{
|
|
||||||
var response = Update(w => w.Cid == model.Cid, it => new Article()
|
|
||||||
{
|
|
||||||
IsPublic = model.IsPublic,
|
|
||||||
});
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 修改文章访问量
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="cid"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public int UpdateArticleHit(long cid)
|
|
||||||
{
|
|
||||||
var response = Update(w => w.Cid == cid, it => new Article() { Hits = it.Hits + 1 });
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 点赞
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="cid"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 前端-发布动态,文章
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="article"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取文章详情
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="cid">内容id</param>
|
|
||||||
/// <param name="userId">当前用户id</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
/// <exception cref="CustomException"></exception>
|
|
||||||
public ArticleDto GetArticle(long cid, long userId)
|
|
||||||
{
|
|
||||||
var response = GetId(cid);
|
|
||||||
var model = response.Adapt<ArticleDto>() ?? 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<ArticleCategoryDto>();
|
|
||||||
}
|
|
||||||
|
|
||||||
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<ArticlePraise>()
|
|
||||||
.Where(f => f.UserId == userId && f.ArticleId == cid && f.IsDelete == 0)
|
|
||||||
.Any() ? 1 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return model;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 审核通过
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="idsArr"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public int Passed(long[] idsArr)
|
|
||||||
{
|
|
||||||
int result = 0;
|
|
||||||
List<Article> 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 审核不通过
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="reason"></param>
|
|
||||||
/// <param name="idsArr"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public int Reject(string reason, long[] idsArr)
|
|
||||||
{
|
|
||||||
int result = 0;
|
|
||||||
List<Article> 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 文章话题Service业务层处理
|
|
||||||
/// </summary>
|
|
||||||
[AppService(ServiceType = typeof(IArticleTopicService), ServiceLifetime = LifeTime.Transient)]
|
|
||||||
public class ArticleTopicService : BaseService<ArticleTopic>, IArticleTopicService
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 查询文章话题列表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parm"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public PagedInfo<ArticleTopicDto> GetList(ArticleTopicQueryDto parm)
|
|
||||||
{
|
|
||||||
var predicate = QueryExp(parm);
|
|
||||||
|
|
||||||
var response = Queryable()
|
|
||||||
.Where(predicate.ToExpression())
|
|
||||||
.ToPage<ArticleTopic, ArticleTopicDto>(parm);
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取详情
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="TopicId"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public ArticleTopic GetInfo(long TopicId)
|
|
||||||
{
|
|
||||||
var response = Queryable()
|
|
||||||
.Where(x => x.TopicId == TopicId)
|
|
||||||
.First();
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 添加文章话题
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="model"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public ArticleTopic AddArticleTopic(ArticleTopic model)
|
|
||||||
{
|
|
||||||
if (Any(f => f.TopicName == model.TopicName))
|
|
||||||
{
|
|
||||||
throw new CustomException("话题名已存在");
|
|
||||||
}
|
|
||||||
return Insertable(model).ExecuteReturnEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 修改文章话题
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="model"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public int UpdateArticleTopic(ArticleTopic model)
|
|
||||||
{
|
|
||||||
return Update(model, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 导出文章话题
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parm"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public PagedInfo<ArticleTopicDto> ExportList(ArticleTopicQueryDto parm)
|
|
||||||
{
|
|
||||||
var predicate = QueryExp(parm);
|
|
||||||
|
|
||||||
var response = Queryable()
|
|
||||||
.Where(predicate.ToExpression())
|
|
||||||
.Select((it) => new ArticleTopicDto()
|
|
||||||
{
|
|
||||||
}, true)
|
|
||||||
.ToPage(parm);
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询导出表达式
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parm"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
private static Expressionable<ArticleTopic> QueryExp(ArticleTopicQueryDto parm)
|
|
||||||
{
|
|
||||||
var predicate = Expressionable.Create<ArticleTopic>();
|
|
||||||
|
|
||||||
return predicate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询热门文章话题列表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parm"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public List<ArticleTopicDto> GetTopicList(ArticleTopicQueryDto parm)
|
|
||||||
{
|
|
||||||
var predicate = Expressionable.Create<ArticleTopic>();
|
|
||||||
var response = Queryable()
|
|
||||||
.Where(predicate.ToExpression())
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
return response.Adapt<List<ArticleTopicDto>>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 用户加入圈子Service业务层处理
|
|
||||||
/// </summary>
|
|
||||||
[AppService(ServiceType = typeof(IArticleUserCirclesService), ServiceLifetime = LifeTime.Transient)]
|
|
||||||
public class ArticleUserCirclesService : BaseService<ArticleUserCircles>, IArticleUserCirclesService
|
|
||||||
{
|
|
||||||
private readonly IArticleCategoryService _articleCategoryService;
|
|
||||||
public ArticleUserCirclesService(IArticleCategoryService articleCategoryService)
|
|
||||||
{
|
|
||||||
_articleCategoryService = articleCategoryService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询用户加入圈子列表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parm"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public PagedInfo<ArticleUserCirclesDto> GetList(ArticleUserCirclesQueryDto parm)
|
|
||||||
{
|
|
||||||
var predicate = QueryExp(parm);
|
|
||||||
|
|
||||||
var response = Queryable()
|
|
||||||
.Where(predicate.ToExpression())
|
|
||||||
.ToPage<ArticleUserCircles, ArticleUserCirclesDto>(parm);
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取详情
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="Id"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public ArticleUserCircles GetInfo(int Id)
|
|
||||||
{
|
|
||||||
var response = Queryable()
|
|
||||||
.Where(x => x.Id == Id)
|
|
||||||
.First();
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询表达式
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parm"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
private static Expressionable<ArticleUserCircles> QueryExp(ArticleUserCirclesQueryDto parm)
|
|
||||||
{
|
|
||||||
var predicate = Expressionable.Create<ArticleUserCircles>();
|
|
||||||
|
|
||||||
return predicate;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#region 前端接口
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 用户加入圈子
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="userId"></param>
|
|
||||||
/// <param name="categoryId"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 删除用户加入圈子
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="userId"></param>
|
|
||||||
/// <param name="categoryId"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是否加入
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="userId"></param>
|
|
||||||
/// <param name="categoryId"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public int IsJoin(int userId, int categoryId)
|
|
||||||
{
|
|
||||||
var query = Queryable()
|
|
||||||
.Where(x => x.UserId == userId && x.CategoryId == categoryId)
|
|
||||||
.First();
|
|
||||||
return query == null ? 0 : 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询我的圈子
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="userId"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public List<ArticleCategoryDto> GetMyJoinCircles(int userId)
|
|
||||||
{
|
|
||||||
var response = Queryable()
|
|
||||||
.LeftJoin<ArticleCategory>((it, c) => it.CategoryId == c.CategoryId)
|
|
||||||
.Where((it,c) => it.UserId == userId)
|
|
||||||
.Select((it, c) => new ArticleCategoryDto()
|
|
||||||
{
|
|
||||||
|
|
||||||
}, true)
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
using ZR.Model.Content;
|
|
||||||
using ZR.Model.Content.Dto;
|
|
||||||
|
|
||||||
namespace ZR.Service.Content.IService
|
|
||||||
{
|
|
||||||
public interface IArticleCategoryService : IBaseService<ArticleCategory>
|
|
||||||
{
|
|
||||||
PagedInfo<ArticleCategoryDto> GetList(ArticleCategoryQueryDto parm);
|
|
||||||
List<ArticleCategoryDto> GetTreeList(ArticleCategoryQueryDto parm);
|
|
||||||
int AddArticleCategory(ArticleCategory parm);
|
|
||||||
|
|
||||||
int PlusJoinNum(int categoryId);
|
|
||||||
int ReduceJoinNum(int categoryId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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<ArticleCommentDto> GetMessageList(MessageQueryDto dto);
|
|
||||||
ArticleComment AddMessage(ArticleComment message);
|
|
||||||
int PraiseMessage(long mid);
|
|
||||||
int DeleteMessage(long mid, long userId);
|
|
||||||
PagedInfo<ArticleCommentDto> GetReplyComments(long mid, MessageQueryDto pager);
|
|
||||||
PagedInfo<ArticleCommentDto> GetMyMessageList(MessageQueryDto dto);
|
|
||||||
long TopMessage(long commentId, long top);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
using ZR.Model.Content;
|
|
||||||
|
|
||||||
namespace ZR.Service.Content.IService
|
|
||||||
{
|
|
||||||
public interface IArticlePraiseService : IBaseService<ArticlePraise>
|
|
||||||
{
|
|
||||||
int Praise(ArticlePraise dto);
|
|
||||||
int CanclePraise(long userid, long articleId);
|
|
||||||
int PlusPraise(long pid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
using ZR.Model.Content;
|
|
||||||
using ZR.Model.Content.Dto;
|
|
||||||
|
|
||||||
namespace ZR.Service.Content.IService
|
|
||||||
{
|
|
||||||
public interface IArticleService : IBaseService<Article>
|
|
||||||
{
|
|
||||||
PagedInfo<ArticleDto> GetList(ArticleQueryDto parm);
|
|
||||||
PagedInfo<ArticleDto> GetMyList(ArticleQueryDto parm);
|
|
||||||
/// <summary>
|
|
||||||
/// 修改文章管理
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="model"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public int UpdateArticle(Article model);
|
|
||||||
PagedInfo<ArticleDto> GetArticleList(ArticleQueryDto parm);
|
|
||||||
List<ArticleDto> GetNewArticleList();
|
|
||||||
PagedInfo<ArticleDto> 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
using ZR.Model;
|
|
||||||
using ZR.Model.Content;
|
|
||||||
using ZR.Model.Content.Dto;
|
|
||||||
|
|
||||||
namespace ZR.Service.Content.IService
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 文章话题service接口
|
|
||||||
/// </summary>
|
|
||||||
public interface IArticleTopicService : IBaseService<ArticleTopic>
|
|
||||||
{
|
|
||||||
PagedInfo<ArticleTopicDto> GetList(ArticleTopicQueryDto parm);
|
|
||||||
|
|
||||||
ArticleTopic GetInfo(long TopicId);
|
|
||||||
|
|
||||||
|
|
||||||
ArticleTopic AddArticleTopic(ArticleTopic parm);
|
|
||||||
int UpdateArticleTopic(ArticleTopic parm);
|
|
||||||
|
|
||||||
List<ArticleTopicDto> GetTopicList(ArticleTopicQueryDto parm);
|
|
||||||
PagedInfo<ArticleTopicDto> ExportList(ArticleTopicQueryDto parm);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
using ZR.Model.Content.Dto;
|
|
||||||
using ZR.Model.Content;
|
|
||||||
|
|
||||||
namespace ZR.Service.Content.IService
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 用户加入圈子service接口
|
|
||||||
/// </summary>
|
|
||||||
public interface IArticleUserCirclesService : IBaseService<ArticleUserCircles>
|
|
||||||
{
|
|
||||||
PagedInfo<ArticleUserCirclesDto> 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<ArticleCategoryDto> GetMyJoinCircles(int userId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 动态api示例,继承IDynamicApi,使用看swagger生成的地址
|
|
||||||
/// </summary>
|
|
||||||
[AppService(ServiceType = typeof(IHelloService), ServiceLifetime = LifeTime.Transient)]
|
|
||||||
public class HelloService : BaseService<ArticleCategory>, IHelloService, IDynamicApi
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 引用User服务
|
|
||||||
/// </summary>
|
|
||||||
private readonly ISysUserService userService;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="userService"></param>
|
|
||||||
public HelloService(ISysUserService userService)
|
|
||||||
{
|
|
||||||
this.userService = userService;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// 数据库使用案例
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="name"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public string SayHello(string name)
|
|
||||||
{
|
|
||||||
//构造函数式使用
|
|
||||||
var user = JsonConvert.SerializeObject(userService.GetFirst(f => f.UserId == 1));
|
|
||||||
Console.WriteLine(user);
|
|
||||||
|
|
||||||
var postService = App.GetRequiredService<ISysPostService>();
|
|
||||||
Console.WriteLine(JsonConvert.SerializeObject(postService.GetId(1)));
|
|
||||||
|
|
||||||
BaseRepository<SysDept> deptRepo = new();
|
|
||||||
Console.WriteLine(JsonConvert.SerializeObject(deptRepo.GetId(1)));
|
|
||||||
|
|
||||||
var result = DbScoped.SugarScope.Queryable<SysDictType>().Where(f => f.DictId == 1).First();
|
|
||||||
Console.WriteLine(JsonConvert.SerializeObject(result));
|
|
||||||
|
|
||||||
//切换库
|
|
||||||
//DbScoped.SugarScope.GetConnectionScope(2);
|
|
||||||
|
|
||||||
GetFirst(x => x.CategoryId == 1);
|
|
||||||
Context.Queryable<SysUser>().First(f => f.UserId == 1);
|
|
||||||
|
|
||||||
return "Hello:" + name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 返回json内容
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="userDto"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[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("自定义异常");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 返回json内容
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="userDto"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[AllowAnonymous]
|
|
||||||
public ApiResult SayHelloJson([FromBody] SysUserDto userDto)
|
|
||||||
{
|
|
||||||
return new ApiResult(100, "success", userDto);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
using Infrastructure.Model;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using ZR.Model.Content;
|
|
||||||
using ZR.Model.System.Dto;
|
|
||||||
|
|
||||||
namespace ZR.Service.IService
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Hello接口
|
|
||||||
/// </summary>
|
|
||||||
public interface IHelloService : IBaseService<ArticleCategory>
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="name"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
string SayHello(string name);
|
|
||||||
ApiResult SayHello2([FromBody] SysUserDto userDto);
|
|
||||||
ApiResult SayHello3();
|
|
||||||
ApiResult SayHelloJson([FromBody] SysUserDto userDto);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 广告管理Service业务层处理
|
|
||||||
/// </summary>
|
|
||||||
[AppService(ServiceType = typeof(IBannerConfigService), ServiceLifetime = LifeTime.Transient)]
|
|
||||||
public class BannerConfigService : BaseService<BannerConfig>, IBannerConfigService
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 查询广告管理列表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parm"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public PagedInfo<BannerConfigDto> GetList(BannerConfigQueryDto parm)
|
|
||||||
{
|
|
||||||
var predicate = QueryExp(parm);
|
|
||||||
|
|
||||||
var response = Queryable()
|
|
||||||
.Where(predicate.ToExpression())
|
|
||||||
.ToPage<BannerConfig, BannerConfigDto>(parm);
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取详情
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="Id"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public BannerConfig GetInfo(int Id)
|
|
||||||
{
|
|
||||||
var response = Queryable()
|
|
||||||
.Where(x => x.Id == Id)
|
|
||||||
.First();
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 添加广告管理
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="model"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public BannerConfig AddBannerConfig(BannerConfig model)
|
|
||||||
{
|
|
||||||
return Insertable(model).ExecuteReturnEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 修改广告管理
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="model"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public int UpdateBannerConfig(BannerConfig model)
|
|
||||||
{
|
|
||||||
return Update(model, false, "修改广告管理");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 导出广告管理
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parm"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public PagedInfo<BannerConfigDto> ExportList(BannerConfigQueryDto parm)
|
|
||||||
{
|
|
||||||
var predicate = QueryExp(parm);
|
|
||||||
|
|
||||||
var response = Queryable()
|
|
||||||
.Where(predicate.ToExpression())
|
|
||||||
.Select((it) => new BannerConfigDto()
|
|
||||||
{
|
|
||||||
ShowStatusLabel = it.ShowStatus.GetConfigValue<Model.System.SysDictData>("sys_common_status"),
|
|
||||||
}, true)
|
|
||||||
.ToPage(parm);
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询导出表达式
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parm"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
private static Expressionable<BannerConfig> QueryExp(BannerConfigQueryDto parm)
|
|
||||||
{
|
|
||||||
var predicate = Expressionable.Create<BannerConfig>();
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询广告管理列表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parm"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public List<BannerConfigDto> GetBannerList(BannerConfigQueryDto parm)
|
|
||||||
{
|
|
||||||
var predicate = Expressionable.Create<BannerConfig>();
|
|
||||||
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<List<BannerConfigDto>>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
using ZR.Model.Public.Dto;
|
|
||||||
using ZR.Model.Public;
|
|
||||||
|
|
||||||
namespace ZR.Service.Public.IPublicService
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 广告管理service接口
|
|
||||||
/// </summary>
|
|
||||||
public interface IBannerConfigService : IBaseService<BannerConfig>
|
|
||||||
{
|
|
||||||
PagedInfo<BannerConfigDto> GetList(BannerConfigQueryDto parm);
|
|
||||||
|
|
||||||
BannerConfig GetInfo(int Id);
|
|
||||||
|
|
||||||
BannerConfig AddBannerConfig(BannerConfig parm);
|
|
||||||
int UpdateBannerConfig(BannerConfig parm);
|
|
||||||
|
|
||||||
List<BannerConfigDto> GetBannerList(BannerConfigQueryDto parm);
|
|
||||||
PagedInfo<BannerConfigDto> ExportList(BannerConfigQueryDto parm);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
using ZR.Model.social;
|
|
||||||
|
|
||||||
namespace ZR.Service.Social.IService
|
|
||||||
{
|
|
||||||
public interface ISocialFansInfoService : IBaseService<SocialFansInfo>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
using ZR.Model.social;
|
|
||||||
|
|
||||||
namespace ZR.Service.Social.IService
|
|
||||||
{
|
|
||||||
public interface ISocialFansService : IBaseService<SocialFans>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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<SocialFansInfo>, ISocialFansInfoService
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 粉丝
|
|
||||||
/// </summary>
|
|
||||||
[AppService(ServiceType = typeof(ISocialFansService))]
|
|
||||||
public class SocialFansService : BaseService<SocialFans>, ISocialFansService, IDynamicApi
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 查询关注/粉丝列表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dto"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet]
|
|
||||||
public ApiResult FollowList([FromQuery] FansQueryDto dto)
|
|
||||||
{
|
|
||||||
var userid = (int)HttpContextExtension.GetUId(App.HttpContext);
|
|
||||||
PagedInfo<SocialFansDto> list = dto.SelectType == 1 ? GetFollow(dto, userid) : GetFans(dto, userid);
|
|
||||||
|
|
||||||
return ApiResult.Success(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是否关注
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="toUserid"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 关注
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dto"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[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<SocialFansInfo>()
|
|
||||||
.Where(x => x.Userid == dto.Userid)
|
|
||||||
.First();
|
|
||||||
return ApiResult.Success("关注成功", data);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 取消关注
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dto"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[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<SocialFansInfo>()
|
|
||||||
.SetColumns(x => x.FollowNum == x.FollowNum - 1)
|
|
||||||
.Where(x => x.Userid == dto.Userid)
|
|
||||||
.ExecuteCommand();
|
|
||||||
|
|
||||||
Context.Updateable<SocialFansInfo>()
|
|
||||||
.SetColumns(x => x.FansNum == x.FansNum - 1)
|
|
||||||
.Where(x => x.Userid == dto.ToUserid)
|
|
||||||
.ExecuteCommand();
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!result.IsSuccess)
|
|
||||||
{
|
|
||||||
return ApiResult.Error("取消关注失败");
|
|
||||||
}
|
|
||||||
var data = Context.Queryable<SocialFansInfo>()
|
|
||||||
.Where(x => x.Userid == dto.Userid)
|
|
||||||
.First();
|
|
||||||
return ApiResult.Success("取消关注成功", data);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdateFollowInfo(long userId, bool isFollowNum)
|
|
||||||
{
|
|
||||||
var count = Context.Updateable<SocialFansInfo>()
|
|
||||||
.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<SocialFansDto> GetFollow(FansQueryDto dto, int userid)
|
|
||||||
{
|
|
||||||
return Queryable()
|
|
||||||
.LeftJoin<SysUser>((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<SocialFansDto> GetFans(FansQueryDto dto, int userid)
|
|
||||||
{
|
|
||||||
return Queryable()
|
|
||||||
.LeftJoin<SysUser>((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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -11,5 +11,8 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\ZR.ServiceCore\ZR.ServiceCore.csproj" />
|
<ProjectReference Include="..\ZR.ServiceCore\ZR.ServiceCore.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="IService\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -184,40 +184,9 @@ namespace ZR.ServiceCore.Services
|
||||||
return (msg, x.ErrorList, x.IgnoreList);
|
return (msg, x.ErrorList, x.IgnoreList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 文章目录
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="data"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public (string, object, object) InitArticleCategoryData(List<ArticleCategory> 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 文章话题
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="data"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public (string, object, object) InitArticleTopicData(List<ArticleTopic> 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 任务
|
/// 任务
|
||||||
|
|
@ -321,13 +290,6 @@ namespace ZR.ServiceCore.Services
|
||||||
var result10 = InitDeptData(sysDept);
|
var result10 = InitDeptData(sysDept);
|
||||||
result.Add(result10.Item1);
|
result.Add(result10.Item1);
|
||||||
|
|
||||||
var sysArticleCategory = MiniExcel.Query<ArticleCategory>(path, sheetName: "article_category").ToList();
|
|
||||||
var result11 = InitArticleCategoryData(sysArticleCategory);
|
|
||||||
result.Add(result11.Item1);
|
|
||||||
|
|
||||||
var sysArticleTopic = MiniExcel.Query<ArticleTopic>(path, sheetName: "article_topic").ToList();
|
|
||||||
var result13 = InitArticleTopicData(sysArticleTopic);
|
|
||||||
result.Add(result13.Item1);
|
|
||||||
|
|
||||||
var sysNotice = MiniExcel.Query<SysNotice>(path, sheetName: "notice").ToList();
|
var sysNotice = MiniExcel.Query<SysNotice>(path, sheetName: "notice").ToList();
|
||||||
var result12 = InitNoticeData(sysNotice);
|
var result12 = InitNoticeData(sysNotice);
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ using ZR.Model;
|
||||||
using ZR.Model.Content;
|
using ZR.Model.Content;
|
||||||
using ZR.Model.Models;
|
using ZR.Model.Models;
|
||||||
using ZR.Model.Public;
|
using ZR.Model.Public;
|
||||||
using ZR.Model.social;
|
|
||||||
using ZR.Model.System;
|
using ZR.Model.System;
|
||||||
using ZR.Model.System.Generate;
|
using ZR.Model.System.Generate;
|
||||||
using ZR.Model.System.Model;
|
using ZR.Model.System.Model;
|
||||||
|
|
@ -55,12 +55,7 @@ namespace ZR.ServiceCore.SqlSugar
|
||||||
db.CodeFirst.InitTables(typeof(EmailTpl));
|
db.CodeFirst.InitTables(typeof(EmailTpl));
|
||||||
db.CodeFirst.InitTables(typeof(SmsCodeLog));
|
db.CodeFirst.InitTables(typeof(SmsCodeLog));
|
||||||
db.CodeFirst.InitTables(typeof(EmailLog));
|
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(BannerConfig));
|
||||||
db.CodeFirst.InitTables(typeof(SysUserMsg));
|
db.CodeFirst.InitTables(typeof(SysUserMsg));
|
||||||
db.CodeFirst.InitTables(typeof(SysFileGroup));
|
db.CodeFirst.InitTables(typeof(SysFileGroup));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user