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; }); };