From 4097244d5b406e3a2866ce6d8af104e734823682 Mon Sep 17 00:00:00 2001 From: chenchun Date: Wed, 7 Aug 2024 11:12:01 +0800 Subject: [PATCH] =?UTF-8?q?style:=20=E4=BF=AE=E5=A4=8D=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Consts/DiscussConst.cs | 39 +++------ .../CommentCreatedEventHandler.cs | 10 ++- .../Services/FileService.cs | 6 ++ Yi.Abp.Net8/src/Yi.Abp.Web/Yi.Abp.Web.csproj | 3 + Yi.Bbs.Vue3/src/views/home/Index.vue | 80 +++++++++---------- 5 files changed, 70 insertions(+), 68 deletions(-) diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Consts/DiscussConst.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Consts/DiscussConst.cs index 29103247..f0a7d249 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Consts/DiscussConst.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Consts/DiscussConst.cs @@ -9,7 +9,6 @@ namespace Yi.Framework.Bbs.Domain.Shared.Consts /// /// 常量定义 /// - public class DiscussConst { public const string No_Exist = "传入的主题id不存在"; @@ -18,32 +17,20 @@ namespace Yi.Framework.Bbs.Domain.Shared.Consts public const string AgreeNotice = """
-

🍗 您的主题 [{0}] 被 [{1}] 用户点赞!

- +

🍗 您的主题 [{0}] 有 [{1}] 用户点赞!

"""; + public const string CommentNotice = """ -
-

🍖 您的主题 [{0}] 被 [{1}] 用户评论!

- -
- """; - public const string CommentNoticeToReply= """ -
-

🍖 您在主题 [{0}] 的评论被 [{1}] 用户回复!

- -
- """; +
+

🍖 您的主题 [{0}] 有 [{1}] 用户评论!

+
+ """; + + public const string CommentNoticeToReply = """ +
+

🍖 您在主题 [{0}] 的评论有 [{1}] 用户回复!

+
+ """; } -} +} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/CommentCreatedEventHandler.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/CommentCreatedEventHandler.cs index b37a15de..0c5f63c3 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/CommentCreatedEventHandler.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/CommentCreatedEventHandler.cs @@ -54,9 +54,15 @@ namespace Yi.Framework.Bbs.Domain.EventHandlers var content = commentEntity.Content.Length >= 30 ? commentEntity.Content.Substring(0, 30)+"..." : commentEntity.Content; //通知主题作者,有人评论 await _localEventBus.PublishAsync(new BbsNoticeEventArgs(disucssDto.DiscussUserId, string.Format(DiscussConst.CommentNotice, disucssDto.DiscussTitle, commentUser.UserName, content,commentEntity.DiscussId)), false); - //通知回复者,有人评论 - await _localEventBus.PublishAsync(new BbsNoticeEventArgs(commentEntity.ParentId, string.Format(DiscussConst.CommentNoticeToReply, disucssDto.DiscussTitle, commentUser.UserName, content,commentEntity.DiscussId)), false); + //如果为空,表示根路径,没有回复者 + if (commentEntity.ParentId != Guid.Empty) + { + //通知回复者,有人评论 + await _localEventBus.PublishAsync(new BbsNoticeEventArgs(commentEntity.ParentId, string.Format(DiscussConst.CommentNoticeToReply, disucssDto.DiscussTitle, commentUser.UserName, content,commentEntity.DiscussId)), false); + + } + } } } diff --git a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/FileService.cs b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/FileService.cs index 56487a81..f0287ad9 100644 --- a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/FileService.cs +++ b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/FileService.cs @@ -37,6 +37,12 @@ namespace Yi.Framework.Rbac.Application.Services { var path = await GetReturnPathAsync(code, isThumbnail); + if (!File.Exists(path)) + { + throw new UserFriendlyException("文件不存在",code:"404"); + } + + var steam = await File.ReadAllBytesAsync(path); //考虑从路径中获取 diff --git a/Yi.Abp.Net8/src/Yi.Abp.Web/Yi.Abp.Web.csproj b/Yi.Abp.Net8/src/Yi.Abp.Web/Yi.Abp.Web.csproj index e116a610..f50d8a24 100644 --- a/Yi.Abp.Net8/src/Yi.Abp.Web/Yi.Abp.Web.csproj +++ b/Yi.Abp.Net8/src/Yi.Abp.Web/Yi.Abp.Web.csproj @@ -37,6 +37,9 @@ Always + + Always + diff --git a/Yi.Bbs.Vue3/src/views/home/Index.vue b/Yi.Bbs.Vue3/src/views/home/Index.vue index c4535796..59db4649 100644 --- a/Yi.Bbs.Vue3/src/views/home/Index.vue +++ b/Yi.Bbs.Vue3/src/views/home/Index.vue @@ -82,9 +82,9 @@
你好,很高兴今天又遇到你呀~
- + - + {{item.name}} @@ -176,8 +176,8 @@