2023-12-14 14:38:46 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
using Volo.Abp.DependencyInjection;
|
|
|
|
|
|
using Volo.Abp.Domain.Repositories;
|
|
|
|
|
|
using Volo.Abp.EventBus;
|
2024-01-11 18:51:53 +08:00
|
|
|
|
using Yi.Framework.Bbs.Domain.Entities.Forum;
|
2023-12-14 14:38:46 +08:00
|
|
|
|
using Yi.Framework.Bbs.Domain.Shared.Etos;
|
2025-02-05 11:36:20 +08:00
|
|
|
|
using Yi.Framework.SqlSugarCore.Abstractions;
|
2023-12-14 14:38:46 +08:00
|
|
|
|
|
2024-01-27 17:42:09 +08:00
|
|
|
|
namespace Yi.Framework.Bbs.Domain.EventHandlers
|
2023-12-14 14:38:46 +08:00
|
|
|
|
{
|
|
|
|
|
|
public class SeeDiscussEventHandler : ILocalEventHandler<SeeDiscussEventArgs>, ITransientDependency
|
|
|
|
|
|
{
|
2025-02-05 11:36:20 +08:00
|
|
|
|
private ISqlSugarRepository<DiscussAggregateRoot, Guid> _repository;
|
|
|
|
|
|
|
|
|
|
|
|
public SeeDiscussEventHandler(ISqlSugarRepository<DiscussAggregateRoot, Guid> repository)
|
2023-12-14 14:38:46 +08:00
|
|
|
|
{
|
|
|
|
|
|
_repository = repository;
|
|
|
|
|
|
}
|
2025-02-05 11:36:20 +08:00
|
|
|
|
|
2023-12-14 16:48:27 +08:00
|
|
|
|
public async Task HandleEventAsync(SeeDiscussEventArgs eventData)
|
2023-12-14 14:38:46 +08:00
|
|
|
|
{
|
2025-02-05 11:36:20 +08:00
|
|
|
|
await _repository._Db.Updateable<DiscussAggregateRoot>()
|
|
|
|
|
|
.SetColumns(x => new DiscussAggregateRoot { SeeNum = x.SeeNum + 1 })
|
|
|
|
|
|
.Where(x => x.Id == eventData.DiscussId).ExecuteCommandAsync();
|
2023-12-14 14:38:46 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-02-05 11:36:20 +08:00
|
|
|
|
}
|