From a054dea93c037c01b330862d7a539c4c0f98979b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com>
Date: Mon, 28 Feb 2022 18:37:41 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=8E=B7=E5=8F=96=E6=9C=80?=
=?UTF-8?q?=E6=96=B0=E6=96=87=E7=AB=A0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Controllers/System/ArticleController.cs | 21 +++++++++++++++++++
ZR.Vue/src/api/system/article.js | 8 +++++++
2 files changed, 29 insertions(+)
diff --git a/ZR.Admin.WebApi/Controllers/System/ArticleController.cs b/ZR.Admin.WebApi/Controllers/System/ArticleController.cs
index c6f9ce9..9274ccf 100644
--- a/ZR.Admin.WebApi/Controllers/System/ArticleController.cs
+++ b/ZR.Admin.WebApi/Controllers/System/ArticleController.cs
@@ -54,6 +54,27 @@ namespace ZR.Admin.WebApi.Controllers
return SUCCESS(response);
}
+ ///
+ /// 查询最新文章列表
+ ///
+ ///
+ [HttpGet("newList")]
+ public IActionResult QueryNew()
+ {
+ //开始拼装查询条件
+ var predicate = Expressionable.Create();
+
+ //搜索条件
+ predicate = predicate.And(m => m.Status == "1");
+
+ var response = _ArticleService.Queryable()
+ .Where(predicate.ToExpression())
+ .Take(10)
+ .OrderBy(f => f.UpdateTime, OrderByType.Desc).ToList();
+
+ return SUCCESS(response);
+ }
+
///
/// 获取文章目录,前端没用到
///
diff --git a/ZR.Vue/src/api/system/article.js b/ZR.Vue/src/api/system/article.js
index a25523f..05fb94d 100644
--- a/ZR.Vue/src/api/system/article.js
+++ b/ZR.Vue/src/api/system/article.js
@@ -8,6 +8,14 @@ export function listArticle(query) {
params: query
})
}
+// 查询最新列表
+export function listNewArticle(query) {
+ return request({
+ url: '/Article/newList',
+ method: 'get',
+ params: query
+ })
+}
// 查询详细
export function getArticle(Id) {