From 5a65a2e49f1c29ded1fd619a795fa06a4058a3c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=B7=B3?= <454313500@qq.com> Date: Thu, 11 Jan 2024 18:51:53 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=90=AD=E5=BB=BA=E7=A7=AF=E5=88=86?= =?UTF-8?q?=E9=A2=86=E5=9F=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SqlSugarCoreAuditLogRepository.cs | 11 ++-- .../YiAuditLoggingSqlSugarCoreModule.cs | 1 - .../Dtos/Level/LevelGetListInputDto.cs | 21 ++++++++ .../Dtos/Level/LevelOutputDto.cs | 34 +++++++++++++ .../IServices/ILevelService.cs | 14 +++++ .../EventHandlers/MoneyChangeEventHandler.cs | 24 +++++++++ .../EventHandlers/SeeDiscussEventHandler.cs | 4 +- .../EventHandlers/UserCreateEventHandler.cs | 4 +- .../Analyses/BbsForumAnalyseService.cs | 1 + .../Services/{ => Forum}/AgreeService.cs | 6 +-- .../Services/{ => Forum}/ArticleService.cs | 6 +-- .../Services/{ => Forum}/BannerService.cs | 6 +-- .../Services/{ => Forum}/CommentService.cs | 6 +-- .../Services/{ => Forum}/DiscussService.cs | 45 ++++++++-------- .../Services/{ => Forum}/MyTypeService.cs | 12 ++--- .../Services/{ => Forum}/PlateService.cs | 8 +-- .../Services/Integral/IntegralService.cs | 20 ++++++++ .../Services/Integral/LevelService.cs | 45 ++++++++++++++++ .../Etos/ExperienceChangeEventArgs.cs | 21 ++++++++ .../Etos/MoneyChangeEventArgs.cs | 21 ++++++++ .../Entities/BbsUserExtraInfoEntity.cs | 16 +++++- .../Entities/{ => Forum}/AgreeEntity .cs | 2 +- .../Entities/{ => Forum}/ArticleEntity.cs | 4 +- .../Entities/{ => Forum}/BannerEntity.cs | 2 +- .../Entities/{ => Forum}/CommentEntity.cs | 4 +- .../Entities/{ => Forum}/DiscussEntity.cs | 2 +- .../{ => Forum}/DiscussMyTypeEntity.cs | 2 +- .../Entities/{ => Forum}/DiscussTopEntity.cs | 2 +- .../Entities/{ => Forum}/MyTypeEntity.cs | 2 +- .../Entities/{ => Forum}/PlateEntity.cs | 2 +- .../Entities/Integral/LevelEntity.cs | 51 +++++++++++++++++++ .../Entities/Integral/SignInEntity.cs | 31 +++++++++++ .../ArticleImport/AbstractArticleImport.cs | 2 +- .../ArticleImport/DefaultArticleImport.cs | 2 +- .../ArticleImport/VuePressArticleImport.cs | 2 +- .../Managers/ForumManager.cs | 2 +- .../Managers/IntegralManager.cs | 49 ++++++++++++++++++ .../Repositories/IArticleRepository.cs | 2 +- .../DataSeeds/BannerDataSeed.cs | 2 +- .../DataSeeds/LevelDataSeed.cs | 41 +++++++++++++++ .../Repositories/ArticleRepository.cs | 2 +- .../Dtos/FileManager/FileGetListOutputDto.cs | 4 +- .../IServices/IFileService.cs | 2 +- .../Services/FileService.cs | 2 +- .../Jobs/TestJob.cs | 2 +- .../src/Yi.Abp.Application/Jobs/TestJob.cs | 2 +- 46 files changed, 466 insertions(+), 80 deletions(-) create mode 100644 Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Level/LevelGetListInputDto.cs create mode 100644 Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Level/LevelOutputDto.cs create mode 100644 Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/ILevelService.cs create mode 100644 Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/EventHandlers/MoneyChangeEventHandler.cs rename Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/{ => Forum}/AgreeService.cs (93%) rename Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/{ => Forum}/ArticleService.cs (97%) rename Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/{ => Forum}/BannerService.cs (90%) rename Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/{ => Forum}/CommentService.cs (96%) rename Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/{ => Forum}/DiscussService.cs (90%) rename Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/{ => Forum}/MyTypeService.cs (84%) rename Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/{ => Forum}/PlateService.cs (88%) create mode 100644 Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Integral/IntegralService.cs create mode 100644 Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Integral/LevelService.cs create mode 100644 Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Etos/ExperienceChangeEventArgs.cs create mode 100644 Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Etos/MoneyChangeEventArgs.cs rename Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/{ => Forum}/AgreeEntity .cs (93%) rename Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/{ => Forum}/ArticleEntity.cs (93%) rename Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/{ => Forum}/BannerEntity.cs (93%) rename Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/{ => Forum}/CommentEntity.cs (95%) rename Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/{ => Forum}/DiscussEntity.cs (97%) rename Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/{ => Forum}/DiscussMyTypeEntity.cs (88%) rename Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/{ => Forum}/DiscussTopEntity.cs (92%) rename Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/{ => Forum}/MyTypeEntity.cs (91%) rename Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/{ => Forum}/PlateEntity.cs (95%) create mode 100644 Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Integral/LevelEntity.cs create mode 100644 Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Integral/SignInEntity.cs create mode 100644 Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/IntegralManager.cs create mode 100644 Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/DataSeeds/LevelDataSeed.cs diff --git a/Yi.Abp.Net8/module/audit-logging/Yi.AuditLogging.SqlSugarCore/SqlSugarCoreAuditLogRepository.cs b/Yi.Abp.Net8/module/audit-logging/Yi.AuditLogging.SqlSugarCore/SqlSugarCoreAuditLogRepository.cs index 1d8122d0..0c2a4726 100644 --- a/Yi.Abp.Net8/module/audit-logging/Yi.AuditLogging.SqlSugarCore/SqlSugarCoreAuditLogRepository.cs +++ b/Yi.Abp.Net8/module/audit-logging/Yi.AuditLogging.SqlSugarCore/SqlSugarCoreAuditLogRepository.cs @@ -4,15 +4,16 @@ using System.Net; using Mapster; using SqlSugar; using Volo.Abp.Auditing; +using Volo.Abp.AuditLogging; using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Repositories; using Yi.AuditLogging.SqlSugarCore.Entities; using Yi.Framework.SqlSugarCore.Repositories; -namespace Volo.Abp.AuditLogging.EntityFrameworkCore; +namespace Yi.AuditLogging.SqlSugarCore; -public class SqlSugarCoreAuditLogRepository : SqlSugarObjectRepository,IAuditLogRepository +public class SqlSugarCoreAuditLogRepository : SqlSugarObjectRepository, IAuditLogRepository { public virtual async Task> GetListAsync( string sorting = null, @@ -52,7 +53,7 @@ public class SqlSugarCoreAuditLogRepository : SqlSugarObjectRepository>(); @@ -138,7 +139,7 @@ public class SqlSugarCoreAuditLogRepository : SqlSugarObjectRepository a.ExecutionTime < endDate.AddDays(1) && a.ExecutionTime > startDate) .OrderBy(t => t.ExecutionTime) .GroupBy(t => new { t.ExecutionTime.Date }) - .Select(g => new { Day =SqlFunc.AggregateMin(g.ExecutionTime), avgExecutionTime = SqlFunc.AggregateAvg( g.ExecutionDuration) }) + .Select(g => new { Day = SqlFunc.AggregateMin(g.ExecutionTime), avgExecutionTime = SqlFunc.AggregateAvg(g.ExecutionDuration) }) .ToListAsync(cancellationToken); return result.ToDictionary(element => element.Day.ClearTime(), element => (double)element.avgExecutionTime); @@ -176,7 +177,7 @@ public class SqlSugarCoreAuditLogRepository : SqlSugarObjectRepository + /// 当前等级 + /// + public int? MinLevel { get; set; } + + /// + /// 等级名称 + /// + public string? Name { get; set; } + } +} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Level/LevelOutputDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Level/LevelOutputDto.cs new file mode 100644 index 00000000..f6584fa9 --- /dev/null +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Level/LevelOutputDto.cs @@ -0,0 +1,34 @@ +using Volo.Abp.Application.Dtos; + +namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Level +{ + public class LevelOutputDto : EntityDto + { + public Guid Id { get; set; } + + /// + /// 当前等级 + /// + public int CurrentLevel { get; set; } + + /// + /// 最小所需经验值 + /// + public decimal MinExperience { get; set; } + + /// + /// 等级名称 + /// + public string Name { get; set; } + + /// + /// 等级称号 + /// + public string? Nick { get; set; } + + /// + /// 等候logo + /// + public string? Logo { get; set; } + } +} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/ILevelService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/ILevelService.cs new file mode 100644 index 00000000..66d5b9f7 --- /dev/null +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/ILevelService.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Yi.Framework.Bbs.Application.Contracts.Dtos.Level; +using Yi.Framework.Ddd.Application.Contracts; + +namespace Yi.Framework.Bbs.Application.Contracts.IServices +{ + public interface ILevelService : IYiCrudAppService + { + } +} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/EventHandlers/MoneyChangeEventHandler.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/EventHandlers/MoneyChangeEventHandler.cs new file mode 100644 index 00000000..59ff5286 --- /dev/null +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/EventHandlers/MoneyChangeEventHandler.cs @@ -0,0 +1,24 @@ +using Volo.Abp.DependencyInjection; +using Volo.Abp.EventBus; +using Yi.Framework.Bbs.Domain.Entities; +using Yi.Framework.Bbs.Domain.Shared.Etos; +using Yi.Framework.SqlSugarCore.Abstractions; + +namespace Yi.Framework.Bbs.Application.EventHandlers +{ + public class MoneyChangeEventHandler : ILocalEventHandler, ITransientDependency + { + private ISqlSugarRepository _userInfoRepository; + public MoneyChangeEventHandler(ISqlSugarRepository userInfoRepository) + { + _userInfoRepository = userInfoRepository; + } + public async Task HandleEventAsync(MoneyChangeEventArgs eventData) + { + //原子性sql + await _userInfoRepository._Db.Updateable() + .SetColumns(it => it.Money == it.Money + eventData.Number) + .Where(x => x.UserId == eventData.UserId).ExecuteCommandAsync(); + } + } +} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/EventHandlers/SeeDiscussEventHandler.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/EventHandlers/SeeDiscussEventHandler.cs index ce7bb524..73f4f786 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/EventHandlers/SeeDiscussEventHandler.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/EventHandlers/SeeDiscussEventHandler.cs @@ -6,10 +6,10 @@ 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.Entities.Forum; using Yi.Framework.Bbs.Domain.Shared.Etos; -namespace Yi.Framework.Bbs.Domain.EventHandlers +namespace Yi.Framework.Bbs.Application.EventHandlers { public class SeeDiscussEventHandler : ILocalEventHandler, ITransientDependency { diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/EventHandlers/UserCreateEventHandler.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/EventHandlers/UserCreateEventHandler.cs index 55674057..ee86c053 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/EventHandlers/UserCreateEventHandler.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/EventHandlers/UserCreateEventHandler.cs @@ -5,7 +5,7 @@ using Yi.Framework.Bbs.Domain.Entities; using Yi.Framework.Bbs.Domain.Shared.Enums; using Yi.Framework.Rbac.Domain.Shared.Etos; -namespace Yi.Framework.Rbac.Application.EventHandlers +namespace Yi.Framework.Bbs.Application.EventHandlers { public class UserCreateEventHandler : ILocalEventHandler, ITransientDependency { @@ -19,7 +19,7 @@ namespace Yi.Framework.Rbac.Application.EventHandlers //创建主表 var bbsUser = new BbsUserExtraInfoEntity(eventData.UserId) { - + }; await _repository.InsertAsync(bbsUser); } diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Analyses/BbsForumAnalyseService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Analyses/BbsForumAnalyseService.cs index 4869d889..926bb53b 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Analyses/BbsForumAnalyseService.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Analyses/BbsForumAnalyseService.cs @@ -5,6 +5,7 @@ using Volo.Abp.Application.Services; using Yi.Framework.Bbs.Application.Contracts.Dtos.BbsUser; using Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss; using Yi.Framework.Bbs.Domain.Entities; +using Yi.Framework.Bbs.Domain.Entities.Forum; using Yi.Framework.Bbs.Domain.Managers; using Yi.Framework.Bbs.Domain.Shared.Enums; using Yi.Framework.Rbac.Domain.Entities; diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/AgreeService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/AgreeService.cs similarity index 93% rename from Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/AgreeService.cs rename to Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/AgreeService.cs index 0e5404a6..2350f2d4 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/AgreeService.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/AgreeService.cs @@ -3,10 +3,10 @@ using Volo.Abp; using Volo.Abp.Application.Services; using Volo.Abp.Uow; using Yi.Framework.Bbs.Application.Contracts.Dtos.Argee; -using Yi.Framework.Bbs.Domain.Entities; +using Yi.Framework.Bbs.Domain.Entities.Forum; using Yi.Framework.SqlSugarCore.Abstractions; -namespace Yi.Framework.Bbs.Application.Services +namespace Yi.Framework.Bbs.Application.Services.Forum { /// /// 点赞功能 @@ -32,7 +32,7 @@ namespace Yi.Framework.Bbs.Application.Services [Authorize] public async Task PostOperateAsync(Guid discussId) { - var entity = await _repository.GetFirstAsync(x => x.DiscussId == discussId && x.CreatorId == this.CurrentUser.Id); + var entity = await _repository.GetFirstAsync(x => x.DiscussId == discussId && x.CreatorId == CurrentUser.Id); //判断是否已经点赞过 if (entity is null) { diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/ArticleService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/ArticleService.cs similarity index 97% rename from Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/ArticleService.cs rename to Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/ArticleService.cs index 57de3e2b..80e85a52 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/ArticleService.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/ArticleService.cs @@ -13,7 +13,7 @@ using Volo.Abp.Domain.Repositories; using Yi.Framework.Bbs.Application.Contracts.Dtos.Article; using Yi.Framework.Bbs.Application.Contracts.Dtos.Plate; using Yi.Framework.Bbs.Application.Contracts.IServices; -using Yi.Framework.Bbs.Domain.Entities; +using Yi.Framework.Bbs.Domain.Entities.Forum; using Yi.Framework.Bbs.Domain.Extensions; using Yi.Framework.Bbs.Domain.Managers; using Yi.Framework.Bbs.Domain.Repositories; @@ -25,7 +25,7 @@ using Yi.Framework.Rbac.Domain.Authorization; using Yi.Framework.Rbac.Domain.Shared.Consts; using Yi.Framework.SqlSugarCore.Abstractions; -namespace Yi.Framework.Bbs.Application.Services +namespace Yi.Framework.Bbs.Application.Services.Forum { /// /// Article服务实现 @@ -193,7 +193,7 @@ namespace Yi.Framework.Bbs.Application.Services //这块有点绕,这个版本的写法比较清晰 bool result = false; - if (this.CurrentUser.GetPermissions().Contains(UserConst.AdminPermissionCode)) + if (CurrentUser.GetPermissions().Contains(UserConst.AdminPermissionCode)) { //如果是超管,直接跳过 result = true; diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/BannerService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/BannerService.cs similarity index 90% rename from Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/BannerService.cs rename to Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/BannerService.cs index 45b66530..77879fd5 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/BannerService.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/BannerService.cs @@ -3,11 +3,11 @@ using Volo.Abp.Application.Dtos; using Volo.Abp.Domain.Repositories; using Yi.Framework.Bbs.Application.Contracts.Dtos.Banner; using Yi.Framework.Bbs.Application.Contracts.IServices; -using Yi.Framework.Bbs.Domain.Entities; +using Yi.Framework.Bbs.Domain.Entities.Forum; using Yi.Framework.Ddd.Application; using Yi.Framework.SqlSugarCore.Abstractions; -namespace Yi.Framework.Bbs.Application.Services +namespace Yi.Framework.Bbs.Application.Services.Forum { /// /// Banner服务实现 @@ -18,7 +18,7 @@ namespace Yi.Framework.Bbs.Application.Services private ISqlSugarRepository _repository; public BannerService(ISqlSugarRepository repository) : base(repository) { - _repository= repository; + _repository = repository; } public override async Task> GetListAsync(BannerGetListInputVo input) diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/CommentService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/CommentService.cs similarity index 96% rename from Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/CommentService.cs rename to Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/CommentService.cs index 5cd83247..59418a68 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/CommentService.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/CommentService.cs @@ -7,7 +7,7 @@ using Volo.Abp.Application.Dtos; using Yi.Framework.Bbs.Application.Contracts.Dtos.BbsUser; using Yi.Framework.Bbs.Application.Contracts.Dtos.Comment; using Yi.Framework.Bbs.Application.Contracts.IServices; -using Yi.Framework.Bbs.Domain.Entities; +using Yi.Framework.Bbs.Domain.Entities.Forum; using Yi.Framework.Bbs.Domain.Extensions; using Yi.Framework.Bbs.Domain.Managers; using Yi.Framework.Bbs.Domain.Shared.Consts; @@ -16,7 +16,7 @@ using Yi.Framework.Rbac.Domain.Authorization; using Yi.Framework.Rbac.Domain.Shared.Consts; using Yi.Framework.SqlSugarCore.Abstractions; -namespace Yi.Framework.Bbs.Application.Services +namespace Yi.Framework.Bbs.Application.Services.Forum { /// /// 评论 @@ -112,7 +112,7 @@ namespace Yi.Framework.Bbs.Application.Services } //子类需要排序 - var rootOutoutDto= allOutoutDto.Where(x => x.ParentId == Guid.Empty).ToList(); + var rootOutoutDto = allOutoutDto.Where(x => x.ParentId == Guid.Empty).ToList(); rootOutoutDto?.ForEach(x => { x.Children = x.Children.OrderByDescending(x => x.CreationTime).ToList(); diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/DiscussService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/DiscussService.cs similarity index 90% rename from Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/DiscussService.cs rename to Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/DiscussService.cs index 91b6a07d..c24de344 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/DiscussService.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/DiscussService.cs @@ -10,6 +10,7 @@ using Yi.Framework.Bbs.Application.Contracts.Dtos.BbsUser; using Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss; using Yi.Framework.Bbs.Application.Contracts.IServices; using Yi.Framework.Bbs.Domain.Entities; +using Yi.Framework.Bbs.Domain.Entities.Forum; using Yi.Framework.Bbs.Domain.Extensions; using Yi.Framework.Bbs.Domain.Managers; using Yi.Framework.Bbs.Domain.Shared.Consts; @@ -22,7 +23,7 @@ using Yi.Framework.Rbac.Domain.Entities; using Yi.Framework.Rbac.Domain.Shared.Consts; using Yi.Framework.SqlSugarCore.Abstractions; -namespace Yi.Framework.Bbs.Application.Services +namespace Yi.Framework.Bbs.Application.Services.Forum { /// /// Discuss应用服务实现,用于参数效验、领域服务业务组合、日志记录、事务处理、账户信息 @@ -58,10 +59,10 @@ namespace Yi.Framework.Bbs.Application.Services //查询主题发布 浏览主题 事件,浏览数+1 var item = await _forumManager._discussRepository._DbQueryable.LeftJoin((discuss, user) => discuss.CreatorId == user.Id) .LeftJoin((discuss, user, info) => user.Id == info.UserId) - .LeftJoin((discuss, user, info,plate) => plate.Id == discuss.PlateId) + .LeftJoin((discuss, user, info, plate) => plate.Id == discuss.PlateId) .Select((discuss, user, info, plate) => new DiscussGetOutputDto { - Id=discuss.Id, + Id = discuss.Id, IsAgree = SqlFunc.Subqueryable().WhereIF(CurrentUser.Id != null, x => x.CreatorId == CurrentUser.Id && x.DiscussId == discuss.Id).Any(), User = new BbsUserGetListOutputDto() { @@ -72,14 +73,14 @@ namespace Yi.Framework.Bbs.Application.Services Level = info.Level, UserLimit = info.UserLimit }, - Plate=new Contracts.Dtos.Plate.PlateGetOutputDto() - { - Name=plate.Name, - Id=plate.Id, - Code=plate.Code, - Introduction=plate.Introduction, - Logo=plate.Logo - + Plate = new Contracts.Dtos.Plate.PlateGetOutputDto() + { + Name = plate.Name, + Id = plate.Id, + Code = plate.Code, + Introduction = plate.Introduction, + Logo = plate.Logo + } }, true) .SingleAsync(discuss => discuss.Id == id); @@ -106,7 +107,7 @@ namespace Yi.Framework.Bbs.Application.Services var items = await _forumManager._discussRepository._DbQueryable .WhereIF(!string.IsNullOrEmpty(input.Title), x => x.Title.Contains(input.Title)) .WhereIF(input.PlateId is not null, x => x.PlateId == input.PlateId) - .WhereIF(input.IsTop is not null,x=>x.IsTop==input.IsTop) + .WhereIF(input.IsTop is not null, x => x.IsTop == input.IsTop) .LeftJoin((discuss, user) => discuss.CreatorId == user.Id) .LeftJoin((discuss, user, info) => user.Id == info.UserId) @@ -155,21 +156,21 @@ namespace Yi.Framework.Bbs.Application.Services User = new BbsUserGetListOutputDto { Id = user.Id, - Name=user.Name, + Name = user.Name, Sex = user.Sex, State = user.State, Address = user.Address, Age = user.Age, CreationTime = user.CreationTime, - - Level =info.Level, - Introduction = user.Introduction, - Icon= user.Icon, - Nick= user.Nick, - UserName=user.UserName, - Remark= user.Remark, - UserLimit=info.UserLimit - + + Level = info.Level, + Introduction = user.Introduction, + Icon = user.Icon, + Nick = user.Nick, + UserName = user.UserName, + Remark = user.Remark, + UserLimit = info.UserLimit + } }, true) .ToListAsync(); diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/MyTypeService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/MyTypeService.cs similarity index 84% rename from Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/MyTypeService.cs rename to Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/MyTypeService.cs index 33f1e953..af273095 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/MyTypeService.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/MyTypeService.cs @@ -2,11 +2,11 @@ using Volo.Abp.Application.Dtos; using Volo.Abp.Data; using Yi.Framework.Bbs.Application.Contracts.Dtos.MyType; using Yi.Framework.Bbs.Application.Contracts.IServices; -using Yi.Framework.Bbs.Domain.Entities; +using Yi.Framework.Bbs.Domain.Entities.Forum; using Yi.Framework.Ddd.Application; using Yi.Framework.SqlSugarCore.Abstractions; -namespace Yi.Framework.Bbs.Application.Services +namespace Yi.Framework.Bbs.Application.Services.Forum { /// /// Label服务实现 @@ -15,9 +15,9 @@ namespace Yi.Framework.Bbs.Application.Services IMyTypeService { private ISqlSugarRepository _repository; - public MyTypeService(ISqlSugarRepository repository, IDataFilter dataFilter):base(repository) + public MyTypeService(ISqlSugarRepository repository, IDataFilter dataFilter) : base(repository) { - _repository= repository; + _repository = repository; _dataFilter = dataFilter; } @@ -32,7 +32,7 @@ namespace Yi.Framework.Bbs.Application.Services { //过滤器需要更换 //_dataFilter.Enable(x => x.UserId == CurrentUser.Id); - + //_dataFilter.AddFilter(x => x.UserId == CurrentUser.Id); return base.GetListAsync(input); } @@ -45,7 +45,7 @@ namespace Yi.Framework.Bbs.Application.Services public override async Task CreateAsync(MyTypeCreateInputVo input) { var entity = await MapToEntityAsync(input); - entity.UserId = CurrentUser.Id??Guid.Empty; + entity.UserId = CurrentUser.Id ?? Guid.Empty; entity.IsDeleted = false; var outputEntity = await _repository.InsertReturnEntityAsync(entity); return await MapToGetOutputDtoAsync(outputEntity); diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/PlateService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/PlateService.cs similarity index 88% rename from Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/PlateService.cs rename to Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/PlateService.cs index c5964a0b..2c4aecef 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/PlateService.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/PlateService.cs @@ -3,12 +3,12 @@ using Volo.Abp.Application.Dtos; using Volo.Abp.Domain.Repositories; using Yi.Framework.Bbs.Application.Contracts.Dtos.Plate; using Yi.Framework.Bbs.Application.Contracts.IServices; -using Yi.Framework.Bbs.Domain.Entities; +using Yi.Framework.Bbs.Domain.Entities.Forum; using Yi.Framework.Ddd.Application; using Yi.Framework.Rbac.Application.Contracts.Dtos.Config; using Yi.Framework.SqlSugarCore.Abstractions; -namespace Yi.Framework.Bbs.Application.Services +namespace Yi.Framework.Bbs.Application.Services.Forum { /// /// Plate服务实现 @@ -19,7 +19,7 @@ namespace Yi.Framework.Bbs.Application.Services private ISqlSugarRepository _repository; public PlateService(ISqlSugarRepository repository) : base(repository) { - _repository= repository; + _repository = repository; } public override async Task> GetListAsync(PlateGetListInputVo input) @@ -29,7 +29,7 @@ namespace Yi.Framework.Bbs.Application.Services var entities = await _repository._DbQueryable.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name.Contains(input.Name!)) .WhereIF(!string.IsNullOrEmpty(input.Code), x => x.Name.Contains(input.Code!)) .WhereIF(input.StartTime is not null && input.EndTime is not null, x => x.CreationTime >= input.StartTime && x.CreationTime <= input.EndTime) - .OrderByDescending(x=>x.OrderNum) + .OrderByDescending(x => x.OrderNum) .ToPageListAsync(input.SkipCount, input.MaxResultCount, total); return new PagedResultDto(total, await MapToGetListOutputDtosAsync(entities)); } diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Integral/IntegralService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Integral/IntegralService.cs new file mode 100644 index 00000000..768506d2 --- /dev/null +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Integral/IntegralService.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.Application.Services; +using Yi.Framework.Bbs.Domain.Managers; + +namespace Yi.Framework.Bbs.Application.Services.Integral +{ + public class IntegralService:ApplicationService + { + private IntegralManager _integralManager; + public IntegralService(IntegralManager integralManager) + { + _integralManager= integralManager; + } + + } +} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Integral/LevelService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Integral/LevelService.cs new file mode 100644 index 00000000..e4103368 --- /dev/null +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Integral/LevelService.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using SqlSugar; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Domain.Repositories; +using Yi.Framework.Bbs.Application.Contracts.Dtos.Level; +using Yi.Framework.Bbs.Application.Contracts.IServices; +using Yi.Framework.Bbs.Domain.Entities.Integral; +using Yi.Framework.Ddd.Application; +using Yi.Framework.SqlSugarCore.Abstractions; + +namespace Yi.Framework.Bbs.Application.Services.Integral +{ + /// + /// 等级服务 + /// + public class LevelService : YiCrudAppService, ILevelService + { + private ISqlSugarRepository _repository; + public LevelService(ISqlSugarRepository repository) : base(repository) + { + _repository= repository; + } + + /// + /// 查询等级配置 + /// + /// + /// + public override async Task> GetListAsync(LevelGetListInputDto input) + { + RefAsync total = 0; + + var entities = await _repository._DbQueryable + .WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name.Contains(input.Name!)) + .WhereIF(input.MinLevel is not null , x => x.CurrentLevel>=input.MinLevel) + .OrderBy(x => x.CurrentLevel) + .ToPageListAsync(input.SkipCount, input.MaxResultCount, total); + return new PagedResultDto(total, await MapToGetListOutputDtosAsync(entities)); + } + } +} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Etos/ExperienceChangeEventArgs.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Etos/ExperienceChangeEventArgs.cs new file mode 100644 index 00000000..1cebd2c7 --- /dev/null +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Etos/ExperienceChangeEventArgs.cs @@ -0,0 +1,21 @@ +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 ExperienceChangeEventArgs + { + /// + /// 用户id + /// + public Guid UserId { get; set; } + + /// + /// 变化经验,可负 + /// + public decimal Number { get; set; } + } +} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Etos/MoneyChangeEventArgs.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Etos/MoneyChangeEventArgs.cs new file mode 100644 index 00000000..6282e70d --- /dev/null +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Etos/MoneyChangeEventArgs.cs @@ -0,0 +1,21 @@ +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 MoneyChangeEventArgs + { + /// + /// 用户id + /// + public Guid UserId { get; set; } + + /// + /// 变化金额,可负 + /// + public decimal Number { get; set; } + } +} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/BbsUserExtraInfoEntity.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/BbsUserExtraInfoEntity.cs index a1d6b0d2..f5dc3b46 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/BbsUserExtraInfoEntity.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/BbsUserExtraInfoEntity.cs @@ -27,15 +27,27 @@ namespace Yi.Framework.Bbs.Domain.Entities /// public Guid UserId { get; set; } + /// + /// 用户限制 + /// + public UserLimitEnum UserLimit { get; set; } = UserLimitEnum.Normal; + + /// /// 用户等级 /// public int Level { get; set; } = 1; /// - /// 用户限制 + /// 钱钱 /// - public UserLimitEnum UserLimit { get; set; } = UserLimitEnum.Normal; + public decimal Money { get; set; } = 0m; + + + /// + /// 经验 + /// + public long Experience { get; set; } = 0; } } diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/AgreeEntity .cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/AgreeEntity .cs similarity index 93% rename from Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/AgreeEntity .cs rename to Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/AgreeEntity .cs index 281a7742..e2fa7334 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/AgreeEntity .cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/AgreeEntity .cs @@ -2,7 +2,7 @@ using Volo.Abp.Auditing; using Volo.Abp.Domain.Entities; -namespace Yi.Framework.Bbs.Domain.Entities +namespace Yi.Framework.Bbs.Domain.Entities.Forum { [SugarTable("Agree")] public class AgreeEntity : Entity, ICreationAuditedObject diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/ArticleEntity.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/ArticleEntity.cs similarity index 93% rename from Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/ArticleEntity.cs rename to Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/ArticleEntity.cs index a46c8cb4..1b285d82 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/ArticleEntity.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/ArticleEntity.cs @@ -3,10 +3,10 @@ using Volo.Abp; using Volo.Abp.Auditing; using Volo.Abp.Domain.Entities; -namespace Yi.Framework.Bbs.Domain.Entities +namespace Yi.Framework.Bbs.Domain.Entities.Forum { [SugarTable("Article")] - public class ArticleEntity : Entity, ISoftDelete,IAuditedObject + public class ArticleEntity : Entity, ISoftDelete, IAuditedObject { [SugarColumn(ColumnName = "Id", IsPrimaryKey = true)] public override Guid Id { get; protected set; } diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/BannerEntity.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/BannerEntity.cs similarity index 93% rename from Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/BannerEntity.cs rename to Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/BannerEntity.cs index aea6379f..009ff29b 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/BannerEntity.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/BannerEntity.cs @@ -3,7 +3,7 @@ using Volo.Abp; using Volo.Abp.Auditing; using Volo.Abp.Domain.Entities; -namespace Yi.Framework.Bbs.Domain.Entities +namespace Yi.Framework.Bbs.Domain.Entities.Forum { [SugarTable("Banner")] public class BannerEntity : Entity, ISoftDelete, IAuditedObject diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/CommentEntity.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/CommentEntity.cs similarity index 95% rename from Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/CommentEntity.cs rename to Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/CommentEntity.cs index 81020a9c..29a95943 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/CommentEntity.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/CommentEntity.cs @@ -4,7 +4,7 @@ using Volo.Abp.Auditing; using Volo.Abp.Domain.Entities; using Yi.Framework.Rbac.Domain.Entities; -namespace Yi.Framework.Bbs.Domain.Entities +namespace Yi.Framework.Bbs.Domain.Entities.Forum { /// @@ -29,7 +29,7 @@ namespace Yi.Framework.Bbs.Domain.Entities public override Guid Id { get; protected set; } public bool IsDeleted { get; set; } - [SugarColumn(Length =500)] + [SugarColumn(Length = 500)] public string Content { get; set; } public Guid DiscussId { get; set; } diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/DiscussEntity.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/DiscussEntity.cs similarity index 97% rename from Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/DiscussEntity.cs rename to Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/DiscussEntity.cs index 0817e1a3..79956431 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/DiscussEntity.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/DiscussEntity.cs @@ -4,7 +4,7 @@ using Volo.Abp.Auditing; using Volo.Abp.Domain.Entities; using Yi.Framework.Bbs.Domain.Shared.Enums; -namespace Yi.Framework.Bbs.Domain.Entities +namespace Yi.Framework.Bbs.Domain.Entities.Forum { [SugarTable("Discuss")] public class DiscussEntity : Entity, ISoftDelete, IAuditedObject diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/DiscussMyTypeEntity.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/DiscussMyTypeEntity.cs similarity index 88% rename from Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/DiscussMyTypeEntity.cs rename to Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/DiscussMyTypeEntity.cs index cc8b85e3..0e7a1ede 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/DiscussMyTypeEntity.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/DiscussMyTypeEntity.cs @@ -1,7 +1,7 @@ using SqlSugar; using Volo.Abp.Domain.Entities; -namespace Yi.Framework.Bbs.Domain.Entities +namespace Yi.Framework.Bbs.Domain.Entities.Forum { [SugarTable("DiscussMyType")] public class DiscussMyTypeEntity : Entity diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/DiscussTopEntity.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/DiscussTopEntity.cs similarity index 92% rename from Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/DiscussTopEntity.cs rename to Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/DiscussTopEntity.cs index 57f22819..4ce74c77 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/DiscussTopEntity.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/DiscussTopEntity.cs @@ -7,7 +7,7 @@ using SqlSugar; using Volo.Abp.Auditing; using Volo.Abp.Domain.Entities; -namespace Yi.Framework.Bbs.Domain.Entities +namespace Yi.Framework.Bbs.Domain.Entities.Forum { /// /// 首页置顶主题 diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/MyTypeEntity.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/MyTypeEntity.cs similarity index 91% rename from Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/MyTypeEntity.cs rename to Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/MyTypeEntity.cs index b25fe547..2a6f6734 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/MyTypeEntity.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/MyTypeEntity.cs @@ -2,7 +2,7 @@ using Volo.Abp; using Volo.Abp.Domain.Entities; -namespace Yi.Framework.Bbs.Domain.Entities +namespace Yi.Framework.Bbs.Domain.Entities.Forum { [SugarTable("MyType")] public class MyTypeEntity : Entity, ISoftDelete diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/PlateEntity.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/PlateEntity.cs similarity index 95% rename from Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/PlateEntity.cs rename to Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/PlateEntity.cs index 5c91579d..9bd05527 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/PlateEntity.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/PlateEntity.cs @@ -3,7 +3,7 @@ using Volo.Abp.Domain.Entities; using Volo.Abp; using Volo.Abp.Auditing; -namespace Yi.Framework.Bbs.Domain.Entities +namespace Yi.Framework.Bbs.Domain.Entities.Forum { [SugarTable("Plate")] public class PlateEntity : Entity, ISoftDelete, IAuditedObject diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Integral/LevelEntity.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Integral/LevelEntity.cs new file mode 100644 index 00000000..a52f9f8d --- /dev/null +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Integral/LevelEntity.cs @@ -0,0 +1,51 @@ +using SqlSugar; +using Volo.Abp.Domain.Entities; + +namespace Yi.Framework.Bbs.Domain.Entities.Integral +{ + /// + /// 等级表 + /// + [SugarTable("Level")] + public class LevelEntity : Entity + { + public LevelEntity() { } + + public LevelEntity(int currentLevel, string name, decimal minExperience) + { + this.CurrentLevel = currentLevel; + this.Name = name; + this.MinExperience = minExperience; + } + + [SugarColumn(IsPrimaryKey = true)] + public override Guid Id { get; protected set; } + + + /// + /// 当前等级 + /// + public int CurrentLevel { get; set; } + + /// + /// 最小所需经验值 + /// + public decimal MinExperience { get; set; } + + /// + /// 等级名称 + /// + public string Name { get; set; } + + /// + /// 等级称号 + /// + public string? Nick { get; set; } + + /// + /// 等候logo + /// + public string? Logo { get; set; } + + } +} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Integral/SignInEntity.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Integral/SignInEntity.cs new file mode 100644 index 00000000..d7f110bf --- /dev/null +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Integral/SignInEntity.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using SqlSugar; +using Volo.Abp.Auditing; +using Volo.Abp.Domain.Entities; + +namespace Yi.Framework.Bbs.Domain.Entities.Integral +{ + /// + /// 签到表 + /// + [SugarTable("SignIn")] + public class SignInEntity : Entity, ICreationAuditedObject + { + + [SugarColumn(IsPrimaryKey = true)] + public override Guid Id { get; protected set; } + + /// + /// 签到时间 + /// + public DateTime CreationTime { get; set; } + + //签到用户 + public Guid? CreatorId { get; set; } + + } +} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/ArticleImport/AbstractArticleImport.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/ArticleImport/AbstractArticleImport.cs index 85de471d..8919b717 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/ArticleImport/AbstractArticleImport.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/ArticleImport/AbstractArticleImport.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.Extensions.Logging; -using Yi.Framework.Bbs.Domain.Entities; +using Yi.Framework.Bbs.Domain.Entities.Forum; using Yi.Framework.Bbs.Domain.Shared.Model; using Yi.Framework.Core.Data; diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/ArticleImport/DefaultArticleImport.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/ArticleImport/DefaultArticleImport.cs index 8ca58332..d67281b8 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/ArticleImport/DefaultArticleImport.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/ArticleImport/DefaultArticleImport.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using Yi.Framework.Bbs.Domain.Entities; +using Yi.Framework.Bbs.Domain.Entities.Forum; using Yi.Framework.Bbs.Domain.Shared.Model; namespace Yi.Framework.Bbs.Domain.Managers.ArticleImport diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/ArticleImport/VuePressArticleImport.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/ArticleImport/VuePressArticleImport.cs index e6186748..c29325d8 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/ArticleImport/VuePressArticleImport.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/ArticleImport/VuePressArticleImport.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.Extensions.Logging; -using Yi.Framework.Bbs.Domain.Entities; +using Yi.Framework.Bbs.Domain.Entities.Forum; using Yi.Framework.Bbs.Domain.Shared.Model; namespace Yi.Framework.Bbs.Domain.Managers.ArticleImport diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/ForumManager.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/ForumManager.cs index 8dc50597..ade1d964 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/ForumManager.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/ForumManager.cs @@ -1,7 +1,7 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Volo.Abp.Domain.Services; -using Yi.Framework.Bbs.Domain.Entities; +using Yi.Framework.Bbs.Domain.Entities.Forum; using Yi.Framework.Bbs.Domain.Managers.ArticleImport; using Yi.Framework.Bbs.Domain.Shared.Enums; using Yi.Framework.Bbs.Domain.Shared.Model; diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/IntegralManager.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/IntegralManager.cs new file mode 100644 index 00000000..cf428c3e --- /dev/null +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/IntegralManager.cs @@ -0,0 +1,49 @@ +using Volo.Abp.Domain.Services; +using Volo.Abp.EventBus.Local; +using Yi.Framework.Bbs.Domain.Entities.Integral; +using Yi.Framework.Bbs.Domain.Shared.Etos; +using Yi.Framework.SqlSugarCore.Abstractions; + +namespace Yi.Framework.Bbs.Domain.Managers +{ + public class IntegralManager : DomainService + { + private ISqlSugarRepository _levelRepository; + private ISqlSugarRepository _signInRepository; + private readonly ILocalEventBus _localEventBus; + public IntegralManager(ISqlSugarRepository levelRepository, ISqlSugarRepository signInRepository, ILocalEventBus localEventBus) + { + _levelRepository = levelRepository; + _localEventBus = localEventBus; + _signInRepository = signInRepository; + } + + + /// + /// 签到 + /// + /// + public async Task PostSignInAsync(Guid userId) + { + //签到,添加用户钱钱 + //发送一个充值的领域事件即可 + + + //签到添加的钱钱,跟连续签到有关系 + //每天随机(3-10),连续签到每次累加多1点,最多一天30 + + //额外 + //如果随机数数字都相同,额外再获取乘10倍 + + //这种逻辑,就是属于核心领域业务了 + decimal number = 3; + + + //发布一个其他领域的事件 + await _localEventBus.PublishAsync(new MoneyChangeEventArgs() { UserId = userId, Number = number }); + } + + + + } +} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Repositories/IArticleRepository.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Repositories/IArticleRepository.cs index 6e974751..f6e4b0bf 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Repositories/IArticleRepository.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Repositories/IArticleRepository.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Linq.Expressions; using System.Text; using System.Threading.Tasks; -using Yi.Framework.Bbs.Domain.Entities; +using Yi.Framework.Bbs.Domain.Entities.Forum; using Yi.Framework.SqlSugarCore.Abstractions; namespace Yi.Framework.Bbs.Domain.Repositories diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/DataSeeds/BannerDataSeed.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/DataSeeds/BannerDataSeed.cs index 9e6168c0..35517f64 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/DataSeeds/BannerDataSeed.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/DataSeeds/BannerDataSeed.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; using Volo.Abp.Data; using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Repositories; -using Yi.Framework.Bbs.Domain.Entities; +using Yi.Framework.Bbs.Domain.Entities.Forum; using Yi.Framework.Rbac.Domain.Entities; using Yi.Framework.SqlSugarCore.Abstractions; diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/DataSeeds/LevelDataSeed.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/DataSeeds/LevelDataSeed.cs new file mode 100644 index 00000000..e62c0f73 --- /dev/null +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/DataSeeds/LevelDataSeed.cs @@ -0,0 +1,41 @@ +using Volo.Abp.Data; +using Volo.Abp.DependencyInjection; +using Yi.Framework.Bbs.Domain.Entities.Integral; +using Yi.Framework.SqlSugarCore.Abstractions; + +namespace Yi.Framework.Bbs.SqlSugarCore.DataSeeds +{ + public class LevelDataSeed : IDataSeedContributor, ITransientDependency + { + private ISqlSugarRepository _repository; + public LevelDataSeed(ISqlSugarRepository repository) + { + _repository = repository; + } + public async Task SeedAsync(DataSeedContext context) + { + if (!await _repository.IsAnyAsync(x => true)) + { + await _repository.InsertManyAsync(GetSeedData()); + } + } + public List GetSeedData() + { + List entities = new List() + { + new LevelEntity(1,"小白",10), + new LevelEntity(2,"中白",30), + new LevelEntity(3,"大白",100), + new LevelEntity(4,"精英",300), + new LevelEntity(5,"熟练",600), + new LevelEntity(6,"高手",1000), + new LevelEntity(7,"老手",1500), + new LevelEntity(8,"大佬",2000), + new LevelEntity(9,"巨佬",2500), + new LevelEntity(10,"大神",3000), + }; + + return entities; + } + } +} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/Repositories/ArticleRepository.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/Repositories/ArticleRepository.cs index 1b0a200c..84d6fe22 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/Repositories/ArticleRepository.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/Repositories/ArticleRepository.cs @@ -1,6 +1,6 @@ using System.Linq.Expressions; using Volo.Abp.DependencyInjection; -using Yi.Framework.Bbs.Domain.Entities; +using Yi.Framework.Bbs.Domain.Entities.Forum; using Yi.Framework.Bbs.Domain.Repositories; using Yi.Framework.SqlSugarCore.Abstractions; using Yi.Framework.SqlSugarCore.Repositories; diff --git a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application.Contracts/Dtos/FileManager/FileGetListOutputDto.cs b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application.Contracts/Dtos/FileManager/FileGetListOutputDto.cs index 26bdd8f3..fb337352 100644 --- a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application.Contracts/Dtos/FileManager/FileGetListOutputDto.cs +++ b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application.Contracts/Dtos/FileManager/FileGetListOutputDto.cs @@ -5,9 +5,9 @@ using System.Text; using System.Threading.Tasks; using Volo.Abp.Application.Dtos; -namespace Yi.Framework.Rbac.Application.FileManger +namespace Yi.Framework.Rbac.Application.Contracts.Dtos.FileManager { - public class FileGetListOutputDto:EntityDto + public class FileGetListOutputDto : EntityDto { } } diff --git a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application.Contracts/IServices/IFileService.cs b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application.Contracts/IServices/IFileService.cs index 9653c305..d9fdc6c5 100644 --- a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application.Contracts/IServices/IFileService.cs +++ b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application.Contracts/IServices/IFileService.cs @@ -1,6 +1,6 @@ using Microsoft.AspNetCore.Http; using Volo.Abp.Application.Services; -using Yi.Framework.Rbac.Application.FileManger; +using Yi.Framework.Rbac.Application.Contracts.Dtos.FileManager; namespace Yi.Framework.Rbac.Application.Contracts.IServices { diff --git a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/FileService.cs b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/FileService.cs index f98dab39..20a5c211 100644 --- a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/FileService.cs +++ b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/FileService.cs @@ -12,8 +12,8 @@ using Volo.Abp.Domain.Repositories; using Volo.Abp.Guids; using Yi.Framework.Core.Enums; using Yi.Framework.Core.Helper; +using Yi.Framework.Rbac.Application.Contracts.Dtos.FileManager; using Yi.Framework.Rbac.Application.Contracts.IServices; -using Yi.Framework.Rbac.Application.FileManger; using Yi.Framework.Rbac.Domain.Entities; namespace Yi.Framework.Rbac.Application.Services diff --git a/Yi.Abp.Net8/sample/Acme.BookStore.Application/Jobs/TestJob.cs b/Yi.Abp.Net8/sample/Acme.BookStore.Application/Jobs/TestJob.cs index f02f823b..69897d8d 100644 --- a/Yi.Abp.Net8/sample/Acme.BookStore.Application/Jobs/TestJob.cs +++ b/Yi.Abp.Net8/sample/Acme.BookStore.Application/Jobs/TestJob.cs @@ -6,7 +6,7 @@ using Volo.Abp.Uow; using Yi.Framework.Rbac.Domain.Entities; using Yi.Framework.SqlSugarCore.Abstractions; -namespace Yi.Framework.Rbac.Application.Jobs +namespace Acme.BookStore.Application.Jobs { /// /// 定时任务 diff --git a/Yi.Abp.Net8/src/Yi.Abp.Application/Jobs/TestJob.cs b/Yi.Abp.Net8/src/Yi.Abp.Application/Jobs/TestJob.cs index f02f823b..441ba506 100644 --- a/Yi.Abp.Net8/src/Yi.Abp.Application/Jobs/TestJob.cs +++ b/Yi.Abp.Net8/src/Yi.Abp.Application/Jobs/TestJob.cs @@ -6,7 +6,7 @@ using Volo.Abp.Uow; using Yi.Framework.Rbac.Domain.Entities; using Yi.Framework.SqlSugarCore.Abstractions; -namespace Yi.Framework.Rbac.Application.Jobs +namespace Yi.Abp.Application.Jobs { /// /// 定时任务