diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Notice/BbsNoticeGetListOutputDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Notice/BbsNoticeGetListOutputDto.cs index c464ab0b..fe3aea20 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Notice/BbsNoticeGetListOutputDto.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Notice/BbsNoticeGetListOutputDto.cs @@ -32,6 +32,6 @@ namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Notice /// /// 消息创建时间 /// - public DateTime CreationTime { get; } + public DateTime CreationTime { get; set; } } } 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 c7dc524f..29103247 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 @@ -16,8 +16,34 @@ namespace Yi.Framework.Bbs.Domain.Shared.Consts public const string Privacy = "【私密】您无该主题权限,可联系作者申请开放"; - public const string AgreeNotice = "您的主题[{0}]被[{1}]用户点赞!得到一致认可,发现宝藏内容!"; - - public const string CommentNotice = "您的主题[{0}]被[{1}]用户评论!评论内容:[{2}]"; + public const string AgreeNotice = """ +
+

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

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

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

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

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

+ +
+ """; } } diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/BbsNoticeAggregateRoot.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/BbsNoticeAggregateRoot.cs index cf6180c3..707187ea 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/BbsNoticeAggregateRoot.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/BbsNoticeAggregateRoot.cs @@ -34,6 +34,7 @@ namespace Yi.Framework.Bbs.Domain.Entities /// /// 消息,支持html /// + [SugarColumn(ColumnDataType = StaticConfig.CodeFirst_BigString)] public string Message { get; set; } /// diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/AgreeChangedEventHandler.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/AgreeChangedEventHandler.cs index 58a0cb2d..573ce9c5 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/AgreeChangedEventHandler.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/AgreeChangedEventHandler.cs @@ -38,6 +38,7 @@ namespace Yi.Framework.Bbs.Domain.EventHandlers .Select((agree, discuss) => new { + DiscussId=discuss.Id, DiscussTitle = discuss.Title, DiscussCreatorId = discuss.CreatorId, }) @@ -53,7 +54,7 @@ namespace Yi.Framework.Bbs.Domain.EventHandlers .ExecuteCommandAsync(); //通知主题作者,有人点赞 - await _localEventBus.PublishAsync(new BbsNoticeEventArgs(discussAndAgreeDto.DiscussCreatorId!.Value, string.Format(DiscussConst.AgreeNotice, discussAndAgreeDto.DiscussTitle, agreeUser.UserName)), false); + await _localEventBus.PublishAsync(new BbsNoticeEventArgs(discussAndAgreeDto.DiscussCreatorId!.Value, string.Format(DiscussConst.AgreeNotice, discussAndAgreeDto.DiscussTitle, agreeUser.UserName,discussAndAgreeDto.DiscussId)), false); } } diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/BbsNoticeSendEventHandler.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/BbsNoticeSendEventHandler.cs index 3067ad17..6336e260 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/BbsNoticeSendEventHandler.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/BbsNoticeSendEventHandler.cs @@ -26,13 +26,13 @@ namespace Yi.Framework.Bbs.Domain.EventHandlers public async Task HandleEventAsync(BbsNoticeEventArgs eventData) { //离线存储 - await _repository.InsertAsync(new BbsNoticeAggregateRoot(eventData.NoticeType, eventData.Message, eventData.AcceptUserId)); + var entity= await _repository.InsertReturnEntityAsync(new BbsNoticeAggregateRoot(eventData.NoticeType, eventData.Message, eventData.AcceptUserId)); switch (eventData.NoticeType) { case Shared.Enums.NoticeTypeEnum.Personal: if (BbsNoticeHub.HubUserModels.TryGetValue(eventData.AcceptUserId.ToString(), out var hubUserModel)) { - _hubContext.Clients.Client(hubUserModel.ConnnectionId).SendAsync(NoticeTypeEnum.Personal.ToString(), eventData.Message); + _hubContext.Clients.Client(hubUserModel.ConnnectionId).SendAsync(NoticeTypeEnum.Personal.ToString(), eventData.Message,entity.CreationTime); } break; case Shared.Enums.NoticeTypeEnum.Broadcast: 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 0be15463..d257cab7 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 @@ -42,7 +42,7 @@ namespace Yi.Framework.Bbs.Domain.EventHandlers .Select((dicuss, user) => new { - DiscussId = user.Id, + DiscussUserId = user.Id, DiscussTitle = dicuss.Title, }) @@ -53,7 +53,10 @@ namespace Yi.Framework.Bbs.Domain.EventHandlers //截取30个长度 var content = commentEntity.Content.Length >= 30 ? commentEntity.Content.Substring(0, 30)+"..." : commentEntity.Content; //通知主题作者,有人评论 - await _localEventBus.PublishAsync(new BbsNoticeEventArgs(disucssDto.DiscussId, string.Format(DiscussConst.CommentNotice, disucssDto.DiscussTitle, commentUser.UserName, content)), false); + 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.CommentNotice, disucssDto.DiscussTitle, commentUser.UserName, content,commentEntity.DiscussId)), false); + } } }