From 6d99539730ef82fb95986176aaf804660c66f924 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A9=99=E5=AD=90?= <454313500@qq.com> Date: Sun, 16 Oct 2022 16:09:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=97=E8=A1=A8=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/ArticleController.cs | 2 +- Yi.Framework.Net6/Yi.Framework.Service/ArticleService.cs | 2 +- Yi.Vue3.x.Vant/src/view/main/recommend.vue | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ArticleController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ArticleController.cs index 269c8dc9..fef4fcac 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ArticleController.cs +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ArticleController.cs @@ -50,7 +50,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers public override Task Add(ArticleEntity entity) { //如果标题为空,默认为内容的前20个字符 - entity.Title = entity.Title ?? entity.Content.Substring(0, 20); + entity.Title = string.IsNullOrEmpty(entity.Title) ? entity.Content.Substring(0, 20): entity.Title; entity.UserId = HttpContext.GetUserIdInfo(); return base.Add(entity); } diff --git a/Yi.Framework.Net6/Yi.Framework.Service/ArticleService.cs b/Yi.Framework.Net6/Yi.Framework.Service/ArticleService.cs index 1ff17a7f..0b039004 100644 --- a/Yi.Framework.Net6/Yi.Framework.Service/ArticleService.cs +++ b/Yi.Framework.Net6/Yi.Framework.Service/ArticleService.cs @@ -19,7 +19,7 @@ namespace Yi.Framework.Service //.WhereIF(!string.IsNullOrEmpty(config.ConfigKey), u => u.ConfigKey.Contains(config.ConfigKey)) .WhereIF(page.StartTime is not null && page.EndTime is not null, u => u.CreateTime >= page.StartTime && u.CreateTime <= page.EndTime) .WhereIF(entity.IsDeleted is not null, u => u.IsDeleted == entity.IsDeleted) - .OrderBy(u => u.CreateTime, OrderByType.Asc) + .OrderBy(u => u.CreateTime, OrderByType.Desc) .ToPageListAsync(page.PageNum, page.PageSize, total); return new PageModel>(data, total); diff --git a/Yi.Vue3.x.Vant/src/view/main/recommend.vue b/Yi.Vue3.x.Vant/src/view/main/recommend.vue index 89311e01..4573e0c1 100644 --- a/Yi.Vue3.x.Vant/src/view/main/recommend.vue +++ b/Yi.Vue3.x.Vant/src/view/main/recommend.vue @@ -149,7 +149,7 @@ onMounted(() => { const getList = () => { articleApi.pageList(queryParams.value).then((response: any) => { - articleList.value.push(...(response.data.data)); + articleList.value.unshift(...(response.data.data)); totol.value = response.data.totol; }); };