From 0b8848d63f5e60772592073f64ccd3df5bd762fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A9=99=E5=AD=90?= <454313500@qq.com> Date: Sun, 8 Oct 2023 23:50:53 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=8C=E5=96=84app=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E5=BA=94=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Yi.App.Vue3/src/api/fileApi.ts | 6 +++--- Yi.App.Vue3/src/view/send/imageText.vue | 4 ++-- .../App/Services/Impl/TrendsService.cs | 15 +++++++++++++++ .../Yi.Furion.Application.xml | 7 +++++++ 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/Yi.App.Vue3/src/api/fileApi.ts b/Yi.App.Vue3/src/api/fileApi.ts index bcd09760..f0b09f5d 100644 --- a/Yi.App.Vue3/src/api/fileApi.ts +++ b/Yi.App.Vue3/src/api/fileApi.ts @@ -1,11 +1,11 @@ import myaxios from '@/utils/myaxios' export default{ - upload(type:string,data:any){ + upload(data:any){ return myaxios({ - url: `/file/upload/${type}`, + url: `/file`, headers:{"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"}, - method: 'POST', + method: 'post', data:data }); } diff --git a/Yi.App.Vue3/src/view/send/imageText.vue b/Yi.App.Vue3/src/view/send/imageText.vue index 50026ea1..7fa37ada 100644 --- a/Yi.App.Vue3/src/view/send/imageText.vue +++ b/Yi.App.Vue3/src/view/send/imageText.vue @@ -97,8 +97,8 @@ const afterRead = (file: any) => { }); } - fileApi.upload("image", formData).then((response: any) => { - images.value.push(...response.data); + fileApi.upload(formData).then((response: any) => { + images.value.push(...response.data.map((x:any)=>x.id)); if (file.length == undefined) { file.status = "done"; diff --git a/Yi.Furion.Net6/Yi.Furion.Application/App/Services/Impl/TrendsService.cs b/Yi.Furion.Net6/Yi.Furion.Application/App/Services/Impl/TrendsService.cs index 169fc747..a741d23e 100644 --- a/Yi.Furion.Net6/Yi.Furion.Application/App/Services/Impl/TrendsService.cs +++ b/Yi.Furion.Net6/Yi.Furion.Application/App/Services/Impl/TrendsService.cs @@ -27,8 +27,23 @@ namespace Yi.Furion.Application.App.Services.Impl var entities = await _DbQueryable .WhereIF(input.StartTime is not null && input.EndTime is not null, x => x.CreationTime >= input.StartTime && x.CreationTime <= input.EndTime) + .OrderByDescending(x=>x.CreationTime) .ToPageListAsync(input.PageNum, input.PageSize, total); return new PagedResultDto(total, await MapToGetListOutputDtosAsync(entities)); } + + /// + /// 发布文章 + /// + /// + /// + public override Task CreateAsync(TrendsCreateInput input) + { + if (string.IsNullOrEmpty(input.Title)) + { + input.Title = input.Content.Substring(0, Math.Min(5, input.Content.Length)); + } + return base.CreateAsync(input); + } } } diff --git a/Yi.Furion.Net6/Yi.Furion.Application/Yi.Furion.Application.xml b/Yi.Furion.Net6/Yi.Furion.Application/Yi.Furion.Application.xml index ffba5655..c4b28419 100644 --- a/Yi.Furion.Net6/Yi.Furion.Application/Yi.Furion.Application.xml +++ b/Yi.Furion.Net6/Yi.Furion.Application/Yi.Furion.Application.xml @@ -16,6 +16,13 @@ + + + 发布文章 + + + + Trends服务抽象