fix: 修复bbs点赞数异常问题

This commit is contained in:
橙子
2024-05-22 22:16:44 +08:00
parent 3429de9eb6
commit 695989969d
5 changed files with 110 additions and 15 deletions

View File

@@ -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
{
/// <summary>
/// 消息类型
/// </summary>
public enum NoticeTypeEnum
{
/// <summary>
/// 个人
/// </summary>
Personal,
/// <summary>
/// 广播
/// </summary>
Broadcast,
}
}

View File

@@ -0,0 +1,34 @@
using Yi.Framework.Bbs.Domain.Shared.Enums;
namespace Yi.Framework.Bbs.Domain.Shared.Etos
{
public class BbsNoticeEventArgs
{
/// <summary>
/// 发送个人消息
/// </summary>
/// <param name="acceptUserId"></param>
/// <param name="message"></param>
public BbsNoticeEventArgs(Guid acceptUserId, string message)
{
NoticeType = NoticeTypeEnum.Personal;
AcceptUserId = acceptUserId;
Message = message;
}
/// <summary>
/// 发送广播
/// </summary>
/// <param name="message"></param>
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; }
}
}

View File

@@ -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<Guid>, IHasCreationTime
{
public Guid AcceptUserId { get; set; }
public BbsNoticeAggregateRoot(NoticeTypeEnum noticeType, string message, Guid? acceptUserId = null)
{
this.NoticeType = noticeType;
this.Message = message;
this.AcceptUserId = acceptUserId;
}
/// <summary>
/// 设置已读
/// </summary>
public void SetRead()
{
IsRead = true;
this.ReadTime = DateTime.Now;
}
public Guid? AcceptUserId { get; }
/// <summary>
/// 消息
/// 消息,支持html
/// </summary>
public string Message { get; set; }
public MessageTypeEnum MessageType { get; set; }
/// <summary>
/// 消息类型
/// </summary>
public NoticeTypeEnum NoticeType { get; }
/// <summary>
/// 是否已读
/// </summary>
public bool IsRead { get; set; }
public bool IsRead { get; private set; }
/// <summary>
/// 已读时间
/// </summary>
public DateTime? ReadTime { get; set; }
public DateTime? ReadTime { get; private set; }
public DateTime CreationTime { get; }
}
/// <summary>
/// 消息类型
/// </summary>
public enum MessageTypeEnum
{
}
}

View File

@@ -28,7 +28,7 @@ namespace Yi.Framework.Bbs.Domain.EventHandlers
//给创建者发布数量+1
await _userRepository._Db.Updateable<BbsUserExtraInfoEntity>()
.SetColumns(it => it.DiscussNumber == it.DiscussNumber + 1)
.SetColumns(it => it.AgreeNumber == it.AgreeNumber + 1)
.Where(it => it.UserId == userId)
.ExecuteCommandAsync();
}

View File

@@ -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<EntityCreatedEventData<BbsNoticeAggregateRoot>>,
ITransientDependency
{
public Task HandleEventAsync(EntityCreatedEventData<BbsNoticeAggregateRoot> eventData)
{
throw new NotImplementedException();
}
}
}