diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Enums/NoticeTypeEnum.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Enums/NoticeTypeEnum.cs new file mode 100644 index 00000000..9177846d --- /dev/null +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Enums/NoticeTypeEnum.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Yi.Framework.Bbs.Domain.Shared.Enums +{ + /// + /// 消息类型 + /// + public enum NoticeTypeEnum + { + /// + /// 个人 + /// + Personal, + /// + /// 广播 + /// + Broadcast, + } +} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Etos/BbsNoticeEventArgs.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Etos/BbsNoticeEventArgs.cs new file mode 100644 index 00000000..2823e8b7 --- /dev/null +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Etos/BbsNoticeEventArgs.cs @@ -0,0 +1,34 @@ +using Yi.Framework.Bbs.Domain.Shared.Enums; + +namespace Yi.Framework.Bbs.Domain.Shared.Etos +{ + public class BbsNoticeEventArgs + { + /// + /// 发送个人消息 + /// + /// + /// + public BbsNoticeEventArgs(Guid acceptUserId, string message) + { + NoticeType = NoticeTypeEnum.Personal; + AcceptUserId = acceptUserId; + Message = message; + } + + /// + /// 发送广播 + /// + /// + public BbsNoticeEventArgs(string message) + { + NoticeType = NoticeTypeEnum.Broadcast; + Message = message; + } + public NoticeTypeEnum NoticeType { get; private set; } + + public string Message { get; private set; } + + public Guid? AcceptUserId { get; private set; } + } +} 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 5ed3dd53..a1d276cf 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 @@ -1,32 +1,54 @@ -namespace Yi.Framework.Bbs.Domain.Entities +using SqlSugar; +using Volo.Abp.Auditing; +using Volo.Abp.Domain.Entities; +using Yi.Framework.Bbs.Domain.Shared.Enums; + +namespace Yi.Framework.Bbs.Domain.Entities { - public class BbsNoticeAggregateRoot + [SugarTable("BbsNotice")] + public class BbsNoticeAggregateRoot : AggregateRoot, IHasCreationTime { - public Guid AcceptUserId { get; set; } + public BbsNoticeAggregateRoot(NoticeTypeEnum noticeType, string message, Guid? acceptUserId = null) + { + this.NoticeType = noticeType; + this.Message = message; + this.AcceptUserId = acceptUserId; + + } + /// + /// 设置已读 + /// + public void SetRead() + { + IsRead = true; + this.ReadTime = DateTime.Now; + } + + + public Guid? AcceptUserId { get; } /// - /// 消息 + /// 消息,支持html /// public string Message { get; set; } - public MessageTypeEnum MessageType { get; set; } + /// + /// 消息类型 + /// + public NoticeTypeEnum NoticeType { get; } /// /// 是否已读 /// - public bool IsRead { get; set; } + public bool IsRead { get; private set; } /// /// 已读时间 /// - public DateTime? ReadTime { get; set; } + public DateTime? ReadTime { get; private set; } + + public DateTime CreationTime { get; } } - /// - /// 消息类型 - /// - public enum MessageTypeEnum - { - - } + } 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 aaeae641..3a56a6ef 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 @@ -28,7 +28,7 @@ namespace Yi.Framework.Bbs.Domain.EventHandlers //给创建者发布数量+1 await _userRepository._Db.Updateable() - .SetColumns(it => it.DiscussNumber == it.DiscussNumber + 1) + .SetColumns(it => it.AgreeNumber == it.AgreeNumber + 1) .Where(it => it.UserId == userId) .ExecuteCommandAsync(); } diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/BbsNoticeCreatedEventHandler.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/BbsNoticeCreatedEventHandler.cs new file mode 100644 index 00000000..a8ce92e5 --- /dev/null +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/BbsNoticeCreatedEventHandler.cs @@ -0,0 +1,16 @@ +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Entities.Events; +using Volo.Abp.EventBus; +using Yi.Framework.Bbs.Domain.Entities; + +namespace Yi.Framework.Bbs.Domain.EventHandlers +{ + public class BbsNoticeCreatedEventHandler : ILocalEventHandler>, + ITransientDependency + { + public Task HandleEventAsync(EntityCreatedEventData eventData) + { + throw new NotImplementedException(); + } + } +}