refactor: 批量新增枚举类型并完成实体、DTO、服务层枚举替换
- 新增30+业务枚举类型覆盖用户、宠物、商城、社区、积分等模块 - 完成实体类、DTO、服务层的字符串枚举替换为强类型枚举 - 修复用户状态枚举名称变更,将Frozen改为Disabled - 新增批量发布社区消息接口与控制器实现 - 新增操作日志、积分管理、补偿任务相关服务与DTO
This commit is contained in:
@ -41,4 +41,10 @@ public interface ICommunityMessageService : IBaseService<CommunityMessage>
|
||||
/// 设置排序权重
|
||||
/// </summary>
|
||||
Task SetSortOrderAsync(long id, int sortOrder);
|
||||
|
||||
/// <summary>
|
||||
/// 批量发布消息(IsActive false => true)
|
||||
/// </summary>
|
||||
/// <param name="ids">消息ID列表</param>
|
||||
Task BatchPublishAsync(List<long> ids);
|
||||
}
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
using QYZH.InteractiveMagazine.Models.Dto;
|
||||
using QYZH.InteractiveMagazine.Models.Dto.Compensation;
|
||||
using QYZH.InteractiveMagazine.Models.Entity;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.IService;
|
||||
|
||||
/// <summary>
|
||||
/// 补偿任务管理服务接口
|
||||
/// </summary>
|
||||
public interface ICompensationManageService : IBaseService<CompensationTask>
|
||||
{
|
||||
/// <summary>
|
||||
/// 分页查询补偿任务
|
||||
/// </summary>
|
||||
/// <param name="input">查询参数</param>
|
||||
/// <returns>分页结果</returns>
|
||||
Task<PageListModel<CompensationManageOutput>> GetListAsync(CompensationTaskQueryInput input);
|
||||
|
||||
/// <summary>
|
||||
/// 手动重试补偿任务(将状态改为 Pending,重置 RetryCount)
|
||||
/// </summary>
|
||||
/// <param name="taskId">任务Id</param>
|
||||
/// <param name="operatorId">操作人Id</param>
|
||||
/// <param name="operatorName">操作人用户名</param>
|
||||
/// <param name="input">重试参数</param>
|
||||
/// <param name="ipAddress">IP地址</param>
|
||||
Task RetryAsync(long taskId, long operatorId, string operatorName, CompensationRetryInput input, string? ipAddress = null);
|
||||
|
||||
/// <summary>
|
||||
/// 标记补偿任务为已解决
|
||||
/// </summary>
|
||||
/// <param name="taskId">任务Id</param>
|
||||
/// <param name="operatorId">操作人Id</param>
|
||||
/// <param name="operatorName">操作人用户名</param>
|
||||
/// <param name="input">解决参数</param>
|
||||
/// <param name="ipAddress">IP地址</param>
|
||||
Task ResolveAsync(long taskId, long operatorId, string operatorName, CompensationResolveInput input, string? ipAddress = null);
|
||||
|
||||
/// <summary>
|
||||
/// 获取补偿任务详情
|
||||
/// </summary>
|
||||
/// <param name="taskId">任务Id</param>
|
||||
/// <returns>任务详情</returns>
|
||||
Task<CompensationManageDetailOutput> GetDetailAsync(long taskId);
|
||||
}
|
||||
37
QYZH.InteractiveMagazine.IService/IOperationLogService.cs
Normal file
37
QYZH.InteractiveMagazine.IService/IOperationLogService.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using QYZH.InteractiveMagazine.Models.Dto;
|
||||
using QYZH.InteractiveMagazine.Models.Entity;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.IService;
|
||||
|
||||
/// <summary>
|
||||
/// 操作日志服务接口
|
||||
/// </summary>
|
||||
public interface IOperationLogService : IBaseService<OperationLog>
|
||||
{
|
||||
/// <summary>
|
||||
/// 记录操作日志
|
||||
/// </summary>
|
||||
/// <param name="operatorId">操作人Id</param>
|
||||
/// <param name="operatorName">操作人用户名</param>
|
||||
/// <param name="actionType">操作类型(使用 OperationLogActionType 常量)</param>
|
||||
/// <param name="targetType">目标类型(使用 OperationLogTargetType 常量)</param>
|
||||
/// <param name="targetId">目标记录Id</param>
|
||||
/// <param name="targetName">目标名称</param>
|
||||
/// <param name="detail">操作详情(可选,JSON格式)</param>
|
||||
/// <param name="ipAddress">IP地址(可选)</param>
|
||||
Task LogAsync(long operatorId, string operatorName, string actionType, string targetType, long targetId, string? targetName = null, string? detail = null, string? ipAddress = null);
|
||||
|
||||
/// <summary>
|
||||
/// 分页查询操作日志
|
||||
/// </summary>
|
||||
/// <param name="input">查询参数</param>
|
||||
/// <returns>分页结果</returns>
|
||||
Task<PageListModel<OperationLogOutput>> GetListAsync(OperationLogQueryInput input);
|
||||
|
||||
/// <summary>
|
||||
/// 获取操作日志详情
|
||||
/// </summary>
|
||||
/// <param name="id">日志Id</param>
|
||||
/// <returns>日志详情</returns>
|
||||
Task<OperationLogDetailOutput> GetDetailAsync(long id);
|
||||
}
|
||||
@ -44,4 +44,112 @@ public interface IPetService : IBaseService<UserPet>
|
||||
/// <param name="petId">宠物Id</param>
|
||||
/// <returns>喂养记录列表</returns>
|
||||
Task<PageListModel<FeedingRecordOutput>> GetFeedingRecordsAsync(long userId, long petId, PageQueryModel pageQuery);
|
||||
|
||||
// ==================== 后台管理:宠物模板 ====================
|
||||
|
||||
/// <summary>
|
||||
/// 创建宠物模板
|
||||
/// </summary>
|
||||
Task<PetTemplateOutput> CreateTemplateAsync(PetTemplateInput input);
|
||||
|
||||
/// <summary>
|
||||
/// 更新宠物模板
|
||||
/// </summary>
|
||||
Task<PetTemplateOutput> UpdateTemplateAsync(long id, PetTemplateInput input);
|
||||
|
||||
/// <summary>
|
||||
/// 删除宠物模板(软删除)
|
||||
/// </summary>
|
||||
Task DeleteTemplateAsync(long id);
|
||||
|
||||
/// <summary>
|
||||
/// 获取单个宠物模板
|
||||
/// </summary>
|
||||
Task<PetTemplateOutput> GetTemplateByIdAsync(long id);
|
||||
|
||||
/// <summary>
|
||||
/// 分页查询宠物模板列表
|
||||
/// </summary>
|
||||
Task<PageListModel<PetTemplateOutput>> GetTemplatesAsync(PetTemplateQueryInput input);
|
||||
|
||||
/// <summary>
|
||||
/// 更新模板状态(启用/禁用)
|
||||
/// </summary>
|
||||
Task UpdateTemplateStatusAsync(long id, string status);
|
||||
|
||||
// ==================== 后台管理:进化链 ====================
|
||||
|
||||
/// <summary>
|
||||
/// 创建进化阶段
|
||||
/// </summary>
|
||||
Task<PetEvolutionOutput> CreateEvolutionAsync(PetEvolutionInput input);
|
||||
|
||||
/// <summary>
|
||||
/// 更新进化阶段
|
||||
/// </summary>
|
||||
Task<PetEvolutionOutput> UpdateEvolutionAsync(long id, PetEvolutionInput input);
|
||||
|
||||
/// <summary>
|
||||
/// 删除进化阶段(软删除)
|
||||
/// </summary>
|
||||
Task DeleteEvolutionAsync(long id);
|
||||
|
||||
/// <summary>
|
||||
/// 获取单个进化阶段
|
||||
/// </summary>
|
||||
Task<PetEvolutionOutput> GetEvolutionByIdAsync(long id);
|
||||
|
||||
/// <summary>
|
||||
/// 分页查询进化阶段列表
|
||||
/// </summary>
|
||||
Task<PageListModel<PetEvolutionOutput>> GetEvolutionsAsync(PetEvolutionQueryInput input);
|
||||
|
||||
// ==================== 后台管理:皮肤 ====================
|
||||
|
||||
/// <summary>
|
||||
/// 创建皮肤
|
||||
/// </summary>
|
||||
Task<PetSkinOutput> CreateSkinAsync(PetSkinInput input);
|
||||
|
||||
/// <summary>
|
||||
/// 更新皮肤
|
||||
/// </summary>
|
||||
Task<PetSkinOutput> UpdateSkinAsync(long id, PetSkinInput input);
|
||||
|
||||
/// <summary>
|
||||
/// 删除皮肤(软删除)
|
||||
/// </summary>
|
||||
Task DeleteSkinAsync(long id);
|
||||
|
||||
/// <summary>
|
||||
/// 获取单个皮肤(含图片列表)
|
||||
/// </summary>
|
||||
Task<PetSkinOutput> GetSkinByIdAsync(long id);
|
||||
|
||||
/// <summary>
|
||||
/// 分页查询皮肤列表
|
||||
/// </summary>
|
||||
Task<PageListModel<PetSkinOutput>> GetSkinsAsync(PetSkinQueryInput input);
|
||||
|
||||
// ==================== 后台管理:皮肤图片 ====================
|
||||
|
||||
/// <summary>
|
||||
/// 创建皮肤图片
|
||||
/// </summary>
|
||||
Task<PetSkinImageOutput> CreateSkinImageAsync(PetSkinImageInput input);
|
||||
|
||||
/// <summary>
|
||||
/// 更新皮肤图片
|
||||
/// </summary>
|
||||
Task<PetSkinImageOutput> UpdateSkinImageAsync(long id, PetSkinImageInput input);
|
||||
|
||||
/// <summary>
|
||||
/// 删除皮肤图片(软删除)
|
||||
/// </summary>
|
||||
Task DeleteSkinImageAsync(long id);
|
||||
|
||||
/// <summary>
|
||||
/// 获取指定皮肤的所有图片
|
||||
/// </summary>
|
||||
Task<List<PetSkinImageOutput>> GetSkinImagesBySkinIdAsync(long skinId);
|
||||
}
|
||||
|
||||
66
QYZH.InteractiveMagazine.IService/IPointsService.cs
Normal file
66
QYZH.InteractiveMagazine.IService/IPointsService.cs
Normal file
@ -0,0 +1,66 @@
|
||||
using QYZH.InteractiveMagazine.Models.Dto;
|
||||
using QYZH.InteractiveMagazine.Models.Dto.Points;
|
||||
using QYZH.InteractiveMagazine.Models.Entity;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.IService;
|
||||
|
||||
/// <summary>
|
||||
/// 积分服务接口
|
||||
/// </summary>
|
||||
public interface IPointsService : IBaseService<PointsRecord>
|
||||
{
|
||||
// ==================== 带事务版本(独立调用) ====================
|
||||
|
||||
/// <summary>
|
||||
/// 增加积分(带事务)
|
||||
/// </summary>
|
||||
/// <param name="input">增加积分参数</param>
|
||||
/// <returns>增加结果</returns>
|
||||
Task<AddPointsOutput> AddPointsAsync(AddPointsInput input);
|
||||
|
||||
/// <summary>
|
||||
/// 扣除积分(带事务,含余额不足校验)
|
||||
/// </summary>
|
||||
/// <param name="input">扣除积分参数</param>
|
||||
/// <returns>扣除结果</returns>
|
||||
Task<DeductPointsOutput> DeductPointsAsync(DeductPointsInput input);
|
||||
|
||||
// ==================== 无事务版本(供外部事务调用) ====================
|
||||
|
||||
/// <summary>
|
||||
/// 增加积分(无事务,需在外部事务中调用)
|
||||
/// </summary>
|
||||
/// <param name="input">增加积分参数</param>
|
||||
/// <returns>增加结果</returns>
|
||||
Task<AddPointsOutput> AddPointsInTranAsync(AddPointsInput input);
|
||||
|
||||
/// <summary>
|
||||
/// 扣除积分(无事务,需在外部事务中调用,含余额不足校验)
|
||||
/// </summary>
|
||||
/// <param name="input">扣除积分参数</param>
|
||||
/// <returns>扣除结果</returns>
|
||||
Task<DeductPointsOutput> DeductPointsInTranAsync(DeductPointsInput input);
|
||||
|
||||
// ==================== 查询 ====================
|
||||
|
||||
/// <summary>
|
||||
/// 查询用户当前积分余额
|
||||
/// </summary>
|
||||
/// <param name="userId">用户Id</param>
|
||||
/// <returns>当前积分余额</returns>
|
||||
Task<int> GetUserPointsAsync(long userId);
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户积分概览(当前余额 + 累计收入 + 累计支出)
|
||||
/// </summary>
|
||||
/// <param name="userId">用户Id</param>
|
||||
/// <returns>积分概览</returns>
|
||||
Task<PointsSummaryOutput> GetPointsSummaryAsync(long userId);
|
||||
|
||||
/// <summary>
|
||||
/// 分页查询积分流水
|
||||
/// </summary>
|
||||
/// <param name="input">查询参数</param>
|
||||
/// <returns>分页流水列表</returns>
|
||||
Task<PageListModel<PointsRecordOutput>> GetPointsRecordsAsync(PointsRecordQueryInput input);
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
|
||||
using QYZH.InteractiveMagazine.Models.Dto;
|
||||
using QYZH.InteractiveMagazine.Models.Dto.Points;
|
||||
using QYZH.InteractiveMagazine.Models.Entity;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.IService;
|
||||
@ -12,12 +12,22 @@ public interface IUsersService : IBaseService<Users>
|
||||
Task<BaseResponse<PageListModel<UsersOutput>>> GetListAsync(UsersQueryInput input);
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户详情
|
||||
/// 获取用户详情(包含积分记录、签到记录、补偿任务、期刊列表)
|
||||
/// </summary>
|
||||
Task<BaseResponse<UsersOutput>> GetDetailAsync(long id);
|
||||
Task<BaseResponse<UserDetailOutput>> GetDetailAsync(long id);
|
||||
|
||||
/// <summary>
|
||||
/// 更新用户状态
|
||||
/// </summary>
|
||||
Task<BaseResponse> UpdateStatusAsync(long id, UpdateUserStatusInput input);
|
||||
|
||||
/// <summary>
|
||||
/// 手动增加用户积分
|
||||
/// </summary>
|
||||
Task<ManualPointsOutput> ManualAddPointsAsync(long userId, ManualAddPointsInput input, long operatorId, string operatorName, string? ipAddress = null);
|
||||
|
||||
/// <summary>
|
||||
/// 手动扣除用户积分
|
||||
/// </summary>
|
||||
Task<ManualPointsOutput> ManualDeductPointsAsync(long userId, ManualDeductPointsInput input, long operatorId, string operatorName, string? ipAddress = null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user