diff --git a/ArticleManagementSystem.Backend/.gitignore b/ArticleManagementSystem.Backend/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..09be3f153fdded84dd4ec14fbe6eadc0b290153c
--- /dev/null
+++ b/ArticleManagementSystem.Backend/.gitignore
@@ -0,0 +1,4 @@
+.vscode
+obj
+bin
+iloveyou.http
\ No newline at end of file
diff --git a/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/ArticleManagementSystem.Api.csproj b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/ArticleManagementSystem.Api.csproj
new file mode 100644
index 0000000000000000000000000000000000000000..ec2f87df80caf54fcb05b775162d7432d713652f
--- /dev/null
+++ b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/ArticleManagementSystem.Api.csproj
@@ -0,0 +1,18 @@
+
+
+
+ netcoreapp3.1
+
+
+
+
+
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+
+
+
+
+
diff --git a/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Controllers/ArticleController.cs b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Controllers/ArticleController.cs
new file mode 100644
index 0000000000000000000000000000000000000000..9e5b4c6657bf348cf4b481cf1a4b87aa7a0b479c
--- /dev/null
+++ b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Controllers/ArticleController.cs
@@ -0,0 +1,328 @@
+using ArticleManagementSystem.Api.Db;
+using ArticleManagementSystem.Api.Entity;
+using ArticleManagementSystem.Api.Params;
+using ArticleManagementSystem.Api.Repostisory;
+using Microsoft.AspNetCore.Mvc;
+using ArticleManagementSystem.Api.Utils;
+using Microsoft.EntityFrameworkCore;
+using System.Collections;
+using System.Dynamic;
+using System.Linq;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Http;
+using System.Collections.Generic;
+
+namespace ArticleManagementSystem.Api.Controllers
+{
+ [ApiController]
+ [Route("[controller]")]
+ public class ArticleController : ControllerBase
+ {
+ private readonly IRepostisory _articleRepostisory;
+ private readonly IRepostisory _imgRepostisory;
+ private readonly DataBase _context;
+ private readonly IWebHostEnvironment _iWebHostEnvironment;
+
+ public ArticleController(IRepostisory articleRepostisory, IRepostisory imgRepostisory, IWebHostEnvironment iWebHostEnvironment)
+ {
+ _context = new DataBase();
+ _articleRepostisory = articleRepostisory;
+ _imgRepostisory = imgRepostisory;
+ _iWebHostEnvironment = iWebHostEnvironment;
+ }
+
+
+ ///
+ /// 添加文章
+ ///
+ /// 添加文章需要的参数集合
+ ///
+ [HttpPost, Route("addarticle")]
+ public dynamic PostArticleContent(AddArticle addArticle)
+ {
+
+ var UserId = addArticle.UserId;
+ var ArticleContent = addArticle.ArticleContent.Trim();
+ var ArticleDetails = addArticle.ArticleDetails.Trim();
+ var ArticleTitle = addArticle.ArticleTitle.Trim();
+ var ArticleType = addArticle.ArticleType.Trim();
+ var ImgId = addArticle.ImgId;
+
+
+ ArticleContent = HtmlOrUbb.HtmlToUBB(ArticleContent);
+
+ // var b = HtmlOrUbb.UBBToHtml(a);
+
+ if (string.IsNullOrEmpty(ArticleTitle))
+ {
+ return new
+ {
+ code = 1000,
+ msg = "标题不能为空"
+ };
+ }
+
+ if (string.IsNullOrEmpty(ArticleContent))
+ {
+ return new
+ {
+ code = 1000,
+ msg = "发布内容不能为空"
+ };
+ }
+
+
+ if (string.IsNullOrEmpty(ArticleType))
+ {
+ return new
+ {
+ code = 1000,
+ msg = "请选择文章类型"
+ };
+ }
+
+ // var file = Request.Form.Files;
+ // var filePath = ImgsHelper.UpImgs(file, _iWebHostEnvironment, _imgRepostisory);
+ // var imgRes = new Imgs
+ // {
+ // ImgsPath = filePath
+ // };
+ // _imgRepostisory.Insert(imgRes);
+ // var imgId = imgRes.Id;
+
+ var res = new Article
+ {
+ Content = ArticleContent,
+ UserId = UserId,
+ ArticleDetails = ArticleDetails,
+ Title = ArticleTitle,
+ ArticleType = ArticleType,
+ ImgId = ImgId
+ };
+
+ _articleRepostisory.Insert(res);
+ res.Content = HtmlOrUbb.UBBToHtml(ArticleContent);
+
+ return new
+ {
+ code = 200,
+ msg = "插入成功",
+ data = res
+ };
+ }
+
+ //查询文章
+ [HttpPost, Route("query")]
+ public dynamic PostQuery(Myquery querys)
+ {
+ var querydata = querys.query;
+ // var pageIndex = querys.PageIndex;
+ // var pageSize = querys.PageSize;
+ var articletype = querys.ArticleType;
+ var article = _articleRepostisory.Table;
+ dynamic resdata;
+
+ var sqlQuery = from tableArticle in _context.Set()
+ join tableUsers in _context.Set()
+ on tableArticle.UserId equals tableUsers.Id into grouping
+ from tableUsers in grouping.DefaultIfEmpty()
+ select new { tableArticle, tableUsers };
+
+ var table = from ImgsTable in _context.Set()
+ join UserArticleTable in sqlQuery
+ on ImgsTable.Id equals UserArticleTable.tableArticle.ImgId into grouping
+ from UserArticleTable in grouping.DefaultIfEmpty()
+ select new { ImgsTable, UserArticleTable };
+
+
+ if (string.IsNullOrEmpty(articletype))
+ {
+ resdata = sqlQuery.Where(x => x.tableUsers.Username.Contains(querydata)
+ || x.tableArticle.ArticleDetails.Contains(querydata)
+ || x.tableArticle.ArticleType.Contains(querydata)
+ || x.tableArticle.Title.Contains(querydata)
+ ).ToList();
+ }
+ else
+ {
+ resdata = sqlQuery.Where(x => x.tableUsers.Username.Contains(querydata)
+ || x.tableArticle.ArticleDetails.Contains(querydata)
+ || x.tableArticle.ArticleType.Contains(querydata)
+ || x.tableArticle.Title.Contains(querydata)
+ ).ToList();
+ }
+ ArrayList arraylist = new ArrayList();
+ foreach (var item in resdata)
+ {
+ var Articleid = item.tableArticle.Id;
+ arraylist.Add(Articleid);
+ }
+ var resTable = ArticleSelectHelper.GetArticleMsg(arraylist, _context);
+ var res = new
+ {
+ Code = 200,
+ Data = resTable,
+ Msg = "查询成功"
+ };
+ return res;
+ }
+
+ //更新文章
+ [HttpPut("{id}")]
+ public dynamic PutUpdataArticle(int id, AddArticle updateArticle)
+ {
+
+ var UserId = updateArticle.UserId;
+ var ArticleContent = updateArticle.ArticleContent.Trim();
+ var ArticleDetails = updateArticle.ArticleDetails.Trim();
+ var ArticleTitle = updateArticle.ArticleTitle.Trim();
+ var ArticleType = updateArticle.ArticleType.Trim();
+
+
+ if (string.IsNullOrEmpty(ArticleContent))
+ {
+ return new
+ {
+ code = 104,
+ data = "",
+ msg = "内容不能为空"
+ };
+ }
+
+
+ if (string.IsNullOrEmpty(ArticleDetails))
+ {
+ return new
+ {
+ code = 104,
+ data = "",
+ msg = "详情不能为空"
+ };
+ }
+
+
+ if (string.IsNullOrEmpty(ArticleTitle))
+ {
+ return new
+ {
+ code = 104,
+ data = "",
+ msg = "标题不能为空"
+ };
+ }
+
+ if (string.IsNullOrEmpty(ArticleType))
+ {
+ return new
+ {
+ code = 104,
+ data = "",
+ msg = "请至少选择一种类型"
+ };
+ }
+
+ var art = _articleRepostisory.GetById(id);
+
+ if (art == null)
+ {
+ return new
+ {
+ code = 104,
+ data = "",
+ msg = "查无此书"
+ };
+ }
+
+ art.Content = updateArticle.ArticleContent.Trim();
+ art.ArticleDetails = updateArticle.ArticleDetails.Trim();
+ art.UserId = updateArticle.UserId;
+ art.ArticleType = updateArticle.ArticleType.Trim();
+ art.Title = updateArticle.ArticleTitle.Trim();
+
+
+ _articleRepostisory.Updated(art);
+
+ return new
+ {
+ code = 200,
+ data = art,
+ msg = "更新成功"
+ };
+ }
+
+ //删除文章
+ [HttpDelete("{id}")]
+ public dynamic DeleteArticle(int id)
+ {
+ _articleRepostisory.Deleted(id);
+
+ return new
+ {
+ code = 200,
+ data = "",
+ msg = "删除成功"
+ };
+ }
+
+
+ //获取文章
+ [HttpGet, Route("GetArticle")]
+ public dynamic GetArticles()
+ {
+ var articles = _context.article.OrderByDescending(x=>x.Id).ToList();
+ var imgs = _context.imgs.ToList();
+ var users = _context.users.ToList();
+
+ // var list = new List();
+ // foreach (var item in articles)
+ // {
+ // var img = imgs.Where(x => x.Id == item.ImgId).FirstOrDefault();
+ // var user = users.Where(x => x.Id == item.UserId).FirstOrDefault();
+
+ // var tmp = new
+ // {
+ // Id = item.Id,
+ // item.Title,
+ // item.Content,
+ // item.ArticleDetails,
+ // item.UserId,
+ // item.ArticleType,
+ // item.CreatedTime,
+ // ImgPath = img != null ? img.ImgsPath : "",
+ // Username = user != null ? user.Username : ""
+ // };
+ // list.Add(tmp);
+ // }
+
+ ArrayList arraylist = new ArrayList();
+ foreach (var item in articles)
+ {
+ var Articleid = item.Id;
+ arraylist.Add(Articleid);
+ }
+ var restable = ArticleSelectHelper.GetArticleMsg(arraylist, _context);
+
+ return JsonHelper.Serialize(new
+ {
+ Code = 1000,
+ Data = restable,
+ Msg = "获取成功"
+ });
+
+ }
+
+
+ //通过id获取文章
+ [HttpGet, Route("{id}/GetArticle")]
+ public dynamic GetArticle(int id){
+ var articles = _articleRepostisory.Table;
+ var res = articles.Where(x=>x.Id == id).FirstOrDefault();
+
+ return new {
+ code = 200,
+ data = res,
+ msg = "获取成功"
+ };
+ }
+ }
+}
\ No newline at end of file
diff --git a/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Controllers/ArticleModificationController.cs b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Controllers/ArticleModificationController.cs
new file mode 100644
index 0000000000000000000000000000000000000000..9902308f66dc3865e36d9bef023b27a5c54a21ef
--- /dev/null
+++ b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Controllers/ArticleModificationController.cs
@@ -0,0 +1,119 @@
+using ArticleManagementSystem.Api.Db;
+using ArticleManagementSystem.Api.Entity;
+using ArticleManagementSystem.Api.Params;
+using ArticleManagementSystem.Api.Repostisory;
+using Microsoft.AspNetCore.Mvc;
+using ArticleManagementSystem.Api.Utils;
+using Microsoft.EntityFrameworkCore;
+using System.Collections;
+using System.Dynamic;
+using System.Linq;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Http;
+using System.Collections.Generic;
+
+namespace ArticleManagementSystem.Api.Controllers
+{
+ [ApiController]
+ [Route("[controller]")]
+ public class ArticleModificationController : ControllerBase
+ {
+ private readonly DataBase _context;
+ private readonly IRepostisory _carouselRepostisory;
+
+ public ArticleModificationController(IRepostisory carouselRepostisory, IRepostisory articleRepostisory, IRepostisory imgRepostisory, IWebHostEnvironment iWebHostEnvironment)
+ {
+ _context = new DataBase();
+ _carouselRepostisory = carouselRepostisory;
+ }
+ //获取文章
+ [HttpGet, Route("GetArticle")]
+ public dynamic GetArticle()
+ {
+ var articles = _context.article.ToList();
+ var imgs = _context.imgs.ToList();
+ var users = _context.users.ToList();
+ var carousels = _context.carousel.ToList();
+ var recommends = _context.Recommends.ToList();
+
+ var list = new List();
+ foreach (var item in articles)
+ {
+ var img = imgs.Where(x => x.Id == item.ImgId).FirstOrDefault();
+ var user = users.Where(x => x.Id == item.UserId).FirstOrDefault();
+ var carousel = carousels.Where(x => x.ArticleId == item.Id).FirstOrDefault();
+ var recommend = recommends.Where(x=>x.AricleId == item.Id).FirstOrDefault();
+
+ var tmp = new
+ {
+ Id = item.Id,
+ item.Title,
+ item.Content,
+ item.ArticleDetails,
+ item.UserId,
+ item.ArticleType,
+ item.CreatedTime,
+ ImgPath = img != null ? img.ImgsPath : "",
+ ImgId = img != null ? img.Id.ToString() : "",
+ Username = user != null ? user.Username : "",
+ iscarousel = carousel != null ? true : false ,
+ isrecommend = recommend != null ? true : false
+ };
+ list.Add(tmp);
+ }
+
+ // ArrayList arraylist = new ArrayList();
+ // foreach (var item in table)
+ // {
+
+ // var Articleid = item.Id;
+
+ // arraylist.Add(Articleid);
+ // }
+ // var restable = ArticleSelectHelper.GetArticleMsg(arraylist,_context);
+
+ return JsonHelper.Serialize(new
+ {
+ Code = 1000,
+ Data = list,
+ Msg = "获取成功"
+ });
+
+ }
+ //修改轮播图
+ [HttpPost, Route("EditCarousel")]
+ public dynamic EditCarousel(EditCarousel carousel)
+ {
+ var ImgId = carousel.ImgId;
+ var ArticleId = carousel.ArticleId;
+ var AddOrRemove = _carouselRepostisory.Table.Where(x => x.ArticleId == ArticleId).FirstOrDefault();
+ if (AddOrRemove == null)
+ {
+ var res = new Carousel
+ {
+ ImgId = ImgId,
+ ArticleId = ArticleId
+ };
+
+ _carouselRepostisory.Insert(res);
+ return new
+ {
+ code = 200,
+ msg = "修改成功"
+ };
+ }
+ else
+ {
+ var CarouselId = AddOrRemove.Id;
+ _carouselRepostisory.Deleted(CarouselId);
+ return new
+ {
+ code = 200,
+ msg = "修改成功"
+ };
+ }
+
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Controllers/AuthenticationController.cs b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Controllers/AuthenticationController.cs
new file mode 100644
index 0000000000000000000000000000000000000000..a33caaf72dbd83d7fe962e93f3f40ef692f2e921
--- /dev/null
+++ b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Controllers/AuthenticationController.cs
@@ -0,0 +1,58 @@
+using System;
+using ArticleManagementSystem.Api.Entity;
+using ArticleManagementSystem.Api.Params;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Configuration;
+using ArticleManagementSystem.Api.Utils;
+
+namespace ArticleManagementSystem.Api.Controllers
+{
+ [ApiController]
+ [Route("[controller]")]
+ // token
+ public class AuthenticationController : ControllerBase
+ {
+ private TokenParameter _tokenParameter = new TokenParameter();
+ private IConfiguration _iconfiguration;
+ public AuthenticationController(IConfiguration iconfiguration)
+ {
+ _iconfiguration = iconfiguration;
+
+ _tokenParameter =_iconfiguration.GetSection("TokenParameter").Get();
+ }
+
+
+ [HttpPost, Route("requestToken")]
+ public ActionResult RequestToken([FromBody] Users request)
+ {
+ //生成Token和RefreshToken
+ var token = TokenHelper.GenUserToken(_tokenParameter, request.Username);
+ var refreshToken = "123456";
+ return Ok(new[] { token, refreshToken });
+ }
+
+ //刷新token
+ [HttpPost,Route("refreshToken")]
+ public dynamic RefreshToken(RefreshTokenDTO refresh)
+ {
+ var username=TokenHelper.ValidateToken(_tokenParameter,refresh);
+ if(string.IsNullOrEmpty(username)){
+ return new
+ {
+ HashCode=104,
+ Data="",
+ Msg="token验证失败"
+ };
+ }
+ var token=TokenHelper.GenUserToken(_tokenParameter,username);
+ var refreshToken="123456";
+
+ return new
+ {
+ Code=200,
+ Data=new{token=token,refreshToken=refreshToken},
+ Msg="刷新token成功"
+ };
+ }
+ }
+}
\ No newline at end of file
diff --git a/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Controllers/CarouselsController.cs b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Controllers/CarouselsController.cs
new file mode 100644
index 0000000000000000000000000000000000000000..d1688790224cb5e08303adc25cf85a5757c35cbb
--- /dev/null
+++ b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Controllers/CarouselsController.cs
@@ -0,0 +1,51 @@
+using System.Collections;
+using System.Linq;
+using ArticleManagementSystem.Api.Entity;
+using ArticleManagementSystem.Api.Repostisory;
+using Microsoft.AspNetCore.Mvc;
+
+namespace ArticleManagementSystem.Api.Controllers
+{
+ [ApiController]
+ [Route("[controller]")]
+ public class CarouselsController : ControllerBase
+ {
+ private readonly IRepostisory _carouselRepostisory;
+ private readonly IRepostisory _imgsRepostisory;
+
+ public CarouselsController(IRepostisory carouselRepostisory, IRepostisory imgsRepostisory)
+ {
+ _carouselRepostisory = carouselRepostisory;
+ _imgsRepostisory = imgsRepostisory;
+ }
+
+ [HttpGet, Route("list")]
+ public dynamic GetCarousels()
+ {
+ var Carousels = _carouselRepostisory.Table.ToList();
+ var imgs = _imgsRepostisory.Table;
+ ArrayList list = new ArrayList();
+ foreach (var item in Carousels)
+ {
+ var img = imgs.Where(x => x.Id == item.ImgId).FirstOrDefault();
+ var tmp = new
+ {
+ id = item.Id,
+ ArticleId = item.ArticleId,
+ imgPath = img != null ? img.ImgsPath : ""
+ };
+
+ list.Add(tmp);
+ }
+
+ return new
+ {
+
+ code = 200,
+ data = list,
+ msg = "获取轮播图成功"
+ };
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Controllers/CommentController.cs b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Controllers/CommentController.cs
new file mode 100644
index 0000000000000000000000000000000000000000..9ae1357f76f461a39a2121c8abe9ed2a8e4d802b
--- /dev/null
+++ b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Controllers/CommentController.cs
@@ -0,0 +1,105 @@
+using System.Collections;
+using System.Linq;
+using ArticleManagementSystem.Api.Entity;
+using ArticleManagementSystem.Api.Params;
+using ArticleManagementSystem.Api.Repostisory;
+using Microsoft.AspNetCore.Mvc;
+
+namespace ArticleManagementSystem.Api.Controllers
+{
+ [ApiController]
+ [Route("[Controller]")]
+ public class CommentController : ControllerBase
+ {
+ private readonly IRepostisory _commentRepostisory;
+ private readonly IRepostisory _usersRepostisory;
+ public CommentController(IRepostisory usersRepostisory, IRepostisory commentRepostisory)
+ {
+ _commentRepostisory = commentRepostisory;
+ _usersRepostisory = usersRepostisory;
+ }
+ ///
+ /// 发布评论
+ ///
+ ///
+ ///
+ [HttpPost, Route("toComment")]
+ public dynamic CommentMsg(ComMsg msg)
+ {
+ //文章id
+ var ArticleId = msg.ArticleId;
+ //用户id
+ var UserId = msg.UserId;
+ //对评论id
+ var ToCommentId = msg.ToCommentId;
+ //评论内容
+ var Content = msg.Content;
+ var res = new Comment
+ {
+ ArticleId = ArticleId,
+ FromUserId = UserId,
+ ToCommentId = ToCommentId,
+ Content = Content
+ };
+ _commentRepostisory.Insert(res);
+ return new
+ {
+ code = 200,
+ data = res,
+ msg = "评论成功"
+ };
+ }
+
+ //获取对应评论
+ [HttpGet, Route("{id}/getComment")]
+ public dynamic GetCommentMsg(int id)
+ {
+
+ var ArticleId = id;
+ var CommentTable = _commentRepostisory.Table;
+ var ArticleComment = CommentTable.Where(x => x.ArticleId == ArticleId).ToList();
+ var users = _usersRepostisory.Table;
+
+ ArrayList list = new ArrayList();
+ foreach (var item in ArticleComment)
+ {
+ var user = users.Where(x => x.Id == item.FromUserId).FirstOrDefault();
+ var comment = CommentTable.Where(x => x.Id == item.ToCommentId).FirstOrDefault();
+ var ArticleComments = CommentTable.Where(x => x.Id == item.Id).FirstOrDefault();
+ if (comment != null)
+ {
+ var toUser = users.Where(x => x.Id == comment.FromUserId).FirstOrDefault();
+ var tep = new
+ {
+ Id = ArticleComments.Id,
+ CommentFormUsername = user.Username,
+ CommentConent = item.Content,
+ ToCommentId = item.ToCommentId,
+ CommentToUsername = toUser != null ? toUser.Username : ""
+ };
+ list.Add(tep);
+ }
+ else
+ {
+ var tep = new
+ {
+ Id = ArticleComments.Id,
+ CommentFormUsername = user.Username,
+ CommentConent = item.Content,
+ ToCommentId = item.ToCommentId,
+ CommentToUsername = ""
+ };
+ list.Add(tep);
+ }
+
+ }
+
+ return new
+ {
+ code = 200,
+ data = list,
+ mag = "获取成功"
+ };
+ }
+ }
+}
\ No newline at end of file
diff --git a/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Controllers/FileUploadProcessingController.cs b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Controllers/FileUploadProcessingController.cs
new file mode 100644
index 0000000000000000000000000000000000000000..51d57a06d49dafdb72b453a1978ab463ac1bac9a
--- /dev/null
+++ b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Controllers/FileUploadProcessingController.cs
@@ -0,0 +1,46 @@
+using ArticleManagementSystem.Api.Entity;
+using ArticleManagementSystem.Api.Repostisory;
+using ArticleManagementSystem.Api.Utils;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+
+namespace ArticleManagementSystem.Api.Controllers
+{
+ [ApiController]
+ [Route("[Controller]")]
+ public class FileUploadProcessingController : ControllerBase
+ {
+ private readonly IRepostisory _imgsRepostisory;
+ private readonly IWebHostEnvironment _iWebHostEnvironment;
+
+
+ public FileUploadProcessingController(IRepostisory imgsRepostisory, IWebHostEnvironment iWebHostEnvironment)
+ {
+ _imgsRepostisory = imgsRepostisory;
+ _iWebHostEnvironment = iWebHostEnvironment;
+ }
+
+ [HttpPost, Route("FileUpload")]
+ public dynamic FileUpload()
+ {
+ var file = Request.Form.Files;
+ var filePath = FilesHelper.UpImgs(file, _iWebHostEnvironment, _imgsRepostisory);
+ var sql = new Imgs
+ {
+ ImgsPath = filePath
+ };
+ _imgsRepostisory.Insert(sql);
+ return sql;
+ }
+
+ [HttpGet,Route("imgs")]
+ public dynamic Getimgs(){
+ var imgs = _imgsRepostisory.Table;
+
+ return new {
+ imgs
+ };
+ }
+ }
+}
\ No newline at end of file
diff --git a/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Controllers/LikeController.cs b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Controllers/LikeController.cs
new file mode 100644
index 0000000000000000000000000000000000000000..ee4f8922b41995d877389f50331daffeb8300de1
--- /dev/null
+++ b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Controllers/LikeController.cs
@@ -0,0 +1,100 @@
+using System.Linq;
+using ArticleManagementSystem.Api.Entity;
+using ArticleManagementSystem.Api.Params;
+using ArticleManagementSystem.Api.Repostisory;
+using Microsoft.AspNetCore.Mvc;
+
+namespace ArticleManagementSystem.Api.Controllers
+{
+ [ApiController]
+ [Route("[controller]")]
+ public class LikeController : ControllerBase
+ {
+ private readonly IRepostisory _likeRepostisory;
+
+ public LikeController(IRepostisory likeRepostisory)
+ {
+ _likeRepostisory = likeRepostisory;
+ }
+
+ ///
+ /// 获取点赞表
+ ///
+ ///
+ [HttpGet]
+ public dynamic GetLike()
+ {
+ var like = _likeRepostisory.Table.GroupBy(p => new { p.ArticleId })
+ .Select(p => new { ArticleId = p.Key.ArticleId, count = p.Sum(s => 1) }).ToList();
+
+ return new
+ {
+ code = 200,
+ data = like,
+ msg = "请求成功"
+ };
+ }
+ ///
+ /// 通过id获取点赞表
+ ///
+ ///
+ [HttpGet("{id}")]
+ public dynamic ToIdGetLike(int id)
+ {
+ var like = _likeRepostisory.Table.Where(x => x.ArticleId == id).GroupBy(p => new { p.ArticleId })
+ .Select(p => new { ArticleId = p.Key.ArticleId, count = p.Sum(s => 1) }).ToList();
+
+ return new
+ {
+ code = 200,
+ data = like,
+ msg = "请求成功"
+ };
+ }
+
+
+ ///
+ /// 点赞和去消点赞
+ ///
+ ///
+ ///
+ ///
+ [HttpPost]
+ public dynamic PostLike(GetLike getLike)
+ {
+ var userId = getLike.UserId;
+ var articleId = getLike.ArticleId;
+ var like = _likeRepostisory.Table;
+ var isUser = _likeRepostisory.Table.Where(x => x.UserId == userId && x.ArticleId == articleId).FirstOrDefault();
+
+ if (isUser == null)
+ {
+ var addLike = new Like
+ {
+ UserId = userId,
+ ArticleId = articleId,
+ };
+ _likeRepostisory.Insert(addLike);
+ return new
+ {
+ code = 200,
+ data = true,
+ msg = "点赞成功"
+ };
+
+
+ }
+ else
+ {
+ _likeRepostisory.Deleted(isUser.Id);
+ return new
+ {
+ code = 404,
+ data = false,
+ msg = "取消点赞"
+ };
+ }
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Controllers/PageviwesController.cs b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Controllers/PageviwesController.cs
new file mode 100644
index 0000000000000000000000000000000000000000..85adb7984213260e38ee8b37cee4dc709162461e
--- /dev/null
+++ b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Controllers/PageviwesController.cs
@@ -0,0 +1,126 @@
+using System.Collections;
+using System.Linq;
+using ArticleManagementSystem.Api.Entity;
+using ArticleManagementSystem.Api.Params;
+using ArticleManagementSystem.Api.Repostisory;
+using Microsoft.AspNetCore.Mvc;
+
+namespace ArticleManagementSystem.Api.Controllers
+{
+
+ [ApiController]
+ [Route("[controller]")]
+ public class PageviwesController : ControllerBase
+ {
+ private readonly IRepostisory _pageviwesRepostisory;
+ private readonly IRepostisory _articleRepostisory;
+
+ public PageviwesController(IRepostisory articleRepostisory, IRepostisory pageviwesRepostisory)
+ {
+ _pageviwesRepostisory = pageviwesRepostisory;
+ _articleRepostisory = articleRepostisory;
+ }
+
+
+ ///
+ /// 获取浏览量表
+ ///
+ ///
+ [HttpGet]
+ public dynamic GetPageviews()
+ {
+ var page = _pageviwesRepostisory.Table.GroupBy(p => new { p.ArticleId })
+ .Select(p => new { ArticleId = p.Key.ArticleId, count = p.Sum(s => 1) })
+ .OrderByDescending(x => x.count).ToList();
+ var article = _articleRepostisory.Table;
+ ArrayList arrlist = new ArrayList();
+ foreach (var item in page)
+ {
+ var articleMsg = article.Where(x => x.Id == item.ArticleId).FirstOrDefault();
+ if (articleMsg != null)
+ {
+ arrlist.Add(articleMsg);
+ }
+
+ }
+ return new
+ {
+ code = 200,
+ data = arrlist,
+ count = page,
+ msg = "请求成功"
+ };
+ }
+
+
+ ///
+ /// 添加浏览量
+ ///
+ ///
+ [HttpPost]
+ public dynamic PostPageviews(GetLike getLike)
+ {
+ var userId = getLike.UserId;
+ var articleId = getLike.ArticleId;
+ var page = _pageviwesRepostisory.Table;
+ if (userId > 0 && articleId > 0)
+ {
+
+ var addPageView = new Pageviwes
+ {
+ UserId = userId,
+ ArticleId = articleId
+ };
+
+ _pageviwesRepostisory.Insert(addPageView);
+
+ return new
+ {
+ code = 200,
+ data = page,
+ msg = "浏览量 + 1"
+ };
+ }
+ else if (userId < 0 && articleId > 0)
+ {
+ var addPageView = new Pageviwes
+ {
+ UserId = 0,
+ ArticleId = articleId
+ };
+ _pageviwesRepostisory.Insert(addPageView);
+ return new
+ {
+ code = 200,
+ data = page,
+ msg = "游客状态添加浏览量"
+ };
+ }
+ else if (userId > 0 && articleId < 0)
+ {
+ return new
+ {
+ code = 404,
+ data = "",
+ msg = "!!!"
+ };
+ }
+ else if (userId < 0 && articleId < 0)
+ {
+ return new
+ {
+ code = 404,
+ data = "",
+ msg = "!!!!!"
+ };
+ }
+
+ return new
+ {
+ code = 1000,
+ data = "",
+ msg = "!!!!"
+ };
+ }
+ }
+}
\ No newline at end of file
diff --git a/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Controllers/RecommendController.cs b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Controllers/RecommendController.cs
new file mode 100644
index 0000000000000000000000000000000000000000..fcff41bbf3d6dbf29d3a36519032a76352c742e4
--- /dev/null
+++ b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Controllers/RecommendController.cs
@@ -0,0 +1,171 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using ArticleManagementSystem.Api.Entity;
+using ArticleManagementSystem.Api.Params;
+using ArticleManagementSystem.Api.Repostisory;
+using Microsoft.AspNetCore.Mvc;
+using ArticleManagementSystem.Api.Db;
+using Microsoft.EntityFrameworkCore;
+using ArticleManagementSystem.Api.Utils;
+
+namespace ArticleManagementSystem.Api.Controllers
+{
+ [ApiController]
+ [Route("[Controller]")]
+ public class RecommendController : ControllerBase
+ {
+ private readonly IRepostisory _articleRepostisory;
+ private readonly IRepostisory _recommendRepostisory;
+ private readonly IRepostisory _auditInfoRepostisory;
+ private readonly IRepostisory _commentRepostisory;
+ private readonly DataBase _context;
+
+ public RecommendController(DataBase context, IRepostisory commentRepostisory, IRepostisory auditInfoRepostisory, IRepostisory articleRepostisory, IRepostisory recommendRepostisory)
+ {
+ _articleRepostisory = articleRepostisory;
+ _recommendRepostisory = recommendRepostisory;
+ _auditInfoRepostisory = auditInfoRepostisory;
+ _commentRepostisory = commentRepostisory;
+ _context = context;
+
+ }
+
+ //管理员添加推荐文章
+ [HttpPost, Route("EditRecommend")]
+ public dynamic EditRecommend(EditRecommend edit)
+ {
+ var adminid = edit.AdminId;
+ var aricleid = edit.ArticleId;
+
+ var isadd = _recommendRepostisory.Table.Where(x => x.AricleId == aricleid).FirstOrDefault();
+ if (isadd != null)
+ {
+ var id = isadd.Id;
+ _recommendRepostisory.Deleted(id);
+ return new
+ {
+ code = 200,
+ data = false,
+ msg = "取消推荐"
+ };
+ }else{
+ var res = new Recommend
+ {
+ AdminId = adminid,
+ AricleId = aricleid
+ };
+
+ _recommendRepostisory.Insert(res);
+
+ return new
+ {
+ code = 200,
+ data = true,
+ list = res,
+ msg = "设为推荐"
+ };
+ }
+
+ }
+
+
+ //获取管理员推荐
+ [HttpGet, Route("AdminRecommend")]
+ public dynamic AdminRecommend()
+ {
+ var RecommendTime = DateTime.Now.AddDays(-10);
+ var Table = _recommendRepostisory.Table;
+ var AdminRecommendMsg = Table.Where(x => x.CreatedTime > RecommendTime).ToList();
+ ArrayList reslist = new ArrayList();
+ foreach (var item in AdminRecommendMsg)
+ {
+ var ArticleMsg = _articleRepostisory.Table.Where(x => x.Id == item.AricleId).FirstOrDefault();
+ if (ArticleMsg != null)
+ {
+ reslist.Add(ArticleMsg);
+ }
+ }
+ return new
+ {
+ code = 200,
+ data = reslist,
+ msg = "获取成功"
+ };
+ }
+
+ ///
+ /// 浏览量文章推荐
+ ///
+ ///
+ [HttpGet, Route("BrowseRecommend")]
+ public dynamic BrowseRecommend()
+ {
+ var RecommendTime = DateTime.Now.AddDays(-2);
+ var Pageviwes = _context.Pageviwes.Include(Pageviwes => Pageviwes.Articles).AsSplitQuery().ToList();
+ var groupByMsg = Pageviwes.Where(x => x.CreatedTime > RecommendTime).GroupBy(p => new { p.ArticleId })
+ .Select(p => new { ArticleId = p.Key.ArticleId, count = p.Sum(s => 1) }).ToList();
+
+ ArrayList ArticleMsg = new ArrayList();
+ foreach (var item in groupByMsg)
+ {
+ ArticleMsg.Add(item.ArticleId);
+ }
+ var res = ArticleSelectHelper.GetArticleMsg(ArticleMsg, _context);
+ return new
+ {
+ code = 200,
+ data = res,
+ msg = "获取成功"
+ };
+ }
+
+ ///
+ /// 热评文章推荐
+ ///
+ ///
+ [HttpGet, Route("CommentRecommend")]
+ public dynamic CommentRecommend()
+ {
+ // var ArticleId = msg.ArticleId;
+ var RecommendTime = DateTime.Now.AddDays(-2);
+ var comment = _commentRepostisory.Table;
+ var groupByMsg = comment.Where(x => x.CreatedTime > RecommendTime).GroupBy(p => new { p.ArticleId })
+ .Select(p => new { ArticleId = p.Key.ArticleId, count = p.Sum(s => 1) }).OrderByDescending(x => x.count).ToList();
+ ArrayList ArticleMsg = new ArrayList();
+ foreach (var item in groupByMsg)
+ {
+ // ArticleMsg.Add(item.ArticleId);
+ var commentRecommendArticle = _context.article.Where(x => x.Id == item.ArticleId).FirstOrDefault();
+ if (commentRecommendArticle != null)
+ {
+ ArticleMsg.Add(commentRecommendArticle);
+ }
+ }
+ // var res = ArticleSelectHelper.GetArticleMsg(ArticleMsg, _context);
+ return new
+ {
+ code = 200,
+ data = ArticleMsg,
+ count = groupByMsg,
+ msg = "获取成功"
+ };
+ }
+
+ ///
+ /// 获取审计日志
+ ///
+ ///
+ [HttpGet, Route("AuditInfo")]
+ public dynamic GetAuditInfo()
+ {
+ var table = _auditInfoRepostisory.Table;
+ return new
+ {
+ table
+ };
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Controllers/UsersController.cs b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Controllers/UsersController.cs
new file mode 100644
index 0000000000000000000000000000000000000000..e05ca4811e4cb1e34dd965580c03ccac233aaf45
--- /dev/null
+++ b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Controllers/UsersController.cs
@@ -0,0 +1,528 @@
+using System.Linq;
+using ArticleManagementSystem.Api.Entity;
+using ArticleManagementSystem.Api.Params;
+using ArticleManagementSystem.Api.Repostisory;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+using ArticleManagementSystem.Api.Utils;
+using Microsoft.Extensions.Configuration;
+
+namespace ArticleManagementSystem.Api.Controllers
+{
+ //获取token权限
+ // [Authorize]
+
+ [ApiController]
+ [Route("[controller]")]
+ public class UsersController : ControllerBase
+ {
+ private readonly IRepostisory _usersRepostisory;
+ private readonly IRepostisory _adminRepostisory;
+ private IConfiguration _configuration;
+ private TokenParameter _tokenParameter;
+
+ public UsersController(IConfiguration configuration,IRepostisory userRepostisoy, IRepostisory adminRepostisory)
+ {
+ _usersRepostisory = userRepostisoy;
+ _adminRepostisory = adminRepostisory;
+ _configuration = configuration;
+ _tokenParameter = _configuration.GetSection("TokenParameter").Get();
+ }
+
+ [HttpGet, Route("getusers")]
+ // 查询用户列表
+ public dynamic Get()
+ {
+ var users = _usersRepostisory.Table;
+ return new
+ {
+ Code = 200,
+ Data = users,
+ Msg = "获取用户信息成功"
+ };
+ }
+
+ //查询管理员
+ [HttpGet, Route("getadmins")]
+ public dynamic adminGet()
+ {
+ var users = _adminRepostisory.Table;
+ var res = new
+ {
+ Code = 200,
+ Data = users,
+ Msg = "获取用户信息成功"
+ };
+ return JsonHelper.Serialize(res);
+ }
+
+
+ // 注册
+ [AllowAnonymous]
+ [HttpPost, Route("registry")]
+ public dynamic Post(CreateUsers newUser)
+ {
+ var Username = newUser.Username.Trim();
+ var Password = newUser.Password.Trim();
+ var RePassword = newUser.RePassword.Trim();
+
+
+ if (!string.IsNullOrEmpty(Username) && !string.IsNullOrEmpty(Password))
+ {
+
+ if (!Password.Equals(RePassword))
+ {
+ return new
+ {
+ code = 200,
+ data = "",
+ msg = "两次输入的密码不一致"
+ };
+ }
+
+ var users = _usersRepostisory.Table;
+ var isHaveUser = users.Where(x => x.Username.Equals(Username)).ToList();
+
+ if (isHaveUser.Count() == 0)
+ {
+ var addUser = new Users
+ {
+ Password = Password,
+ Username = Username
+ };
+
+ _usersRepostisory.Insert(addUser);
+
+ return new
+ {
+ code = 200,
+ data = addUser,
+ msg = "用户创建成功"
+ };
+ }
+ else
+ {
+ //该用户已存在
+ return new
+ {
+ code = 104,
+ data = "",
+ msg = "该用户已存在"
+ };
+ }
+
+ }
+ else
+ {
+ //用户名密码不能为空
+ return new
+ {
+ code = 104,
+ data = "",
+ msg = "用户名密码不能为空"
+ };
+ }
+ }
+
+
+ // 登录
+ // [AllowAnonymous]
+ // [HttpPost, Route("login")]
+ // public dynamic post(Login login)
+ // {
+ // var Username = login.Username.Trim();
+ // var Password = login.Password.Trim();
+
+ // if (!string.IsNullOrEmpty(Username) && !string.IsNullOrEmpty(Password))
+ // {
+ // var user = _usersRepostisory.Table;
+ // var u = user.Where(x => x.Username.Equals(Username) && x.Password.Equals(Password));
+
+ // if (u.Count() != 0)
+ // {
+ // if (u.FirstOrDefault().IsActived == false)
+ // {
+ // return new
+ // {
+ // code = 200,
+ // data = u,
+ // msg = "该用户已被注销"
+ // };
+ // }
+ // return new
+ // {
+ // code = 200,
+ // data = u,
+ // msg = "登陆成功"
+ // };
+ // }
+ // else
+ // {
+ // return new
+ // {
+ // code = 104,
+ // data = u,
+ // msg = "用户名密码错误"
+ // };
+ // }
+ // }
+ // else
+ // {
+ // return new
+ // {
+ // code = 104,
+ // msg = "请输入用户名密码"
+ // };
+ // }
+ // }
+
+
+ //获取用户token登录
+ [AllowAnonymous]
+ [HttpPost, Route("userstoken")]
+ public dynamic GetUsersToken(Login login)
+ {
+ var Username = login.Username.Trim();
+ var Password = login.Password.Trim();
+ var user = _usersRepostisory.Table.Where(x => x.Username == Username && x.Password == Password).FirstOrDefault();
+
+ if (user == null)
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "用户名或密码不正确 请确认充实"
+ };
+ }
+ var userid = user.Id;
+ var userName = user.Username;
+ var token = TokenHelper.GenUserToken(_tokenParameter, user.Username);
+
+ var refreshToken = "123456789";
+
+ return new
+ {
+ Code = 1000,
+ Data = new { Token = token, refreshToken = refreshToken ,UserId = userid,Username = userName},
+ Msg = "登录成功"
+ };
+
+ // if (!string.IsNullOrEmpty(Username) && !string.IsNullOrEmpty(Password))
+ // {
+ // var user = _usersRepostisory.Table;
+ // var u = user.Where(x => x.Username.Equals(Username) && x.Password.Equals(Password));
+
+ // if (u.Count() != 0)
+ // {
+ // if (u.FirstOrDefault().IsActived == false)
+ // {
+ // return new
+ // {
+ // code = 200,
+ // data = u,
+ // msg = "该用户已被注销"
+ // };
+ // }
+ // var token = TokenHelper.GenUserToken(_tokenParameter, u.Username);
+
+ // var refreshToken = "123456789";
+ // return new
+ // {
+ // code = 200,
+ // data = u,
+ // msg = "登陆成功"
+ // };
+ // }
+ // else
+ // {
+ // return new
+ // {
+ // code = 104,
+ // data = u,
+ // msg = "用户名密码错误"
+ // };
+ // }
+ // }
+ // else
+ // {
+ // return new
+ // {
+ // code = 104,
+ // msg = "请输入用户名密码"
+ // };
+ // }
+ }
+
+
+ //刷新重新获取token,refreshToken
+ [AllowAnonymous]
+ [HttpPost, Route("userRefreshToken")]
+ public dynamic UserRefreshTokenPost(RefreshTokenDTO refresh)
+ {
+ var user = TokenHelper.ValidateToken(_tokenParameter, refresh);
+
+ if (string.IsNullOrEmpty(user))
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "userRefreshToken验证失败"
+ };
+ }
+ var token = TokenHelper.GenUserToken(_tokenParameter, user);
+
+ var refreshToken = "123456789";
+
+ return new
+ {
+ Code = 200,
+ Data = new{ Token = token, refreshToken = refreshToken },
+ Msg = "刷新重新获取token,refreshToken成功"
+ };
+ }
+
+
+ //管理员登录
+ [AllowAnonymous]
+ [HttpPost, Route("adminLogin")]
+ public dynamic adminpost(AdminUsers admin)
+ {
+ var AdminUsername = admin.AdminUsername.Trim();
+ var AdminPassword = admin.AdminPassword.Trim();
+
+ if (!string.IsNullOrEmpty(AdminUsername) && !string.IsNullOrEmpty(AdminPassword))
+ {
+ var user = _adminRepostisory.Table;
+ var u = user.Where(x => x.AdminUsername.Equals(AdminUsername) && x.AdminPassword.Equals(AdminPassword));
+
+ if (u.Count() != 0)
+ {
+ if (u.FirstOrDefault().IsActived == false)
+ {
+ return new
+ {
+ code = 104,
+ data = u,
+ msg = "该用户已被注销"
+ };
+ }
+ return new
+ {
+ code = 200,
+ data = u,
+ msg = "登陆成功"
+ };
+ }
+ else
+ {
+ return new
+ {
+ code = 104,
+ data = u,
+ msg = "用户名密码错误"
+ };
+ }
+ }
+ else
+ {
+ return new
+ {
+ code = 104,
+ msg = "请输入用户名密码"
+ };
+ }
+ }
+
+
+ //分配管理员
+ [AllowAnonymous]
+ [HttpPost, Route("administrators")]
+ public dynamic Post(CreateAdministrators administrators)
+ {
+ // var res = new Admin
+ // {
+ // AdminUsername = "admin",
+ // AdminPassword = "999"
+ // };
+ // _adminRepostisory.Insert(res);
+ // return res;
+
+ var username = administrators.Username.Trim();
+ var password = administrators.Password.Trim();
+
+ var user = _adminRepostisory.Table;
+ // var v = user.Where(x => x.AdminPassword.Equals(password)).FirstOrDefault();
+
+
+
+ if (!string.IsNullOrEmpty(password) && !string.IsNullOrEmpty(username))
+ {
+
+ var addadministrators = new Admin
+ {
+ AdminUsername = username,
+ AdminPassword = password
+ };
+ _adminRepostisory.Insert(addadministrators);
+ return JsonHelper.Serialize(new
+ {
+ Code = 200,
+ Data = addadministrators,
+ Msg = "创建管理员成功"
+ });
+
+ }
+ else
+ {
+ return new
+ {
+ Code = 104,
+ Data = "",
+ Msg = "创建管理员错误"
+ };
+ }
+ }
+
+ //修改用户密码
+ [HttpPut, Route("{id}/userpassword")]
+ public dynamic Put(int id, ChangeUsers changeUsers)
+ {
+ var username = changeUsers.Username.Trim();
+ var password = changeUsers.Password.Trim();
+
+ if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
+ {
+ return new
+ {
+ Code = "104",
+ Data = "",
+ Msg = "用户名或密码不能为空"
+ };
+ }
+ else
+ {
+ var users = _usersRepostisory.GetById(id);
+ if (users == null)
+ {
+ return new
+ {
+ Code = "104",
+ Data = "",
+ Msg = "需要修改的用户不存在"
+ };
+ }
+ users.Username = changeUsers.Username;
+ users.Password = changeUsers.Password;
+
+ _usersRepostisory.Updated(users);
+ return JsonHelper.Serialize(new
+ {
+ Code = 1000,
+ Data = users,
+ Msg = "更新成功"
+ });
+ }
+ }
+
+
+
+ //admin修改密码
+ [HttpPut, Route("{id}/adminpassword")]
+ public dynamic adminPut(int id, ChangeAdmin changeAdmin)
+ {
+ var username = changeAdmin.adminUsername.Trim();
+ var password = changeAdmin.adminPassword.Trim();
+
+ if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
+ {
+ return new
+ {
+ Code = "104",
+ Data = "",
+ Msg = "用户名或密码不能为空"
+ };
+ }
+ else
+ {
+ var users = _adminRepostisory.GetById(id);
+ if (users == null)
+ {
+ return new
+ {
+ Code = "104",
+ Data = "",
+ Msg = "需要修改的用户不存在"
+ };
+ }
+ users.AdminUsername = changeAdmin.adminUsername;
+ users.AdminPassword = changeAdmin.adminPassword;
+
+ _adminRepostisory.Updated(users);
+
+ return JsonHelper.Serialize(new
+ {
+ Code = 1000,
+ Data = users,
+ Msg = "更新管理员成功"
+ });
+ }
+ }
+
+ //删除admin
+ [HttpDelete("{id}")]
+ public dynamic Delete(int id)
+ {
+ _adminRepostisory.Deleted(id);
+ return new
+ {
+ Code = 200,
+ Data = "",
+ Msg = "删除管理员成功"
+ };
+ }
+
+
+
+ //封号(冻结用户)
+ // [HttpPut("{id}")]
+ // public dynamic Put(int id, DeleteUsers deleteUsers)
+ // {
+ // var username = deleteUsers.Username.Trim();
+ // var password = deleteUsers.Password.Trim();
+ // if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
+ // {
+ // return new
+ // {
+ // Code = 104,
+ // Data = "",
+ // Msg = "用户名或密码不能为空"
+ // };
+ // }
+
+ // var user = _usersRepostisory.GetById(id);
+
+ // if (user == null)
+ // {
+ // return new
+ // {
+ // Code = 104,
+ // Data = "",
+ // Msg = "要注销的用户不存在,请确认后重试"
+ // };
+ // };
+ // user.IsActived = false;
+
+ // _usersRepostisory.Updated(user);
+
+
+ // return new
+ // {
+ // StatusCode = 200,
+ // Data = user,
+ // Msg = "封号十年!!!"
+ // };
+ // }
+ }
+}
\ No newline at end of file
diff --git a/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Controllers/WeatherForecastController.cs b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Controllers/WeatherForecastController.cs
new file mode 100644
index 0000000000000000000000000000000000000000..1575b6dc4f0c8c8507343edcf0cc4de73c6065b2
--- /dev/null
+++ b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Controllers/WeatherForecastController.cs
@@ -0,0 +1,39 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Logging;
+
+namespace ArticleManagementSystem.Api.Controllers
+{
+ [ApiController]
+ [Route("[controller]")]
+ public class WeatherForecastController : ControllerBase
+ {
+ private static readonly string[] Summaries = new[]
+ {
+ "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
+ };
+
+ private readonly ILogger _logger;
+
+ public WeatherForecastController(ILogger logger)
+ {
+ _logger = logger;
+ }
+
+ [HttpGet]
+ public IEnumerable Get()
+ {
+ var rng = new Random();
+ return Enumerable.Range(1, 5).Select(index => new WeatherForecast
+ {
+ Date = DateTime.Now.AddDays(index),
+ TemperatureC = rng.Next(-20, 55),
+ Summary = Summaries[rng.Next(Summaries.Length)]
+ })
+ .ToArray();
+ }
+ }
+}
diff --git a/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Db/DataBase.cs b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Db/DataBase.cs
new file mode 100644
index 0000000000000000000000000000000000000000..651470a6f009c1ccbf1be2d055d3c077b2f952ac
--- /dev/null
+++ b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Db/DataBase.cs
@@ -0,0 +1,30 @@
+using ArticleManagementSystem.Api.Entity;
+using Microsoft.EntityFrameworkCore;
+
+namespace ArticleManagementSystem.Api.Db
+{
+ public class DataBase:DbContext
+ {
+ public DataBase(){
+
+ }
+ public DataBase (DbContextOptions options) : base (options){
+
+ }
+ public DbSet admin {get;set;}
+ public DbSet article {get;set;}
+ public DbSet auditInfo {get;set;}
+ public DbSet carousel {get;set;}
+ public DbSet imgs {get;set;}
+ public DbSet users {get;set;}
+ public DbSet Comments {get;set;}
+ public DbSet Recommends {get;set;}
+ public DbSet Like {get;set;}
+ public DbSet Pageviwes {get;set;}
+
+ protected override void OnConfiguring(DbContextOptionsBuilder options)
+ {
+ options.UseNpgsql(@"server=47.113.121.34;database=CMS;uid=postgres;pwd=XiongYY200012152841735357***;");
+ }
+ }
+}
\ No newline at end of file
diff --git a/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Entity/Admin.cs b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Entity/Admin.cs
new file mode 100644
index 0000000000000000000000000000000000000000..9a923c843189d0e07cc9859be4e0026e46495b7c
--- /dev/null
+++ b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Entity/Admin.cs
@@ -0,0 +1,8 @@
+namespace ArticleManagementSystem.Api.Entity
+{
+ public class Admin: BaseInit
+ {
+ public string AdminUsername {get;set;}
+ public string AdminPassword{get;set;}
+ }
+}
\ No newline at end of file
diff --git a/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Entity/Article.cs b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Entity/Article.cs
new file mode 100644
index 0000000000000000000000000000000000000000..e894b3c545704da3eb16897ad2fd2147f1d3ab05
--- /dev/null
+++ b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Entity/Article.cs
@@ -0,0 +1,15 @@
+using System.Collections.Generic;
+
+namespace ArticleManagementSystem.Api.Entity
+{
+ public class Article: BaseInit
+ {
+ public string Title {get;set;}
+ public string Content{get;set;}
+ public int UserId{get;set;}
+ public int ImgId{get;set;}
+ public string ArticleDetails{get;set;}
+ public string ArticleType {get;set;}
+
+ }
+}
\ No newline at end of file
diff --git a/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Entity/AuditInfo.cs b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Entity/AuditInfo.cs
new file mode 100644
index 0000000000000000000000000000000000000000..427c034a17ba6f22f82dd257338344918d371042
--- /dev/null
+++ b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Entity/AuditInfo.cs
@@ -0,0 +1,70 @@
+using System;
+
+namespace ArticleManagementSystem.Api.Entity
+{
+ ///
+ /// 角色实体
+ ///
+ public class AuditInfo : BaseInit
+ {
+ ///
+ /// 调用参数
+ ///
+ public string Parameters { get; set; }
+
+ ///
+ /// 浏览器信息
+ ///
+ public string BrowserInfo { get; set; }
+
+ ///
+ /// 客户端信息
+ ///
+ public string ClientName { get; set; }
+
+ ///
+ /// 客户端IP地址
+ ///
+ public string ClientIpAddress { get; set; }
+
+ ///
+ /// 执行耗时
+ ///
+ public int ExecutionDuration { get; set; }
+
+ ///
+ /// 执行时间
+ ///
+ public DateTime ExecutionTime { get; set; }
+
+ ///
+ /// 返回内容
+ ///
+ public string ReturnValue { get; set; }
+
+ ///
+ /// 异常对象
+ ///
+ public string Exception { get; set; }
+
+ ///
+ /// 方法名
+ ///
+ public string MethodName { get; set; }
+
+ ///
+ /// 服务名
+ ///
+ public string ServiceName { get; set; }
+
+ ///
+ /// 调用者信息
+ ///
+ public string UserInfo { get; set; }
+
+ ///
+ /// 自定义数据
+ ///
+ public string CustomData { get; set; }
+ }
+}
diff --git a/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Entity/Avatar.cs b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Entity/Avatar.cs
new file mode 100644
index 0000000000000000000000000000000000000000..9999576ad4d7713e6699789bcbe9b9763585bdbc
--- /dev/null
+++ b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Entity/Avatar.cs
@@ -0,0 +1,11 @@
+using System.Collections.Generic;
+
+namespace ArticleManagementSystem.Api.Entity
+{
+ public class Avatar : BaseInit
+ {
+ public int imgsId { get; set; }
+ public int UserId { get; set; }
+ }
+
+}
\ No newline at end of file
diff --git a/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Entity/BaseInit.cs b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Entity/BaseInit.cs
new file mode 100644
index 0000000000000000000000000000000000000000..13d46364f7a1e20e71f715075fc899108eb88335
--- /dev/null
+++ b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Entity/BaseInit.cs
@@ -0,0 +1,14 @@
+using System;
+
+namespace ArticleManagementSystem.Api.Entity
+{
+ public class BaseInit
+ {
+ public int Id {get;set;}
+ public DateTime CreatedTime{get;set;}
+ public DateTime UpdatedTime{get;set;}
+ public bool IsActived { get; set; }
+ public bool IsDeleted{get;set;}
+ public string Remarks {get;set;}
+ }
+}
\ No newline at end of file
diff --git a/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Entity/Carousel.cs b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Entity/Carousel.cs
new file mode 100644
index 0000000000000000000000000000000000000000..2c630b23f6eec7b5cc1c04e817e310786e8dbd9a
--- /dev/null
+++ b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Entity/Carousel.cs
@@ -0,0 +1,11 @@
+using System.Collections.Generic;
+
+namespace ArticleManagementSystem.Api.Entity
+{
+ public class Carousel: BaseInit
+ {
+ public int ImgId {get;set;}
+ public int ArticleId{get;set;}
+
+ }
+}
\ No newline at end of file
diff --git a/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Entity/Comment.cs b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Entity/Comment.cs
new file mode 100644
index 0000000000000000000000000000000000000000..f97fec35a412e8cf8f179afb5a4e452ea51dd3aa
--- /dev/null
+++ b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Entity/Comment.cs
@@ -0,0 +1,14 @@
+using System.Collections.Generic;
+
+namespace ArticleManagementSystem.Api.Entity
+{
+ public class Comment : BaseInit
+ {
+ public int FromUserId { get; set; }
+ public int ArticleId { get; set; }
+ public string Content { get; set; }
+ public int ToCommentId { get; set; }
+
+ public IEnumerable Articles { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Entity/Imgs.cs b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Entity/Imgs.cs
new file mode 100644
index 0000000000000000000000000000000000000000..f9468ea404b1cb95e60d59853c355f3a898c6692
--- /dev/null
+++ b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Entity/Imgs.cs
@@ -0,0 +1,7 @@
+namespace ArticleManagementSystem.Api.Entity
+{
+ public class Imgs: BaseInit
+ {
+ public string ImgsPath{get;set;}
+ }
+}
\ No newline at end of file
diff --git a/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Entity/Like.cs b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Entity/Like.cs
new file mode 100644
index 0000000000000000000000000000000000000000..fceab7ad0cae1b36623f7978a92c8c33c5bdfa64
--- /dev/null
+++ b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Entity/Like.cs
@@ -0,0 +1,12 @@
+using System.Collections.Generic;
+
+namespace ArticleManagementSystem.Api.Entity
+{
+ public class Like:BaseInit
+ {
+ public int LikeNum{get;set;}
+ public int UserId{get;set;}
+ public int ArticleId{get;set;}
+
+ }
+}
\ No newline at end of file
diff --git a/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Entity/Pageviwes.cs b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Entity/Pageviwes.cs
new file mode 100644
index 0000000000000000000000000000000000000000..269abee96ce1380d311c6d4d860cf2ccc2e49949
--- /dev/null
+++ b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Entity/Pageviwes.cs
@@ -0,0 +1,16 @@
+using System.Collections.Generic;
+
+namespace ArticleManagementSystem.Api.Entity
+{
+ public class Pageviwes:BaseInit
+ {
+ public int PageviwesNum{get;set;}
+
+ public int ArticleId{get;set;}
+ public int UserId{get;set;}
+
+ public IEnumerable Users {get;set;}
+ public IEnumerable Articles {get;set;}
+
+ }
+}
\ No newline at end of file
diff --git a/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Entity/Recommend.cs b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Entity/Recommend.cs
new file mode 100644
index 0000000000000000000000000000000000000000..cbc1dce978c0e88c4bb3ac74a7ad722b0091161c
--- /dev/null
+++ b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Entity/Recommend.cs
@@ -0,0 +1,11 @@
+using System.Collections.Generic;
+
+namespace ArticleManagementSystem.Api.Entity
+{
+ public class Recommend : BaseInit
+ {
+ public int AricleId{get;set;}
+ public int AdminId{get;set;}
+
+ }
+}
\ No newline at end of file
diff --git a/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Entity/Users.cs b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Entity/Users.cs
new file mode 100644
index 0000000000000000000000000000000000000000..7b70aaa078942e7b7f747ee48d86421323eafff0
--- /dev/null
+++ b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Entity/Users.cs
@@ -0,0 +1,11 @@
+using System.Collections.Generic;
+
+namespace ArticleManagementSystem.Api.Entity
+{
+ public class Users : BaseInit
+ {
+ public string Username { get; set; }
+ public string Password { get; set; }
+
+ }
+}
diff --git a/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Filters/AuditLogActionFilter.cs b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Filters/AuditLogActionFilter.cs
new file mode 100644
index 0000000000000000000000000000000000000000..4213cd58536acea4f4429cc313cddf2768f74e89
--- /dev/null
+++ b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Filters/AuditLogActionFilter.cs
@@ -0,0 +1,166 @@
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.Controllers;
+using Microsoft.AspNetCore.Mvc.Filters;
+using Microsoft.Extensions.Logging;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Reflection;
+using System.Threading.Tasks;
+using ArticleManagementSystem.Api.Repostisory;
+using ArticleManagementSystem.Api.Entity;
+
+namespace AuthenticationController.Filters
+{
+ public class AuditLogActionFilter : IAsyncActionFilter
+ {
+ ///
+ /// 审计日志服务对象
+ ///
+ // private readonly IAuditLogService _auditLogService;
+ ///
+ /// 登录用户
+ ///
+ // private readonly ISession _Session;
+ ///
+ /// 日志记录
+ ///
+ private readonly ILogger _logger;
+
+ private readonly IRepostisory _auditLogService;
+
+ public AuditLogActionFilter(
+ // IAuditLogService auditLogService,
+ // ISession Session,
+ ILogger logger,
+ IRepostisory auditLogService
+ )
+ {
+ // _Session = Session;
+ _logger = logger;
+ _auditLogService = auditLogService;
+ }
+
+ public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
+ {
+ // 判断是否写日志
+ if (!ShouldSaveAudit(context))
+ {
+ await next();
+ return;
+ }
+ //接口Type
+ var type = (context.ActionDescriptor as ControllerActionDescriptor).ControllerTypeInfo.AsType();
+ //方法信息
+ var method = (context.ActionDescriptor as ControllerActionDescriptor).MethodInfo;
+ //方法参数
+ var arguments = context.ActionArguments;
+ //开始计时
+ var stopwatch = Stopwatch.StartNew();
+ //用户信息
+ var auditInfo = new AuditInfo
+ {
+ UserInfo = "1",
+ ServiceName = type != null ? type.FullName : "",
+ MethodName = method.Name,
+ ////请求参数转Json
+ Parameters = JsonConvert.SerializeObject(arguments),
+ ExecutionTime = DateTime.Now,
+ BrowserInfo = context.HttpContext.Request.Headers["User-Agent"].ToString(),
+ ClientIpAddress = context.HttpContext.Connection.RemoteIpAddress.ToString(),
+ //ClientName = _clientInfoProvider.ComputerName.TruncateWithPostfix(EntityDefault.FieldsLength100),
+ // Id = Guid.NewGuid().ToString()
+ };
+
+ ActionExecutedContext result = null;
+ try
+ {
+ result = await next();
+ if (result.Exception != null && !result.ExceptionHandled)
+ {
+ auditInfo.Exception = result.Exception.ToString();
+ }
+ }
+ catch (Exception ex)
+ {
+ auditInfo.Exception = ex.ToString();
+ throw;
+ }
+ finally
+ {
+ stopwatch.Stop();
+ auditInfo.ExecutionDuration = Convert.ToInt32(stopwatch.Elapsed.TotalMilliseconds);
+
+ if (result != null)
+ {
+ switch (result.Result)
+ {
+ case ObjectResult objectResult:
+ auditInfo.ReturnValue = JsonConvert.SerializeObject(objectResult.Value);
+ break;
+
+ case JsonResult jsonResult:
+ auditInfo.ReturnValue = JsonConvert.SerializeObject(jsonResult.Value);
+ break;
+
+ case ContentResult contentResult:
+ auditInfo.ReturnValue = contentResult.Content;
+ break;
+ }
+ }
+ //保存审计日志
+ await _auditLogService.InserAsync(auditInfo);
+ }
+ }
+
+ ///
+ /// 是否需要记录审计
+ ///
+ ///
+ ///
+ private bool ShouldSaveAudit(ActionExecutingContext context)
+ {
+ if (!(context.ActionDescriptor is ControllerActionDescriptor))
+ return false;
+ var methodInfo = (context.ActionDescriptor as ControllerActionDescriptor).MethodInfo;
+
+ if (methodInfo == null)
+ {
+ return false;
+ }
+
+ if (!methodInfo.IsPublic)
+ {
+ return false;
+ }
+
+ // if (methodInfo.GetCustomAttribute() != null)
+ // {
+ // return true;
+ // }
+
+ // if (methodInfo.GetCustomAttribute() != null)
+ // {
+ // return false;
+ // }
+
+ // var classType = methodInfo.DeclaringType;
+ // if (classType != null)
+ // {
+ // if (classType.GetTypeInfo().GetCustomAttribute() != null)
+ // {
+ // return true;
+ // }
+
+ // if (classType.GetTypeInfo().GetCustomAttribute() != null)
+ // {
+ // return false;
+ // }
+ // }
+ return true;
+ }
+ }
+}
\ No newline at end of file
diff --git "a/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Migrations/20210804091738_\345\210\235\345\247\213\345\214\226\350\241\250.Designer.cs" "b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Migrations/20210804091738_\345\210\235\345\247\213\345\214\226\350\241\250.Designer.cs"
new file mode 100644
index 0000000000000000000000000000000000000000..8a01308e10bb7ca422f6c85bcb456272d82e91b7
--- /dev/null
+++ "b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Migrations/20210804091738_\345\210\235\345\247\213\345\214\226\350\241\250.Designer.cs"
@@ -0,0 +1,679 @@
+//
+using System;
+using ArticleManagementSystem.Api.Db;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+
+namespace ArticleManagementSystem.Api.Migrations
+{
+ [DbContext(typeof(DataBase))]
+ [Migration("20210804091738_初始化表")]
+ partial class 初始化表
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("Relational:MaxIdentifierLength", 63)
+ .HasAnnotation("ProductVersion", "5.0.8")
+ .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
+
+ modelBuilder.Entity("ArticleManagementSystem.Api.Entity.Admin", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
+
+ b.Property("AdminPassword")
+ .HasColumnType("text");
+
+ b.Property("AdminUsername")
+ .HasColumnType("text");
+
+ b.Property("CreatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("IsActived")
+ .HasColumnType("boolean");
+
+ b.Property("IsDeleted")
+ .HasColumnType("boolean");
+
+ b.Property("RecommendId")
+ .HasColumnType("integer");
+
+ b.Property("Remarks")
+ .HasColumnType("text");
+
+ b.Property("UpdatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.HasKey("Id");
+
+ b.HasIndex("RecommendId");
+
+ b.ToTable("admin");
+ });
+
+ modelBuilder.Entity("ArticleManagementSystem.Api.Entity.Article", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
+
+ b.Property("ArticleDetails")
+ .HasColumnType("text");
+
+ b.Property("ArticleType")
+ .HasColumnType("text");
+
+ b.Property("CommentId")
+ .HasColumnType("integer");
+
+ b.Property("CommentUserId")
+ .HasColumnType("integer");
+
+ b.Property("Content")
+ .HasColumnType("text");
+
+ b.Property("CreatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("GoodUserId")
+ .HasColumnType("integer");
+
+ b.Property("ImgId")
+ .HasColumnType("integer");
+
+ b.Property("IsActived")
+ .HasColumnType("boolean");
+
+ b.Property("IsDeleted")
+ .HasColumnType("boolean");
+
+ b.Property("PageviwesId")
+ .HasColumnType("integer");
+
+ b.Property("RecommendId")
+ .HasColumnType("integer");
+
+ b.Property("Remarks")
+ .HasColumnType("text");
+
+ b.Property("Title")
+ .HasColumnType("text");
+
+ b.Property("UpdatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("UserId")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CommentId");
+
+ b.HasIndex("PageviwesId");
+
+ b.HasIndex("RecommendId");
+
+ b.ToTable("article");
+ });
+
+ modelBuilder.Entity("ArticleManagementSystem.Api.Entity.AuditInfo", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
+
+ b.Property("BrowserInfo")
+ .HasColumnType("text");
+
+ b.Property("ClientIpAddress")
+ .HasColumnType("text");
+
+ b.Property("ClientName")
+ .HasColumnType("text");
+
+ b.Property("CreatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("CustomData")
+ .HasColumnType("text");
+
+ b.Property("Exception")
+ .HasColumnType("text");
+
+ b.Property("ExecutionDuration")
+ .HasColumnType("integer");
+
+ b.Property("ExecutionTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("IsActived")
+ .HasColumnType("boolean");
+
+ b.Property("IsDeleted")
+ .HasColumnType("boolean");
+
+ b.Property("MethodName")
+ .HasColumnType("text");
+
+ b.Property("Parameters")
+ .HasColumnType("text");
+
+ b.Property("Remarks")
+ .HasColumnType("text");
+
+ b.Property("ReturnValue")
+ .HasColumnType("text");
+
+ b.Property("ServiceName")
+ .HasColumnType("text");
+
+ b.Property("UpdatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("UserInfo")
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("auditInfo");
+ });
+
+ modelBuilder.Entity("ArticleManagementSystem.Api.Entity.Avatar", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
+
+ b.Property("CreatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("IsActived")
+ .HasColumnType("boolean");
+
+ b.Property("IsDeleted")
+ .HasColumnType("boolean");
+
+ b.Property("Remarks")
+ .HasColumnType("text");
+
+ b.Property("UpdatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("UserId")
+ .HasColumnType("integer");
+
+ b.Property("imgsId")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.ToTable("Avatar");
+ });
+
+ modelBuilder.Entity("ArticleManagementSystem.Api.Entity.Carousel", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
+
+ b.Property("ArticleId")
+ .HasColumnType("integer");
+
+ b.Property("CreatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("ImgId")
+ .HasColumnType("integer");
+
+ b.Property("IsActived")
+ .HasColumnType("boolean");
+
+ b.Property("IsDeleted")
+ .HasColumnType("boolean");
+
+ b.Property("Remarks")
+ .HasColumnType("text");
+
+ b.Property("UpdatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.HasKey("Id");
+
+ b.ToTable("carousel");
+ });
+
+ modelBuilder.Entity("ArticleManagementSystem.Api.Entity.Comment", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
+
+ b.Property("ArticleId")
+ .HasColumnType("integer");
+
+ b.Property("Content")
+ .HasColumnType("text");
+
+ b.Property("CreatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("FromUserId")
+ .HasColumnType("integer");
+
+ b.Property("IsActived")
+ .HasColumnType("boolean");
+
+ b.Property("IsDeleted")
+ .HasColumnType("boolean");
+
+ b.Property("Remarks")
+ .HasColumnType("text");
+
+ b.Property("UpdatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.HasKey("Id");
+
+ b.ToTable("Comments");
+ });
+
+ modelBuilder.Entity("ArticleManagementSystem.Api.Entity.Imgs", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
+
+ b.Property("ArticleId")
+ .HasColumnType("integer");
+
+ b.Property("AvatarId")
+ .HasColumnType("integer");
+
+ b.Property("CarouselId")
+ .HasColumnType("integer");
+
+ b.Property("CreatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("ImgsPath")
+ .HasColumnType("text");
+
+ b.Property("IsActived")
+ .HasColumnType("boolean");
+
+ b.Property("IsDeleted")
+ .HasColumnType("boolean");
+
+ b.Property("Remarks")
+ .HasColumnType("text");
+
+ b.Property("UpdatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("UsersId")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ArticleId");
+
+ b.HasIndex("AvatarId");
+
+ b.HasIndex("CarouselId");
+
+ b.HasIndex("UsersId");
+
+ b.ToTable("imgs");
+ });
+
+ modelBuilder.Entity("ArticleManagementSystem.Api.Entity.Like", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
+
+ b.Property("ArticleId")
+ .HasColumnType("integer");
+
+ b.Property("CreatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("IsActived")
+ .HasColumnType("boolean");
+
+ b.Property("IsDeleted")
+ .HasColumnType("boolean");
+
+ b.Property("LikeNum")
+ .HasColumnType("integer");
+
+ b.Property("Remarks")
+ .HasColumnType("text");
+
+ b.Property("UpdatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("UserId")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.ToTable("Like");
+ });
+
+ modelBuilder.Entity("ArticleManagementSystem.Api.Entity.Pageviwes", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
+
+ b.Property("ArticleId")
+ .HasColumnType("integer");
+
+ b.Property("CreatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("IsActived")
+ .HasColumnType("boolean");
+
+ b.Property("IsDeleted")
+ .HasColumnType("boolean");
+
+ b.Property("PageviwesNum")
+ .HasColumnType("integer");
+
+ b.Property("Remarks")
+ .HasColumnType("text");
+
+ b.Property("UpdatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("UserId")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.ToTable("Pageviwes");
+ });
+
+ modelBuilder.Entity("ArticleManagementSystem.Api.Entity.Recommend", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
+
+ b.Property("AdminId")
+ .HasColumnType("integer");
+
+ b.Property("AricleId")
+ .HasColumnType("integer");
+
+ b.Property("CreatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("IsActived")
+ .HasColumnType("boolean");
+
+ b.Property("IsDeleted")
+ .HasColumnType("boolean");
+
+ b.Property("Remarks")
+ .HasColumnType("text");
+
+ b.Property("UpdatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.HasKey("Id");
+
+ b.ToTable("Recommends");
+ });
+
+ modelBuilder.Entity("ArticleManagementSystem.Api.Entity.Users", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
+
+ b.Property("CreatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("IsActived")
+ .HasColumnType("boolean");
+
+ b.Property("IsDeleted")
+ .HasColumnType("boolean");
+
+ b.Property("LikeId")
+ .HasColumnType("integer");
+
+ b.Property("PageviwesId")
+ .HasColumnType("integer");
+
+ b.Property("Password")
+ .HasColumnType("text");
+
+ b.Property("Remarks")
+ .HasColumnType("text");
+
+ b.Property("UpdatedTime")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("Username")
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.HasIndex("LikeId");
+
+ b.HasIndex("PageviwesId");
+
+ b.ToTable("users");
+ });
+
+ modelBuilder.Entity("ArticleUsers", b =>
+ {
+ b.Property("ArticlesId")
+ .HasColumnType("integer");
+
+ b.Property("UsersId")
+ .HasColumnType("integer");
+
+ b.HasKey("ArticlesId", "UsersId");
+
+ b.HasIndex("UsersId");
+
+ b.ToTable("ArticleUsers");
+ });
+
+ modelBuilder.Entity("AvatarUsers", b =>
+ {
+ b.Property("AvatarsId")
+ .HasColumnType("integer");
+
+ b.Property("UsersId")
+ .HasColumnType("integer");
+
+ b.HasKey("AvatarsId", "UsersId");
+
+ b.HasIndex("UsersId");
+
+ b.ToTable("AvatarUsers");
+ });
+
+ modelBuilder.Entity("CommentUsers", b =>
+ {
+ b.Property("UsersId")
+ .HasColumnType("integer");
+
+ b.Property("commentsId")
+ .HasColumnType("integer");
+
+ b.HasKey("UsersId", "commentsId");
+
+ b.HasIndex("commentsId");
+
+ b.ToTable("CommentUsers");
+ });
+
+ modelBuilder.Entity("ArticleManagementSystem.Api.Entity.Admin", b =>
+ {
+ b.HasOne("ArticleManagementSystem.Api.Entity.Recommend", null)
+ .WithMany("Admins")
+ .HasForeignKey("RecommendId");
+ });
+
+ modelBuilder.Entity("ArticleManagementSystem.Api.Entity.Article", b =>
+ {
+ b.HasOne("ArticleManagementSystem.Api.Entity.Comment", null)
+ .WithMany("Articles")
+ .HasForeignKey("CommentId");
+
+ b.HasOne("ArticleManagementSystem.Api.Entity.Pageviwes", null)
+ .WithMany("Articles")
+ .HasForeignKey("PageviwesId");
+
+ b.HasOne("ArticleManagementSystem.Api.Entity.Recommend", null)
+ .WithMany("Articles")
+ .HasForeignKey("RecommendId");
+ });
+
+ modelBuilder.Entity("ArticleManagementSystem.Api.Entity.Imgs", b =>
+ {
+ b.HasOne("ArticleManagementSystem.Api.Entity.Article", null)
+ .WithMany("Imgs")
+ .HasForeignKey("ArticleId");
+
+ b.HasOne("ArticleManagementSystem.Api.Entity.Avatar", null)
+ .WithMany("imgs")
+ .HasForeignKey("AvatarId");
+
+ b.HasOne("ArticleManagementSystem.Api.Entity.Carousel", null)
+ .WithMany("Imgs")
+ .HasForeignKey("CarouselId");
+
+ b.HasOne("ArticleManagementSystem.Api.Entity.Users", null)
+ .WithMany("Imgs")
+ .HasForeignKey("UsersId");
+ });
+
+ modelBuilder.Entity("ArticleManagementSystem.Api.Entity.Users", b =>
+ {
+ b.HasOne("ArticleManagementSystem.Api.Entity.Like", null)
+ .WithMany("Users")
+ .HasForeignKey("LikeId");
+
+ b.HasOne("ArticleManagementSystem.Api.Entity.Pageviwes", null)
+ .WithMany("Users")
+ .HasForeignKey("PageviwesId");
+ });
+
+ modelBuilder.Entity("ArticleUsers", b =>
+ {
+ b.HasOne("ArticleManagementSystem.Api.Entity.Article", null)
+ .WithMany()
+ .HasForeignKey("ArticlesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("ArticleManagementSystem.Api.Entity.Users", null)
+ .WithMany()
+ .HasForeignKey("UsersId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("AvatarUsers", b =>
+ {
+ b.HasOne("ArticleManagementSystem.Api.Entity.Avatar", null)
+ .WithMany()
+ .HasForeignKey("AvatarsId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("ArticleManagementSystem.Api.Entity.Users", null)
+ .WithMany()
+ .HasForeignKey("UsersId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("CommentUsers", b =>
+ {
+ b.HasOne("ArticleManagementSystem.Api.Entity.Users", null)
+ .WithMany()
+ .HasForeignKey("UsersId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("ArticleManagementSystem.Api.Entity.Comment", null)
+ .WithMany()
+ .HasForeignKey("commentsId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("ArticleManagementSystem.Api.Entity.Article", b =>
+ {
+ b.Navigation("Imgs");
+ });
+
+ modelBuilder.Entity("ArticleManagementSystem.Api.Entity.Avatar", b =>
+ {
+ b.Navigation("imgs");
+ });
+
+ modelBuilder.Entity("ArticleManagementSystem.Api.Entity.Carousel", b =>
+ {
+ b.Navigation("Imgs");
+ });
+
+ modelBuilder.Entity("ArticleManagementSystem.Api.Entity.Comment", b =>
+ {
+ b.Navigation("Articles");
+ });
+
+ modelBuilder.Entity("ArticleManagementSystem.Api.Entity.Like", b =>
+ {
+ b.Navigation("Users");
+ });
+
+ modelBuilder.Entity("ArticleManagementSystem.Api.Entity.Pageviwes", b =>
+ {
+ b.Navigation("Articles");
+
+ b.Navigation("Users");
+ });
+
+ modelBuilder.Entity("ArticleManagementSystem.Api.Entity.Recommend", b =>
+ {
+ b.Navigation("Admins");
+
+ b.Navigation("Articles");
+ });
+
+ modelBuilder.Entity("ArticleManagementSystem.Api.Entity.Users", b =>
+ {
+ b.Navigation("Imgs");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git "a/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Migrations/20210804091738_\345\210\235\345\247\213\345\214\226\350\241\250.cs" "b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Migrations/20210804091738_\345\210\235\345\247\213\345\214\226\350\241\250.cs"
new file mode 100644
index 0000000000000000000000000000000000000000..0c117c2250252348bc1977c14755af6dde011871
--- /dev/null
+++ "b/ArticleManagementSystem.Backend/ArticleManagementSystem.Api/Migrations/20210804091738_\345\210\235\345\247\213\345\214\226\350\241\250.cs"
@@ -0,0 +1,491 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+
+namespace ArticleManagementSystem.Api.Migrations
+{
+ public partial class 初始化表 : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "auditInfo",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ Parameters = table.Column(type: "text", nullable: true),
+ BrowserInfo = table.Column(type: "text", nullable: true),
+ ClientName = table.Column(type: "text", nullable: true),
+ ClientIpAddress = table.Column(type: "text", nullable: true),
+ ExecutionDuration = table.Column(type: "integer", nullable: false),
+ ExecutionTime = table.Column(type: "timestamp without time zone", nullable: false),
+ ReturnValue = table.Column(type: "text", nullable: true),
+ Exception = table.Column(type: "text", nullable: true),
+ MethodName = table.Column(type: "text", nullable: true),
+ ServiceName = table.Column(type: "text", nullable: true),
+ UserInfo = table.Column(type: "text", nullable: true),
+ CustomData = table.Column(type: "text", nullable: true),
+ CreatedTime = table.Column(type: "timestamp without time zone", nullable: false),
+ UpdatedTime = table.Column(type: "timestamp without time zone", nullable: false),
+ IsActived = table.Column(type: "boolean", nullable: false),
+ IsDeleted = table.Column(type: "boolean", nullable: false),
+ Remarks = table.Column(type: "text", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_auditInfo", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Avatar",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ imgsId = table.Column(type: "integer", nullable: false),
+ UserId = table.Column(type: "integer", nullable: false),
+ CreatedTime = table.Column(type: "timestamp without time zone", nullable: false),
+ UpdatedTime = table.Column(type: "timestamp without time zone", nullable: false),
+ IsActived = table.Column(type: "boolean", nullable: false),
+ IsDeleted = table.Column(type: "boolean", nullable: false),
+ Remarks = table.Column(type: "text", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Avatar", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "carousel",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ ImgId = table.Column(type: "integer", nullable: false),
+ ArticleId = table.Column(type: "integer", nullable: false),
+ CreatedTime = table.Column(type: "timestamp without time zone", nullable: false),
+ UpdatedTime = table.Column(type: "timestamp without time zone", nullable: false),
+ IsActived = table.Column(type: "boolean", nullable: false),
+ IsDeleted = table.Column(type: "boolean", nullable: false),
+ Remarks = table.Column(type: "text", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_carousel", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Comments",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ FromUserId = table.Column(type: "integer", nullable: false),
+ ArticleId = table.Column(type: "integer", nullable: false),
+ Content = table.Column(type: "text", nullable: true),
+ CreatedTime = table.Column(type: "timestamp without time zone", nullable: false),
+ UpdatedTime = table.Column(type: "timestamp without time zone", nullable: false),
+ IsActived = table.Column(type: "boolean", nullable: false),
+ IsDeleted = table.Column(type: "boolean", nullable: false),
+ Remarks = table.Column(type: "text", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Comments", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Like",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ LikeNum = table.Column(type: "integer", nullable: false),
+ UserId = table.Column(type: "integer", nullable: false),
+ ArticleId = table.Column(type: "integer", nullable: false),
+ CreatedTime = table.Column(type: "timestamp without time zone", nullable: false),
+ UpdatedTime = table.Column(type: "timestamp without time zone", nullable: false),
+ IsActived = table.Column(type: "boolean", nullable: false),
+ IsDeleted = table.Column(type: "boolean", nullable: false),
+ Remarks = table.Column(type: "text", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Like", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Pageviwes",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ PageviwesNum = table.Column(type: "integer", nullable: false),
+ ArticleId = table.Column(type: "integer", nullable: false),
+ UserId = table.Column(type: "integer", nullable: false),
+ CreatedTime = table.Column(type: "timestamp without time zone", nullable: false),
+ UpdatedTime = table.Column(type: "timestamp without time zone", nullable: false),
+ IsActived = table.Column(type: "boolean", nullable: false),
+ IsDeleted = table.Column(type: "boolean", nullable: false),
+ Remarks = table.Column(type: "text", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Pageviwes", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Recommends",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ AricleId = table.Column(type: "integer", nullable: false),
+ AdminId = table.Column(type: "integer", nullable: false),
+ CreatedTime = table.Column(type: "timestamp without time zone", nullable: false),
+ UpdatedTime = table.Column