mirror of
https://gitee.com/ccnetcore/Yi
synced 2026-06-07 02:18:19 +08:00
Merge branch 'abp' of https://gitee.com/ccnetcore/Yi into abp
This commit is contained in:
@@ -62,9 +62,22 @@ namespace Yi.Framework.Ddd.Application
|
||||
{
|
||||
}
|
||||
|
||||
public override Task<PagedResultDto<TGetListOutputDto>> GetListAsync(TGetListInput input)
|
||||
public override async Task<PagedResultDto<TGetListOutputDto>> GetListAsync(TGetListInput input)
|
||||
{
|
||||
throw new NotImplementedException($"【{typeof(TEntity)}】实体的CrudAppService,查询为具体业务,通用查询几乎无实际场景,请重写实现!");
|
||||
List<TEntity>? entites = null;
|
||||
//区分多查还是批量查
|
||||
if (input is IPagedResultRequest pagedInput)
|
||||
{
|
||||
entites = await Repository.GetPagedListAsync(pagedInput.SkipCount, pagedInput.MaxResultCount, string.Empty);
|
||||
}
|
||||
else
|
||||
{
|
||||
entites = await Repository.GetListAsync();
|
||||
}
|
||||
var total = await Repository.CountAsync();
|
||||
var output = await MapToGetListOutputDtosAsync(entites);
|
||||
return new PagedResultDto<TGetListOutputDto>(total, output);
|
||||
//throw new NotImplementedException($"【{typeof(TEntity)}】实体的CrudAppService,查询为具体业务,通用查询几乎无实际场景,请重写实现!");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
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;
|
||||
using Yi.Framework.Bbs.Domain.Entities;
|
||||
using Yi.Framework.Bbs.Domain.Shared.Etos;
|
||||
|
||||
namespace Yi.Framework.Bbs.Domain.EventHandlers
|
||||
{
|
||||
public class SeeDiscussEventHandler : ILocalEventHandler<SeeDiscussEventArgs>, ITransientDependency
|
||||
{
|
||||
private IRepository<DiscussEntity, Guid> _repository;
|
||||
public SeeDiscussEventHandler(IRepository<DiscussEntity,Guid> repository)
|
||||
{
|
||||
_repository = repository;
|
||||
}
|
||||
|
||||
public async Task HandleEventAsync(SeeDiscussEventArgs eventData)
|
||||
{
|
||||
var entity = await _repository.GetAsync(eventData.DiscussId);
|
||||
if (entity is not null)
|
||||
{
|
||||
entity.SeeNum += 1;
|
||||
await _repository.UpdateAsync(entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ using Yi.Framework.Bbs.Domain.Entities;
|
||||
using Yi.Framework.Bbs.Domain.Managers;
|
||||
using Yi.Framework.Bbs.Domain.Shared.Consts;
|
||||
using Yi.Framework.Bbs.Domain.Shared.Enums;
|
||||
using Yi.Framework.Bbs.Domain.Shared.Etos;
|
||||
using Yi.Framework.Ddd.Application;
|
||||
using Yi.Framework.Rbac.Application.Contracts.Dtos.User;
|
||||
using Yi.Framework.Rbac.Domain.Entities;
|
||||
@@ -58,9 +59,7 @@ namespace Yi.Framework.Bbs.Application.Services
|
||||
if (item is not null)
|
||||
{
|
||||
await VerifyDiscussPermissionAsync(item.Id);
|
||||
|
||||
throw new NotImplementedException("等待更新消息通知");
|
||||
//_eventPublisher.PublishAsync(new SeeDiscussEventSource(new SeeDiscussEventArgs { DiscussId = item.Id, OldSeeNum = item.SeeNum }));
|
||||
await _localEventBus.PublishAsync(new SeeDiscussEventArgs { DiscussId = item.Id, OldSeeNum = item.SeeNum });
|
||||
}
|
||||
|
||||
return item;
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.Framework.Bbs.Domain.Shared.Etos
|
||||
{
|
||||
public class SeeDiscussEventArgs
|
||||
{
|
||||
public Guid DiscussId { get; set; }
|
||||
public int OldSeeNum { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SqlSugar;
|
||||
using Volo.Abp.Data;
|
||||
using Volo.Abp.DependencyInjection;
|
||||
using Volo.Abp.Domain.Repositories;
|
||||
using Volo.Abp.Guids;
|
||||
using Yi.Framework.Rbac.Domain.Entities;
|
||||
using Yi.Framework.SqlSugarCore.Abstractions;
|
||||
|
||||
namespace Yi.Framework.Bbs.SqlSugarCore.DataSeeds
|
||||
{
|
||||
public class ConfigDataSeed : IDataSeedContributor, ITransientDependency
|
||||
{
|
||||
private ISqlSugarRepository<ConfigEntity> _repository;
|
||||
public ConfigDataSeed(ISqlSugarRepository<ConfigEntity> repository)
|
||||
{
|
||||
_repository = repository;
|
||||
}
|
||||
public async Task SeedAsync(DataSeedContext context)
|
||||
{
|
||||
if (!await _repository.IsAnyAsync(x => true))
|
||||
{
|
||||
await _repository.InsertManyAsync(GetSeedData());
|
||||
}
|
||||
}
|
||||
public List<ConfigEntity> GetSeedData()
|
||||
{
|
||||
List<ConfigEntity> entities = new List<ConfigEntity>();
|
||||
ConfigEntity config1 = new ConfigEntity()
|
||||
{
|
||||
ConfigKey = "bbs.site.name",
|
||||
ConfigName = "站点名称",
|
||||
ConfigValue = "意社区"
|
||||
};
|
||||
entities.Add(config1);
|
||||
|
||||
ConfigEntity config2 = new ConfigEntity()
|
||||
{
|
||||
ConfigKey = "bbs.site.author",
|
||||
ConfigName = "站点作者",
|
||||
ConfigValue = "橙子"
|
||||
};
|
||||
entities.Add(config2);
|
||||
|
||||
ConfigEntity config3 = new ConfigEntity()
|
||||
{
|
||||
ConfigKey = "bbs.site.icp",
|
||||
ConfigName = "站点Icp备案",
|
||||
ConfigValue = "赣ICP备20008025号"
|
||||
};
|
||||
entities.Add(config3);
|
||||
|
||||
|
||||
ConfigEntity config4 = new ConfigEntity()
|
||||
{
|
||||
ConfigKey = "bbs.site.bottom",
|
||||
ConfigName = "站点底部信息",
|
||||
ConfigValue = "你好世界"
|
||||
};
|
||||
entities.Add(config4);
|
||||
return entities;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+1
-1
@@ -11,7 +11,7 @@ using Volo.Abp.EventBus;
|
||||
using Yi.Framework.Rbac.Domain.Entities;
|
||||
using Yi.Framework.Rbac.Domain.Shared.Etos;
|
||||
|
||||
namespace Yi.Framework.Rbac.Application.Events
|
||||
namespace Yi.Framework.Rbac.Application.EventHandlers
|
||||
{
|
||||
public class LoginEventHandler : ILocalEventHandler<LoginEventArgs>,
|
||||
ITransientDependency
|
||||
+4
@@ -15,4 +15,8 @@
|
||||
<ProjectReference Include="..\Yi.Framework.Rbac.Domain\Yi.Framework.Rbac.Domain.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Events\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
using Volo.Abp.Application.Services;
|
||||
|
||||
namespace Yi.Abp.Application
|
||||
{
|
||||
public class TestService : ApplicationService
|
||||
{
|
||||
/// <summary>
|
||||
/// 你好世界
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public string GetHelloWorld(string? name)
|
||||
{
|
||||
return name ?? "HelloWord";
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+1978
-919
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user