refactor: 完善枚举系统与状态类型转换,新增枚举管理接口
1. 为所有枚举添加Description特性用于中文描述 2. 移除实体类中冗余的状态字段注释与定义 3. 将所有枚举状态参数改为int类型转换,统一数据交互格式 4. 新增系统管理枚举查询接口与实现,支持获取所有枚举元数据 5. 调整宠物服务模板状态更新接口参数类型
This commit is contained in:
@ -75,7 +75,7 @@ public interface IPetService : IBaseService<UserPet>
|
||||
/// <summary>
|
||||
/// 更新模板状态(启用/禁用)
|
||||
/// </summary>
|
||||
Task UpdateTemplateStatusAsync(long id, string status);
|
||||
Task UpdateTemplateStatusAsync(long id, int status);
|
||||
|
||||
// ==================== 后台管理:进化链 ====================
|
||||
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
using QYZH.InteractiveMagazine.Models.Dto.SystemManagement;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.IService;
|
||||
|
||||
/// <summary>
|
||||
/// 系统管理服务接口
|
||||
/// </summary>
|
||||
public interface ISystemManagementService
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取所有枚举信息
|
||||
/// </summary>
|
||||
/// <returns>枚举信息列表</returns>
|
||||
Task<List<EnumInfoOutput>> GetAllEnumsAsync();
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Dto.SystemManagement;
|
||||
|
||||
/// <summary>
|
||||
/// 枚举信息输出
|
||||
/// </summary>
|
||||
public class EnumInfoOutput
|
||||
{
|
||||
/// <summary>
|
||||
/// 枚举名称
|
||||
/// </summary>
|
||||
public string EnumName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 枚举项列表
|
||||
/// </summary>
|
||||
public List<EnumItemDto> Items { get; set; } = new();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 枚举项
|
||||
/// </summary>
|
||||
public class EnumItemDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 枚举项名称
|
||||
/// </summary>
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 枚举项值
|
||||
/// </summary>
|
||||
public int Value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 描述
|
||||
/// </summary>
|
||||
public string? Description { get; set; }
|
||||
}
|
||||
@ -42,12 +42,5 @@ namespace QYZH.InteractiveMagazine.Models.Entity
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public CheckInConfigTypeEnum Type {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:状态: Active, Inactive
|
||||
/// Default:Active
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public CheckInConfigStatusEnum Status {get;set;}
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,12 +41,5 @@ namespace QYZH.InteractiveMagazine.Models.Entity
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public CommunityMessageCommentTypeEnum Type {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:状态: Published, Hidden
|
||||
/// Default:Published
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public CommunityMessageCommentStatusEnum Status {get;set;}
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,12 +35,5 @@ namespace QYZH.InteractiveMagazine.Models.Entity
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public CommunityTemplateSentenceTypeEnum Type {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:状态: Active, Inactive
|
||||
/// Default:Active
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public CommunityTemplateSentenceStatusEnum Status {get;set;}
|
||||
}
|
||||
}
|
||||
|
||||
@ -78,12 +78,6 @@ namespace QYZH.InteractiveMagazine.Models.Entity
|
||||
/// </summary>
|
||||
public int MaxRetries { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:处理状态 Pending / Processing / Success / Failed / Cancelled
|
||||
/// Default:Pending
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public CompensationTaskStatusEnum Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:最后处理时间
|
||||
|
||||
@ -94,12 +94,6 @@ namespace QYZH.InteractiveMagazine.Models.Entity
|
||||
/// </summary>
|
||||
public int TotalUse {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:Pending / Processing / Success / Failed / Cancelled
|
||||
/// Default:Pending
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public DotFileStatusEnum Status {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:
|
||||
|
||||
@ -59,12 +59,6 @@ namespace QYZH.InteractiveMagazine.Models.Entity
|
||||
/// </summary>
|
||||
public int Revision {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:Pending / Processing / Success / Failed / Cancelled
|
||||
/// Default:Pending
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public DotFileDetailStatusEnum Status {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:
|
||||
|
||||
@ -60,11 +60,5 @@ namespace QYZH.InteractiveMagazine.Models.Entity
|
||||
/// </summary>
|
||||
public int Quantity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:状态: Success, Refunded
|
||||
/// Default:Success
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public ExchangeRecordStatusEnum Status { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,12 +82,5 @@ namespace QYZH.InteractiveMagazine.Models.Entity
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public JournalTypeEnum Type {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:状态: Draft, Published, Archived
|
||||
/// Default:Draft
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public JournalStatusEnum Status {get;set;}
|
||||
}
|
||||
}
|
||||
|
||||
@ -51,13 +51,6 @@ namespace QYZH.InteractiveMagazine.Models.Entity
|
||||
/// </summary>
|
||||
public int PageNum {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:校验状态(0-未校验 1校验成功 -1校验失败)
|
||||
/// Default:
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public int Status {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:页图片
|
||||
/// Default:
|
||||
|
||||
@ -80,12 +80,5 @@ namespace QYZH.InteractiveMagazine.Models.Entity
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public PetEvolutionTypeEnum Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:状态: Active, Inactive
|
||||
/// Default:Active
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public PetEvolutionStatusEnum Status { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,11 +63,5 @@ namespace QYZH.InteractiveMagazine.Models.Entity
|
||||
/// </summary>
|
||||
public PetFeedingRecordTypeEnum Type {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:状态
|
||||
/// Default:Success
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public PetFeedingRecordStatusEnum Status {get;set;}
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,11 +53,5 @@ namespace QYZH.InteractiveMagazine.Models.Entity
|
||||
/// </summary>
|
||||
public PetTemplateTypeEnum Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:状态: Active, Inactive
|
||||
/// Default:Active
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public PetTemplateStatusEnum Status { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,11 +63,5 @@ namespace QYZH.InteractiveMagazine.Models.Entity
|
||||
/// </summary>
|
||||
public PointsFlowTypeEnum Type {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:状态: Success, Failed, Pending
|
||||
/// Default:Success
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public PointsRecordStatusEnum Status {get;set;}
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,11 +55,5 @@ namespace QYZH.InteractiveMagazine.Models.Entity
|
||||
/// </summary>
|
||||
public UserBagTypeEnum Type {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:状态: Available, Expired
|
||||
/// Default:Available
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public UserBagStatusEnum Status {get;set;}
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,12 +38,5 @@ namespace QYZH.InteractiveMagazine.Models.Entity
|
||||
[SugarColumn(ColumnName = "Type")]
|
||||
public UserJournalTypeEnum Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:状态: Active(正常), Inactive(失效)
|
||||
/// Default:Active
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "Status")]
|
||||
public UserJournalStatusEnum Status { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,12 +40,5 @@ namespace QYZH.InteractiveMagazine.Models.Entity
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public UserMedalTypeEnum Type {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:状态: Awarded, Revoked
|
||||
/// Default:Awarded
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public UserMedalStatusEnum Status {get;set;}
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,13 +70,6 @@ namespace QYZH.InteractiveMagazine.Models.Entity
|
||||
/// </summary>
|
||||
public UserPetTypeEnum Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:状态: Inactive, Active, Sleeping
|
||||
/// Default:Inactive
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public UserPetStatusEnum Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 理解力
|
||||
/// </summary>
|
||||
|
||||
@ -41,13 +41,6 @@ namespace QYZH.InteractiveMagazine.Models.Entity
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public UsersTypeEnum Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:状态: Active, Disabled
|
||||
/// Default:Active
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public UserStatusEnum Status { get; set; }
|
||||
/// <summary>
|
||||
/// Desc:微信OpenId
|
||||
/// Default:
|
||||
|
||||
22
QYZH.InteractiveMagazine.Models/Enum/AdminUserStatusEnum.cs
Normal file
22
QYZH.InteractiveMagazine.Models/Enum/AdminUserStatusEnum.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum
|
||||
{
|
||||
/// <summary>
|
||||
/// 管理员状态枚举
|
||||
/// </summary>
|
||||
public enum AdminUserStatusEnum
|
||||
{
|
||||
/// <summary>
|
||||
/// 未激活
|
||||
/// </summary>
|
||||
[Description("未激活")]
|
||||
Inactive = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 激活
|
||||
/// </summary>
|
||||
[Description("激活")]
|
||||
Active = 1
|
||||
}
|
||||
}
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,13 +10,16 @@ public enum AdminUserTypeEnum
|
||||
/// <summary>
|
||||
/// 编辑员
|
||||
/// </summary>
|
||||
[Description("编辑员")]
|
||||
Editor = 2,
|
||||
/// <summary>
|
||||
/// 超级管理员
|
||||
/// </summary>
|
||||
[Description("超级管理员")]
|
||||
SuperAdmin = 0,
|
||||
/// <summary>
|
||||
/// 超级管理员
|
||||
/// 管理员
|
||||
/// </summary>
|
||||
[Description("管理员")]
|
||||
Admin = 1
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,10 +10,12 @@ public enum CheckInConfigStatusEnum
|
||||
/// <summary>
|
||||
/// 未激活
|
||||
/// </summary>
|
||||
[Description("未激活")]
|
||||
Inactive = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 激活
|
||||
/// </summary>
|
||||
[Description("激活")]
|
||||
Active = 1
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,9 +10,11 @@ public enum CheckInConfigTypeEnum
|
||||
/// <summary>
|
||||
/// 每日签到
|
||||
/// </summary>
|
||||
[Description("每日签到")]
|
||||
Daily = 1,
|
||||
/// <summary>
|
||||
/// 连续签到
|
||||
/// </summary>
|
||||
[Description("连续签到")]
|
||||
Streak = 2
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,5 +10,11 @@ public enum CheckInRecordStatusEnum
|
||||
/// <summary>
|
||||
/// 成功
|
||||
/// </summary>
|
||||
Success = 1
|
||||
[Description("成功")]
|
||||
Success = 1,
|
||||
/// <summary>
|
||||
/// 失败
|
||||
/// </summary>
|
||||
[Description("失败")]
|
||||
Fail = 1
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,9 +10,11 @@ public enum CheckInRecordTypeEnum
|
||||
/// <summary>
|
||||
/// 正常签到
|
||||
/// </summary>
|
||||
[Description("正常签到")]
|
||||
Normal = 1,
|
||||
/// <summary>
|
||||
/// 补签
|
||||
/// </summary>
|
||||
[Description("补签")]
|
||||
MakeUp = 2
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,10 +10,12 @@ public enum CommunityMessageCommentStatusEnum
|
||||
/// <summary>
|
||||
/// 已隐藏
|
||||
/// </summary>
|
||||
[Description("已隐藏")]
|
||||
Hidden = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 已发布
|
||||
/// </summary>
|
||||
[Description("已发布")]
|
||||
Published = 1
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,5 +10,6 @@ public enum CommunityMessageCommentTypeEnum
|
||||
/// <summary>
|
||||
/// 模板评论
|
||||
/// </summary>
|
||||
[Description("模板评论")]
|
||||
TemplateComment = 1
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,5 +10,6 @@ public enum CommunityMessageLikeTypeEnum
|
||||
/// <summary>
|
||||
/// 点赞
|
||||
/// </summary>
|
||||
[Description("点赞")]
|
||||
Like = 1
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,10 +10,12 @@ public enum CommunityTemplateSentenceStatusEnum
|
||||
/// <summary>
|
||||
/// 未激活
|
||||
/// </summary>
|
||||
[Description("未激活")]
|
||||
Inactive = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 激活
|
||||
/// </summary>
|
||||
[Description("激活")]
|
||||
Active = 1
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,13 +10,16 @@ public enum CommunityTemplateSentenceTypeEnum
|
||||
/// <summary>
|
||||
/// 正面
|
||||
/// </summary>
|
||||
[Description("正面")]
|
||||
Positive = 1,
|
||||
/// <summary>
|
||||
/// 中性
|
||||
/// </summary>
|
||||
[Description("中性")]
|
||||
Neutral = 2,
|
||||
/// <summary>
|
||||
/// 负面
|
||||
/// </summary>
|
||||
[Description("负面")]
|
||||
Negative = 3
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,25 +10,30 @@ public enum CompensationTaskStatusEnum
|
||||
/// <summary>
|
||||
/// 待处理
|
||||
/// </summary>
|
||||
[Description("待处理")]
|
||||
Pending = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 处理中
|
||||
/// </summary>
|
||||
[Description("处理中")]
|
||||
Processing = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 成功
|
||||
/// </summary>
|
||||
[Description("成功")]
|
||||
Success = 2,
|
||||
|
||||
/// <summary>
|
||||
/// 失败
|
||||
/// </summary>
|
||||
[Description("失败")]
|
||||
Failed = 3,
|
||||
|
||||
/// <summary>
|
||||
/// 已取消
|
||||
/// </summary>
|
||||
[Description("已取消")]
|
||||
Cancelled = 4
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,17 +10,21 @@ public enum CompensationTaskTypeEnum
|
||||
/// <summary>
|
||||
/// 宠物喂养补偿
|
||||
/// </summary>
|
||||
[Description("宠物喂养补偿")]
|
||||
PetFeeding = 1,
|
||||
/// <summary>
|
||||
/// 用户积分补偿
|
||||
/// </summary>
|
||||
[Description("用户积分补偿")]
|
||||
UserPoints = 2,
|
||||
/// <summary>
|
||||
/// 用户成长值补偿
|
||||
/// </summary>
|
||||
[Description("用户成长值补偿")]
|
||||
UserGrowth = 3,
|
||||
/// <summary>
|
||||
/// 发送通知补偿
|
||||
/// </summary>
|
||||
[Description("发送通知补偿")]
|
||||
SendNotification = 4
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,25 +10,30 @@ public enum DotFileDetailStatusEnum
|
||||
/// <summary>
|
||||
/// 待处理
|
||||
/// </summary>
|
||||
[Description("待处理")]
|
||||
Pending = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 处理中
|
||||
/// </summary>
|
||||
[Description("处理中")]
|
||||
Processing = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 成功
|
||||
/// </summary>
|
||||
[Description("成功")]
|
||||
Success = 2,
|
||||
|
||||
/// <summary>
|
||||
/// 失败
|
||||
/// </summary>
|
||||
[Description("失败")]
|
||||
Failed = 3,
|
||||
|
||||
/// <summary>
|
||||
/// 已取消
|
||||
/// </summary>
|
||||
[Description("已取消")]
|
||||
Cancelled = 4
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,25 +10,30 @@ public enum DotFileStatusEnum
|
||||
/// <summary>
|
||||
/// 待处理
|
||||
/// </summary>
|
||||
[Description("待处理")]
|
||||
Pending = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 处理中
|
||||
/// </summary>
|
||||
[Description("处理中")]
|
||||
Processing = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 成功
|
||||
/// </summary>
|
||||
[Description("成功")]
|
||||
Success = 2,
|
||||
|
||||
/// <summary>
|
||||
/// 失败
|
||||
/// </summary>
|
||||
[Description("失败")]
|
||||
Failed = 3,
|
||||
|
||||
/// <summary>
|
||||
/// 已取消
|
||||
/// </summary>
|
||||
[Description("已取消")]
|
||||
Cancelled = 4
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,10 +10,12 @@ public enum ExchangeRecordStatusEnum
|
||||
/// <summary>
|
||||
/// 成功
|
||||
/// </summary>
|
||||
[Description("成功")]
|
||||
Success = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 已退还
|
||||
/// </summary>
|
||||
[Description("已退还")]
|
||||
Refunded = 2
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,9 +10,11 @@ public enum JournalCatalogTypeEnum
|
||||
/// <summary>
|
||||
/// 单元
|
||||
/// </summary>
|
||||
[Description("单元")]
|
||||
Unit = 0,
|
||||
/// <summary>
|
||||
/// 页面
|
||||
/// </summary>
|
||||
[Description("页面")]
|
||||
Page = 1
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,15 +10,18 @@ public enum JournalPageStatusEnum
|
||||
/// <summary>
|
||||
/// 验证失败
|
||||
/// </summary>
|
||||
[Description("验证失败")]
|
||||
Failed = -1,
|
||||
|
||||
/// <summary>
|
||||
/// 未验证
|
||||
/// </summary>
|
||||
[Description("未验证")]
|
||||
NotVerified = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 验证成功
|
||||
/// </summary>
|
||||
[Description("验证成功")]
|
||||
Success = 1
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,17 +10,21 @@ public enum JournalPageTaskTypeEnum
|
||||
/// <summary>
|
||||
/// 单选题
|
||||
/// </summary>
|
||||
[Description("单选题")]
|
||||
SingleChoice = 1,
|
||||
/// <summary>
|
||||
/// 多选题
|
||||
/// </summary>
|
||||
[Description("多选题")]
|
||||
MultipleChoice = 2,
|
||||
/// <summary>
|
||||
/// 填空题
|
||||
/// </summary>
|
||||
[Description("填空题")]
|
||||
FillInBlank = 3,
|
||||
/// <summary>
|
||||
/// 问答题
|
||||
/// </summary>
|
||||
[Description("问答题")]
|
||||
QuestionAnswer = 4
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,15 +10,18 @@ public enum JournalStatusEnum
|
||||
/// <summary>
|
||||
/// 草稿
|
||||
/// </summary>
|
||||
[Description("草稿")]
|
||||
Draft = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 已发布
|
||||
/// </summary>
|
||||
[Description("已发布")]
|
||||
Published = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 已归档
|
||||
/// </summary>
|
||||
[Description("已归档")]
|
||||
Archived = 2
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,9 +10,11 @@ public enum JournalTypeEnum
|
||||
/// <summary>
|
||||
/// 普通
|
||||
/// </summary>
|
||||
[Description("普通")]
|
||||
Normal = 1,
|
||||
/// <summary>
|
||||
/// 特刊
|
||||
/// </summary>
|
||||
[Description("特刊")]
|
||||
Special = 2
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,9 +10,11 @@ public enum MedalTypeEnum
|
||||
/// <summary>
|
||||
/// 宠物勋章
|
||||
/// </summary>
|
||||
[Description("宠物勋章")]
|
||||
Pet = 1,
|
||||
/// <summary>
|
||||
/// 社区勋章
|
||||
/// </summary>
|
||||
[Description("社区勋章")]
|
||||
Community = 2
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,15 +10,18 @@ public enum MessageStatusEnum
|
||||
/// <summary>
|
||||
/// 审核中
|
||||
/// </summary>
|
||||
[Description("审核中")]
|
||||
PendingReview = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 已通过
|
||||
/// </summary>
|
||||
[Description("已通过")]
|
||||
Approved = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 已冻结
|
||||
/// </summary>
|
||||
[Description("已冻结")]
|
||||
Frozen = 2
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,15 +10,18 @@ public enum MessageTypeEnum
|
||||
/// <summary>
|
||||
/// 文章
|
||||
/// </summary>
|
||||
[Description("文章")]
|
||||
Article = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 引用
|
||||
/// </summary>
|
||||
[Description("引用")]
|
||||
Quote = 2,
|
||||
|
||||
/// <summary>
|
||||
/// 公告
|
||||
/// </summary>
|
||||
[Description("公告")]
|
||||
Announcement = 3
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,10 +10,12 @@ public enum PetEvolutionStatusEnum
|
||||
/// <summary>
|
||||
/// 未激活
|
||||
/// </summary>
|
||||
[Description("未激活")]
|
||||
Inactive = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 激活
|
||||
/// </summary>
|
||||
[Description("激活")]
|
||||
Active = 1
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,9 +10,11 @@ public enum PetEvolutionTypeEnum
|
||||
/// <summary>
|
||||
/// 普通进化
|
||||
/// </summary>
|
||||
[Description("普通进化")]
|
||||
Normal = 1,
|
||||
/// <summary>
|
||||
/// 特殊进化
|
||||
/// </summary>
|
||||
[Description("特殊进化")]
|
||||
Special = 2
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,5 +10,11 @@ public enum PetFeedingRecordStatusEnum
|
||||
/// <summary>
|
||||
/// 成功
|
||||
/// </summary>
|
||||
Success = 1
|
||||
[Description("成功")]
|
||||
Success = 1,
|
||||
/// <summary>
|
||||
/// 失败
|
||||
/// </summary>
|
||||
[Description("失败")]
|
||||
Fail = 1
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,9 +10,11 @@ public enum PetFeedingRecordTypeEnum
|
||||
/// <summary>
|
||||
/// 普通喂养
|
||||
/// </summary>
|
||||
[Description("普通喂养")]
|
||||
Normal = 1,
|
||||
/// <summary>
|
||||
/// 特殊喂养
|
||||
/// </summary>
|
||||
[Description("特殊喂养")]
|
||||
Special = 2
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,9 +10,11 @@ public enum PetSkinImageTypeEnum
|
||||
/// <summary>
|
||||
/// 普通图片
|
||||
/// </summary>
|
||||
[Description("普通图片")]
|
||||
Normal = 1,
|
||||
/// <summary>
|
||||
/// 特殊图片
|
||||
/// </summary>
|
||||
[Description("特殊图片")]
|
||||
Special = 2
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,13 +10,16 @@ public enum PetSkinTypeEnum
|
||||
/// <summary>
|
||||
/// 普通皮肤
|
||||
/// </summary>
|
||||
[Description("普通皮肤")]
|
||||
Normal = 1,
|
||||
/// <summary>
|
||||
/// 限定皮肤
|
||||
/// </summary>
|
||||
[Description("限定皮肤")]
|
||||
Limited = 2,
|
||||
/// <summary>
|
||||
/// 活动皮肤
|
||||
/// </summary>
|
||||
[Description("活动皮肤")]
|
||||
Event = 3
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,10 +10,12 @@ public enum PetTemplateStatusEnum
|
||||
/// <summary>
|
||||
/// 未激活
|
||||
/// </summary>
|
||||
[Description("未激活")]
|
||||
Inactive = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 激活
|
||||
/// </summary>
|
||||
[Description("激活")]
|
||||
Active = 1
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,13 +10,16 @@ public enum PetTemplateTypeEnum
|
||||
/// <summary>
|
||||
/// 普通
|
||||
/// </summary>
|
||||
[Description("普通")]
|
||||
Normal = 1,
|
||||
/// <summary>
|
||||
/// 特殊
|
||||
/// </summary>
|
||||
[Description("特殊")]
|
||||
Special = 2,
|
||||
/// <summary>
|
||||
/// 限定
|
||||
/// </summary>
|
||||
[Description("限定")]
|
||||
Limited = 3
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,45 +10,54 @@ public enum PointsChangeTypeEnum
|
||||
/// <summary>
|
||||
/// 签到奖励
|
||||
/// </summary>
|
||||
[Description("签到奖励")]
|
||||
SignIn,
|
||||
|
||||
/// <summary>
|
||||
/// 补签奖励
|
||||
/// </summary>
|
||||
[Description("补签奖励")]
|
||||
MakeUpSign,
|
||||
|
||||
/// <summary>
|
||||
/// 商城兑换扣除
|
||||
/// </summary>
|
||||
[Description("商城兑换扣除")]
|
||||
Exchange,
|
||||
|
||||
/// <summary>
|
||||
/// 宠物喂养消耗
|
||||
/// </summary>
|
||||
[Description("宠物喂养消耗")]
|
||||
FeedPet,
|
||||
|
||||
/// <summary>
|
||||
/// 任务奖励(杂志任务等)
|
||||
/// </summary>
|
||||
[Description("任务奖励")]
|
||||
TaskReward,
|
||||
|
||||
/// <summary>
|
||||
/// 注册奖励
|
||||
/// </summary>
|
||||
[Description("注册奖励")]
|
||||
RegisterBonus,
|
||||
|
||||
/// <summary>
|
||||
/// 勋章奖励
|
||||
/// </summary>
|
||||
[Description("勋章奖励")]
|
||||
MedalBonus,
|
||||
|
||||
/// <summary>
|
||||
/// 系统补偿
|
||||
/// </summary>
|
||||
[Description("系统补偿")]
|
||||
SystemCompensation,
|
||||
|
||||
/// <summary>
|
||||
/// 后台手动调整
|
||||
/// </summary>
|
||||
[Description("后台手动调整")]
|
||||
ManualAdjust
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,10 +10,12 @@ public enum PointsFlowTypeEnum
|
||||
/// <summary>
|
||||
/// 收入
|
||||
/// </summary>
|
||||
[Description("收入")]
|
||||
Income,
|
||||
|
||||
/// <summary>
|
||||
/// 支出
|
||||
/// </summary>
|
||||
[Description("支出")]
|
||||
Expense
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,15 +10,18 @@ public enum PointsRecordStatusEnum
|
||||
/// <summary>
|
||||
/// 待处理
|
||||
/// </summary>
|
||||
[Description("待处理")]
|
||||
Pending = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 成功
|
||||
/// </summary>
|
||||
[Description("成功")]
|
||||
Success = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 失败
|
||||
/// </summary>
|
||||
[Description("失败")]
|
||||
Failed = 2
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,9 +10,11 @@ public enum ProductTypeEnum
|
||||
/// <summary>
|
||||
/// 补签卡
|
||||
/// </summary>
|
||||
[Description("补签卡")]
|
||||
MakeUpCard = 1,
|
||||
/// <summary>
|
||||
/// 宠物背景
|
||||
/// </summary>
|
||||
[Description("宠物背景")]
|
||||
PetBg = 2
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,10 +10,12 @@ public enum UserBagStatusEnum
|
||||
/// <summary>
|
||||
/// 已过期
|
||||
/// </summary>
|
||||
[Description("已过期")]
|
||||
Expired = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 可用
|
||||
/// </summary>
|
||||
[Description("可用")]
|
||||
Available = 1
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,9 +10,11 @@ public enum UserBagTypeEnum
|
||||
/// <summary>
|
||||
/// 补签卡
|
||||
/// </summary>
|
||||
[Description("补签卡")]
|
||||
MakeUpCard = 1,
|
||||
/// <summary>
|
||||
/// 宠物背景
|
||||
/// </summary>
|
||||
[Description("宠物背景")]
|
||||
PetBg = 2
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,10 +10,12 @@ public enum UserJournalStatusEnum
|
||||
/// <summary>
|
||||
/// 失效
|
||||
/// </summary>
|
||||
[Description("失效")]
|
||||
Inactive = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 正常
|
||||
/// </summary>
|
||||
[Description("正常")]
|
||||
Active = 1
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,13 +10,16 @@ public enum UserJournalTypeEnum
|
||||
/// <summary>
|
||||
/// 已读
|
||||
/// </summary>
|
||||
[Description("已读")]
|
||||
Read = 1,
|
||||
/// <summary>
|
||||
/// 收藏
|
||||
/// </summary>
|
||||
[Description("收藏")]
|
||||
Favorite = 2,
|
||||
/// <summary>
|
||||
/// 订阅
|
||||
/// </summary>
|
||||
[Description("订阅")]
|
||||
Subscribe = 3
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,10 +10,12 @@ public enum UserMedalStatusEnum
|
||||
/// <summary>
|
||||
/// 已撤销
|
||||
/// </summary>
|
||||
[Description("已撤销")]
|
||||
Revoked = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 已授予
|
||||
/// </summary>
|
||||
[Description("已授予")]
|
||||
Awarded = 1
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,9 +10,11 @@ public enum UserMedalTypeEnum
|
||||
/// <summary>
|
||||
/// 系统授予
|
||||
/// </summary>
|
||||
[Description("系统授予")]
|
||||
System = 1,
|
||||
/// <summary>
|
||||
/// 活动奖励
|
||||
/// </summary>
|
||||
[Description("活动奖励")]
|
||||
Activity = 2
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,15 +10,18 @@ public enum UserPetStatusEnum
|
||||
/// <summary>
|
||||
/// 未激活
|
||||
/// </summary>
|
||||
[Description("未激活")]
|
||||
Inactive = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 激活
|
||||
/// </summary>
|
||||
[Description("激活")]
|
||||
Active = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 休眠中
|
||||
/// </summary>
|
||||
[Description("休眠中")]
|
||||
Sleeping = 2
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,5 +10,6 @@ public enum UserPetTypeEnum
|
||||
/// <summary>
|
||||
/// 普通
|
||||
/// </summary>
|
||||
[Description("普通")]
|
||||
Normal = 1
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,10 +10,12 @@ public enum UserStatusEnum
|
||||
/// <summary>
|
||||
/// 启用
|
||||
/// </summary>
|
||||
[Description("启用")]
|
||||
Active = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 禁用
|
||||
/// </summary>
|
||||
[Description("禁用")]
|
||||
Disabled = 2
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
/// <summary>
|
||||
@ -8,9 +10,11 @@ public enum UsersTypeEnum
|
||||
/// <summary>
|
||||
/// 普通用户
|
||||
/// </summary>
|
||||
[Description("普通用户")]
|
||||
Normal = 1,
|
||||
/// <summary>
|
||||
/// VIP用户
|
||||
/// </summary>
|
||||
[Description("VIP用户")]
|
||||
VIP = 2
|
||||
}
|
||||
|
||||
@ -117,7 +117,7 @@ public class CheckInService(
|
||||
});
|
||||
|
||||
// 7. 如果用户有活跃宠物,调用 PetService 喂养(含进化检查),独立事务
|
||||
if (pet != null && pet.Status == UserPetStatusEnum.Active && growthReward > 0)
|
||||
if (pet != null && pet.Status == (int)UserPetStatusEnum.Active && growthReward > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -315,7 +315,7 @@ public class CheckInService(
|
||||
});
|
||||
|
||||
// 如果有活跃宠物,喂养成长值
|
||||
if (pet != null && pet.Status == UserPetStatusEnum.Active && growthReward > 0)
|
||||
if (pet != null && pet.Status == (int)UserPetStatusEnum.Active && growthReward > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -391,7 +391,7 @@ public class CheckInService(
|
||||
{
|
||||
// 查询签到配置(按 DayNumber 升序)
|
||||
var configs = await checkInRecordRepository.Context.Queryable<CheckInConfig>()
|
||||
.Where(c => c.Status == CheckInConfigStatusEnum.Active && !c.IsDeleted)
|
||||
.Where(c => c.Status == (int)CheckInConfigStatusEnum.Active && !c.IsDeleted)
|
||||
.OrderBy(c => c.DayNumber)
|
||||
.ToListAsync();
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ public class CompensationManageService(
|
||||
.LeftJoin<Users>((t, u) => t.UserId == u.Id)
|
||||
.WhereIF(input.UserId.HasValue, (t, u) => t.UserId == input.UserId.Value)
|
||||
.WhereIF(input.TaskType.HasValue, (t, u) => t.TaskType == (int)input.TaskType.Value)
|
||||
.WhereIF(input.Status.HasValue, (t, u) => t.Status == input.Status.Value)
|
||||
.WhereIF(input.Status.HasValue, (t, u) => t.Status == (int)input.Status)
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.BusinessSource), (t, u) => t.BusinessSource == input.BusinessSource)
|
||||
.OrderByDescending((t, u) => t.CreatedAt)
|
||||
.Select((t, u) => new CompensationManageOutput
|
||||
@ -53,7 +53,7 @@ public class CompensationManageService(
|
||||
ErrorSource = t.ErrorSource,
|
||||
RetryCount = t.RetryCount,
|
||||
MaxRetries = t.MaxRetries,
|
||||
Status = t.Status,
|
||||
Status = (CompensationTaskStatusEnum)t.Status,
|
||||
ProcessedAt = t.ProcessedAt,
|
||||
ScheduledAt = t.ScheduledAt,
|
||||
ResultMessage = t.ResultMessage,
|
||||
@ -75,12 +75,12 @@ public class CompensationManageService(
|
||||
if (task == null)
|
||||
throw new BusinessException("补偿任务不存在", 404);
|
||||
|
||||
if (task.Status != CompensationTaskStatusEnum.Failed && task.Status != CompensationTaskStatusEnum.Cancelled)
|
||||
if (task.Status != (int)CompensationTaskStatusEnum.Failed && task.Status != (int)CompensationTaskStatusEnum.Cancelled)
|
||||
throw new BusinessException($"只有失败或已取消的任务才能重试,当前状态: {task.Status}", 400);
|
||||
|
||||
// 重置任务状态为 Pending,清零重试次数,设置立即执行
|
||||
await compensationTaskRepository.Context.Updateable<CompensationTask>()
|
||||
.SetColumns(t => t.Status == CompensationTaskStatusEnum.Pending)
|
||||
.SetColumns(t => t.Status == (int)CompensationTaskStatusEnum.Pending)
|
||||
.SetColumns(t => t.RetryCount == 0)
|
||||
.SetColumns(t => t.ScheduledAt == DateTime.Now)
|
||||
.SetColumns(t => t.ResultMessage == $"管理员手动重试: {input.Reason}")
|
||||
@ -118,12 +118,12 @@ public class CompensationManageService(
|
||||
if (task == null)
|
||||
throw new BusinessException("补偿任务不存在", 404);
|
||||
|
||||
if (task.Status == CompensationTaskStatusEnum.Success)
|
||||
if (task.Status == (int)CompensationTaskStatusEnum.Success)
|
||||
throw new BusinessException("该任务已经是成功状态,无需标记", 400);
|
||||
|
||||
// 标记为 Success
|
||||
await compensationTaskRepository.Context.Updateable<CompensationTask>()
|
||||
.SetColumns(t => t.Status == CompensationTaskStatusEnum.Success)
|
||||
.SetColumns(t => t.Status == (int)CompensationTaskStatusEnum.Success)
|
||||
.SetColumns(t => t.ResultMessage == $"管理员手动标记已解决: {input.ResolveNote}")
|
||||
.SetColumns(t => t.ProcessedAt == DateTime.Now)
|
||||
.SetColumns(t => t.UpdatedBy == operatorName)
|
||||
@ -172,7 +172,7 @@ public class CompensationManageService(
|
||||
ErrorSource = t.ErrorSource,
|
||||
RetryCount = t.RetryCount,
|
||||
MaxRetries = t.MaxRetries,
|
||||
Status = t.Status,
|
||||
Status = (CompensationTaskStatusEnum)t.Status,
|
||||
ProcessedAt = t.ProcessedAt,
|
||||
ScheduledAt = t.ScheduledAt,
|
||||
ResultMessage = t.ResultMessage,
|
||||
|
||||
@ -38,7 +38,7 @@ public class CompensationTaskService(
|
||||
ErrorSource = input.ErrorSource,
|
||||
RetryCount = 0,
|
||||
MaxRetries = input.MaxRetries > 0 ? input.MaxRetries : 3,
|
||||
Status = CompensationTaskStatusEnum.Pending,
|
||||
Status = (int)CompensationTaskStatusEnum.Pending,
|
||||
ScheduledAt = DateTime.Now,
|
||||
IsDeleted = false,
|
||||
CreatedBy = "System",
|
||||
@ -62,7 +62,7 @@ public class CompensationTaskService(
|
||||
var now = DateTime.Now;
|
||||
|
||||
var tasks = await taskRepository.Queryable()
|
||||
.Where(t => (t.Status == CompensationTaskStatusEnum.Pending || t.Status == CompensationTaskStatusEnum.Processing)
|
||||
.Where(t => (t.Status == (int)CompensationTaskStatusEnum.Pending || t.Status == (int)CompensationTaskStatusEnum.Processing)
|
||||
&& !t.IsDeleted
|
||||
&& (t.ScheduledAt == null || t.ScheduledAt <= now))
|
||||
.OrderBy(t => t.CreatedAt)
|
||||
@ -79,7 +79,7 @@ public class CompensationTaskService(
|
||||
ErrorSource = t.ErrorSource,
|
||||
RetryCount = t.RetryCount,
|
||||
MaxRetries = t.MaxRetries,
|
||||
Status = t.Status,
|
||||
Status = (CompensationTaskStatusEnum)t.Status,
|
||||
ProcessedAt = t.ProcessedAt,
|
||||
ScheduledAt = t.ScheduledAt,
|
||||
ResultMessage = t.ResultMessage,
|
||||
@ -99,10 +99,10 @@ public class CompensationTaskService(
|
||||
.Where(t => !t.IsDeleted);
|
||||
|
||||
if (input.Status.HasValue)
|
||||
query = query.Where(t => t.Status == input.Status.Value);
|
||||
query = query.Where(t => t.Status == (int)input.Status);
|
||||
|
||||
if (input.TaskType.HasValue)
|
||||
query = query.Where(t => t.TaskType == (int)input.TaskType.Value);
|
||||
query = query.Where(t => t.TaskType == (int)input.TaskType);
|
||||
|
||||
if (!string.IsNullOrEmpty(input.BusinessSource))
|
||||
query = query.Where(t => t.BusinessSource == input.BusinessSource);
|
||||
@ -122,7 +122,7 @@ public class CompensationTaskService(
|
||||
ErrorSource = t.ErrorSource,
|
||||
RetryCount = t.RetryCount,
|
||||
MaxRetries = t.MaxRetries,
|
||||
Status = t.Status,
|
||||
Status = (CompensationTaskStatusEnum)t.Status,
|
||||
ProcessedAt = t.ProcessedAt,
|
||||
ScheduledAt = t.ScheduledAt,
|
||||
ResultMessage = t.ResultMessage,
|
||||
@ -139,7 +139,7 @@ public class CompensationTaskService(
|
||||
public async Task UpdateTaskStatusAsync(long taskId, UpdateCompensationStatusInput input)
|
||||
{
|
||||
var update = taskRepository.Context.Updateable<CompensationTask>()
|
||||
.SetColumns(t => t.Status == input.Status)
|
||||
.SetColumns(t => t.Status == (int)input.Status)
|
||||
.SetColumns(t => t.ResultMessage == input.ResultMessage)
|
||||
.SetColumns(t => t.ProcessedAt == DateTime.Now)
|
||||
.SetColumns(t => t.UpdatedAt == DateTime.Now);
|
||||
@ -163,7 +163,7 @@ public class CompensationTaskService(
|
||||
public async Task CancelTaskAsync(long taskId, string reason)
|
||||
{
|
||||
await taskRepository.Context.Updateable<CompensationTask>()
|
||||
.SetColumns(t => t.Status == CompensationTaskStatusEnum.Cancelled)
|
||||
.SetColumns(t => t.Status == (int)CompensationTaskStatusEnum.Cancelled)
|
||||
.SetColumns(t => t.ResultMessage == reason)
|
||||
.SetColumns(t => t.UpdatedAt == DateTime.Now)
|
||||
.Where(t => t.Id == taskId && !t.IsDeleted)
|
||||
|
||||
@ -314,7 +314,7 @@ public class MedalService(BaseRepository<Medal> medalRepository, ILogger<MedalSe
|
||||
.ToListAsync();
|
||||
|
||||
var userMedals = await Context.Queryable<UserMedal>()
|
||||
.Where(um => um.UserId == userId && um.Status == UserMedalStatusEnum.Awarded)
|
||||
.Where(um => um.UserId == userId && um.Status == (int)UserMedalStatusEnum.Awarded)
|
||||
.ToListAsync();
|
||||
|
||||
var userMedalDict = userMedals.ToDictionary(um => um.MedalId, um => um.AwardedAt);
|
||||
@ -341,7 +341,7 @@ public class MedalService(BaseRepository<Medal> medalRepository, ILogger<MedalSe
|
||||
|
||||
var result = await Context.Queryable<UserMedal>()
|
||||
.InnerJoin<Medal>((um, m) => um.MedalId == m.Id)
|
||||
.Where((um, m) => um.UserId == userId && um.Status == UserMedalStatusEnum.Awarded)
|
||||
.Where((um, m) => um.UserId == userId && um.Status == (int)UserMedalStatusEnum.Awarded)
|
||||
.OrderByDescending((um, m) => um.AwardedAt)
|
||||
.Select((um, m) => new WxUserMedalOutput
|
||||
{
|
||||
@ -391,7 +391,7 @@ public class MedalService(BaseRepository<Medal> medalRepository, ILogger<MedalSe
|
||||
}
|
||||
|
||||
var existingUserMedal = await Context.Queryable<UserMedal>()
|
||||
.Where(um => um.UserId == userId && um.MedalId == (int)input.MedalId && um.Status == UserMedalStatusEnum.Awarded)
|
||||
.Where(um => um.UserId == userId && um.MedalId == (int)input.MedalId && um.Status == (int)UserMedalStatusEnum.Awarded)
|
||||
.FirstAsync();
|
||||
|
||||
if (existingUserMedal != null)
|
||||
@ -405,7 +405,7 @@ public class MedalService(BaseRepository<Medal> medalRepository, ILogger<MedalSe
|
||||
MedalId = (int)input.MedalId,
|
||||
AwardedAt = DateTime.Now,
|
||||
Type = (UserMedalTypeEnum)medal.Type,
|
||||
Status = UserMedalStatusEnum.Awarded,
|
||||
Status = (int)UserMedalStatusEnum.Awarded,
|
||||
CreatedBy = "System",
|
||||
UpdatedBy = "System",
|
||||
CreatedAt = DateTime.Now,
|
||||
|
||||
@ -109,7 +109,7 @@ public class PetService(
|
||||
|
||||
// 查询默认宠物模板(取排序权重最低且状态为Active的模板)
|
||||
var defaultTemplate = await petTemplateRepository.Queryable()
|
||||
.Where(t => t.Status == PetTemplateStatusEnum.Active && !t.IsDeleted)
|
||||
.Where(t => t.Status == (int)PetTemplateStatusEnum.Active && !t.IsDeleted)
|
||||
.OrderBy(t => t.SortOrder)
|
||||
.FirstAsync();
|
||||
|
||||
@ -123,7 +123,7 @@ public class PetService(
|
||||
var initialEvolution = await petEvolutionRepository.Queryable()
|
||||
.Where(e => e.TemplateId == defaultTemplate.Id
|
||||
&& e.PreviousEvolutionId == null
|
||||
&& e.Status == PetEvolutionStatusEnum.Active)
|
||||
&& e.Status == (int)PetEvolutionStatusEnum.Active)
|
||||
.OrderBy(e => e.StageLevel)
|
||||
.FirstAsync();
|
||||
|
||||
@ -137,7 +137,7 @@ public class PetService(
|
||||
FeedingCount = 0,
|
||||
CurrentSkinId = 0,
|
||||
Type = UserPetTypeEnum.Normal,
|
||||
Status = UserPetStatusEnum.Inactive,
|
||||
Status = (int)UserPetStatusEnum.Inactive,
|
||||
IsDeleted = false,
|
||||
CreatedBy = userId.ToString(),
|
||||
CreatedAt = DateTime.Now,
|
||||
@ -173,14 +173,14 @@ public class PetService(
|
||||
return;
|
||||
}
|
||||
|
||||
if (pet.Status != UserPetStatusEnum.Inactive)
|
||||
if (pet.Status != (int)UserPetStatusEnum.Inactive)
|
||||
{
|
||||
logger.LogInformation("用户宠物已非未激活状态,跳过激活,UserId: {UserId}, Status: {Status}", userId, pet.Status);
|
||||
return;
|
||||
}
|
||||
|
||||
var result = await petRepository.UpdateAsync(
|
||||
p => new UserPet { Status = UserPetStatusEnum.Active },
|
||||
p => new UserPet { Status = (int)UserPetStatusEnum.Active },
|
||||
p => p.UserId == userId);
|
||||
|
||||
if (!result)
|
||||
@ -226,7 +226,7 @@ public class PetService(
|
||||
}
|
||||
|
||||
// 校验宠物状态
|
||||
if (pet.Status != UserPetStatusEnum.Active)
|
||||
if (pet.Status != (int)UserPetStatusEnum.Active)
|
||||
{
|
||||
logger.LogWarning("喂养失败,宠物未激活,PetId: {PetId}, Status: {Status}", input.PetId, pet.Status);
|
||||
throw new BusinessException("宠物未激活,无法喂养", 400);
|
||||
@ -258,7 +258,7 @@ public class PetService(
|
||||
var nextEvolution = await petEvolutionRepository.Queryable()
|
||||
.Where(e => e.PreviousEvolutionId == pet.CurrentEvolutionId
|
||||
&& e.RequiredGrowth <= growthAfter
|
||||
&& e.Status == PetEvolutionStatusEnum.Active)
|
||||
&& e.Status == (int)PetEvolutionStatusEnum.Active)
|
||||
.OrderBy(e => e.RequiredGrowth, OrderByType.Desc)
|
||||
.FirstAsync();
|
||||
|
||||
@ -291,7 +291,7 @@ public class PetService(
|
||||
GrowthBefore = growthBefore,
|
||||
GrowthAfter = growthAfter,
|
||||
Type = PetFeedingRecordTypeEnum.Normal,
|
||||
Status = PetFeedingRecordStatusEnum.Success,
|
||||
Status = (int)PetFeedingRecordStatusEnum.Success,
|
||||
IsDeleted = false,
|
||||
CreatedBy = userId.ToString(),
|
||||
CreatedAt = DateTime.Now,
|
||||
@ -367,7 +367,7 @@ public class PetService(
|
||||
IconUrl = input.IconUrl,
|
||||
SortOrder = input.SortOrder,
|
||||
Type = Enum.Parse<PetTemplateTypeEnum>(input.Type, true),
|
||||
Status = PetTemplateStatusEnum.Active,
|
||||
Status = (int)PetTemplateStatusEnum.Active,
|
||||
CreatedBy = "System",
|
||||
CreatedAt = DateTime.Now,
|
||||
UpdatedBy = "System",
|
||||
@ -484,13 +484,13 @@ public class PetService(
|
||||
/// <summary>
|
||||
/// 更新模板状态(启用/禁用)
|
||||
/// </summary>
|
||||
public async Task UpdateTemplateStatusAsync(long id, string status)
|
||||
public async Task UpdateTemplateStatusAsync(long id, int status)
|
||||
{
|
||||
var template = await petTemplateRepository.GetByIdAsync(id);
|
||||
if (template == null || template.IsDeleted)
|
||||
throw new BusinessException("宠物模板不存在", 404);
|
||||
|
||||
template.Status = Enum.Parse<PetTemplateStatusEnum>(status, true);
|
||||
template.Status = status;
|
||||
template.UpdatedBy = "System";
|
||||
template.UpdatedAt = DateTime.Now;
|
||||
await petTemplateRepository.UpdateAsync(template);
|
||||
@ -548,7 +548,7 @@ public class PetService(
|
||||
BaseIntelligence = input.BaseIntelligence,
|
||||
BaseCharm = input.BaseCharm,
|
||||
Type = Enum.Parse<PetEvolutionTypeEnum>(input.Type, true),
|
||||
Status = PetEvolutionStatusEnum.Active,
|
||||
Status = (int)PetEvolutionStatusEnum.Active,
|
||||
CreatedBy = "System",
|
||||
CreatedAt = DateTime.Now,
|
||||
UpdatedBy = "System",
|
||||
|
||||
@ -101,7 +101,7 @@ public class PointsService(
|
||||
RelatedId = input.RelatedId,
|
||||
Description = input.Description,
|
||||
Type = PointsFlowTypeEnum.Income,
|
||||
Status = PointsRecordStatusEnum.Success,
|
||||
Status = (int)PointsRecordStatusEnum.Success,
|
||||
IsDeleted = false,
|
||||
CreatedBy = input.OperatorName ?? user.Name ?? input.UserId.ToString(),
|
||||
CreatedAt = DateTime.Now,
|
||||
@ -164,7 +164,7 @@ public class PointsService(
|
||||
RelatedId = input.RelatedId,
|
||||
Description = input.Description,
|
||||
Type = PointsFlowTypeEnum.Expense,
|
||||
Status = PointsRecordStatusEnum.Success,
|
||||
Status = (int)PointsRecordStatusEnum.Success,
|
||||
IsDeleted = false,
|
||||
CreatedBy = input.OperatorName ?? user.Name ?? input.UserId.ToString(),
|
||||
CreatedAt = DateTime.Now,
|
||||
@ -218,12 +218,12 @@ public class PointsService(
|
||||
|
||||
// 查询累计收入(Income 类型)
|
||||
var totalIncome = await Context.Queryable<PointsRecord>()
|
||||
.Where(r => r.UserId == userId && !r.IsDeleted && r.Type == PointsFlowTypeEnum.Income && r.Status == PointsRecordStatusEnum.Success)
|
||||
.Where(r => r.UserId == userId && !r.IsDeleted && r.Type == PointsFlowTypeEnum.Income && r.Status == (int)PointsRecordStatusEnum.Success)
|
||||
.SumAsync(r => r.ChangeAmount);
|
||||
|
||||
// 查询累计支出(Expense 类型,取绝对值)
|
||||
var totalExpense = await Context.Queryable<PointsRecord>()
|
||||
.Where(r => r.UserId == userId && !r.IsDeleted && r.Type == PointsFlowTypeEnum.Expense && r.Status == PointsRecordStatusEnum.Success)
|
||||
.Where(r => r.UserId == userId && !r.IsDeleted && r.Type == PointsFlowTypeEnum.Expense && r.Status == (int)PointsRecordStatusEnum.Success)
|
||||
.SumAsync(r => r.ChangeAmount);
|
||||
|
||||
return new PointsSummaryOutput
|
||||
|
||||
73
QYZH.InteractiveMagazine.Service/SystemManagementService.cs
Normal file
73
QYZH.InteractiveMagazine.Service/SystemManagementService.cs
Normal file
@ -0,0 +1,73 @@
|
||||
using System.ComponentModel;
|
||||
using System.Reflection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using QYZH.InteractiveMagazine.IService;
|
||||
using QYZH.InteractiveMagazine.Models.Dto.SystemManagement;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Service;
|
||||
|
||||
/// <summary>
|
||||
/// 系统管理服务实现
|
||||
/// </summary>
|
||||
public class SystemManagementService : ISystemManagementService
|
||||
{
|
||||
private readonly ILogger<SystemManagementService> _logger;
|
||||
|
||||
public SystemManagementService(ILogger<SystemManagementService> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public Task<List<EnumInfoOutput>> GetAllEnumsAsync()
|
||||
{
|
||||
_logger.LogInformation("开始获取所有枚举信息");
|
||||
|
||||
var enumAssembly = typeof(QYZH.InteractiveMagazine.Models.Enum.AdminUserStatusEnum).Assembly;
|
||||
var enumNamespace = "QYZH.InteractiveMagazine.Models.Enum";
|
||||
|
||||
var enumTypes = enumAssembly.GetTypes()
|
||||
.Where(t => t.IsEnum && t.Namespace == enumNamespace)
|
||||
.OrderBy(t => t.Name)
|
||||
.ToList();
|
||||
|
||||
var result = new List<EnumInfoOutput>();
|
||||
|
||||
foreach (var enumType in enumTypes)
|
||||
{
|
||||
var enumInfo = new EnumInfoOutput
|
||||
{
|
||||
EnumName = enumType.Name
|
||||
};
|
||||
|
||||
var fields = Enum.GetValues(enumType)
|
||||
.Cast<object>()
|
||||
.Select(value => new
|
||||
{
|
||||
Name = Enum.GetName(enumType, value),
|
||||
Value = Convert.ToInt32(value),
|
||||
Field = enumType.GetField(value.ToString()!)
|
||||
})
|
||||
.ToList();
|
||||
|
||||
foreach (var field in fields)
|
||||
{
|
||||
var description = field.Field?
|
||||
.GetCustomAttribute<DescriptionAttribute>()?
|
||||
.Description;
|
||||
|
||||
enumInfo.Items.Add(new EnumItemDto
|
||||
{
|
||||
Name = field.Name!,
|
||||
Value = field.Value,
|
||||
Description = description
|
||||
});
|
||||
}
|
||||
|
||||
result.Add(enumInfo);
|
||||
}
|
||||
|
||||
_logger.LogInformation("获取枚举信息完成,共 {Count} 个枚举", result.Count);
|
||||
|
||||
return Task.FromResult(result);
|
||||
}
|
||||
}
|
||||
@ -50,7 +50,7 @@ public class UserJournalService(
|
||||
}
|
||||
|
||||
// 校验期刊状态
|
||||
if (journal.Status != JournalStatusEnum.Published)
|
||||
if (journal.Status != (int)JournalStatusEnum.Published)
|
||||
{
|
||||
logger.LogWarning("绑定期刊失败,期刊未发布,JournalId: {JournalId}, Status: {Status}", input.JournalId, journal.Status);
|
||||
throw new BusinessException("该期刊暂未发布,无法绑定", 400);
|
||||
@ -77,7 +77,7 @@ public class UserJournalService(
|
||||
JournalId = input.JournalId,
|
||||
Id = input.Id,
|
||||
Type = Enum.Parse<UserJournalTypeEnum>(input.Type, true),
|
||||
Status = UserJournalStatusEnum.Active,
|
||||
Status = (int)UserJournalStatusEnum.Active,
|
||||
IsDeleted = false,
|
||||
CreatedBy = userId.ToString(),
|
||||
CreatedAt = DateTime.Now,
|
||||
|
||||
@ -180,7 +180,7 @@ public class UsersService(
|
||||
|
||||
var statusValue = input.Status == 1 ? UserStatusEnum.Active : UserStatusEnum.Disabled;
|
||||
var result = await UpdateAsync(
|
||||
u => new Users { Status = statusValue },
|
||||
u => new Users { Status = (int)statusValue },
|
||||
u => u.Id == id
|
||||
);
|
||||
|
||||
|
||||
@ -72,7 +72,7 @@ public class WeChatAuthService(BaseRepository<Users> usersRepository, IConfigura
|
||||
UnionId = wxResponse.UnionId,
|
||||
Phone = phone,
|
||||
Type = UsersTypeEnum.Normal,
|
||||
Status = UserStatusEnum.Active,
|
||||
Status = (int)UserStatusEnum.Active,
|
||||
GrowthPoints = 0,
|
||||
Points = 0,
|
||||
IsLastOnline = true
|
||||
@ -190,7 +190,7 @@ public class WeChatAuthService(BaseRepository<Users> usersRepository, IConfigura
|
||||
throw new BusinessException("无法切换到该用户", 403);
|
||||
}
|
||||
|
||||
if (targetUser.Status == UserStatusEnum.Disabled)
|
||||
if (targetUser.Status == (int)UserStatusEnum.Disabled)
|
||||
{
|
||||
throw new BusinessException("目标账号已被禁用", 403);
|
||||
}
|
||||
|
||||
@ -236,7 +236,7 @@ public class WeChatCommunityService(
|
||||
private async Task<List<long>> GetUserJournalIds(long userId)
|
||||
{
|
||||
return await Context.Queryable<UserJournal>()
|
||||
.Where(uj => uj.UserId == userId && uj.Status == UserJournalStatusEnum.Active)
|
||||
.Where(uj => uj.UserId == userId && uj.Status == (int)UserJournalStatusEnum.Active)
|
||||
.Select(uj => uj.JournalId)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ public class WxMallService(
|
||||
var skinProductIds = skinProductMap.Select(x => x.ProductId).ToList();
|
||||
var bagItems = skinProductIds.Count > 0
|
||||
? await exchangeRecordRepository.Context.Queryable<UserBag>()
|
||||
.Where(b => b.UserId == userId && !b.IsDeleted && b.Status == UserBagStatusEnum.Available
|
||||
.Where(b => b.UserId == userId && !b.IsDeleted && b.Status == (int)UserBagStatusEnum.Available
|
||||
&& skinProductIds.Contains(b.ItemId))
|
||||
.ToListAsync()
|
||||
: new List<UserBag>();
|
||||
@ -158,7 +158,7 @@ public class WxMallService(
|
||||
}
|
||||
|
||||
var owned = await exchangeRecordRepository.Context.Queryable<UserBag>()
|
||||
.Where(b => b.UserId == userId && b.ItemId == product.Id && !b.IsDeleted && b.Status == UserBagStatusEnum.Available)
|
||||
.Where(b => b.UserId == userId && b.ItemId == product.Id && !b.IsDeleted && b.Status == (int)UserBagStatusEnum.Available)
|
||||
.AnyAsync();
|
||||
|
||||
return new WxProductOutput
|
||||
@ -213,7 +213,7 @@ public class WxMallService(
|
||||
PointsCost = totalCost,
|
||||
PointsBalance = 0, // 稍后赋值
|
||||
Quantity = input.Quantity,
|
||||
Status = ExchangeRecordStatusEnum.Success,
|
||||
Status = (int)ExchangeRecordStatusEnum.Success,
|
||||
IsDeleted = false,
|
||||
CreatedBy = userId.ToString(),
|
||||
CreatedAt = DateTime.Now,
|
||||
@ -241,7 +241,7 @@ public class WxMallService(
|
||||
|
||||
// 加入背包
|
||||
var existingBag = await exchangeRecordRepository.Context.Queryable<UserBag>()
|
||||
.Where(b => b.UserId == userId && b.ItemId == product.Id && !b.IsDeleted && b.Status == UserBagStatusEnum.Available)
|
||||
.Where(b => b.UserId == userId && b.ItemId == product.Id && !b.IsDeleted && b.Status == (int)UserBagStatusEnum.Available)
|
||||
.FirstAsync();
|
||||
|
||||
if (existingBag != null)
|
||||
@ -264,7 +264,7 @@ public class WxMallService(
|
||||
Quantity = input.Quantity,
|
||||
MetaData = product.MetaData,
|
||||
Type = Enum.TryParse<UserBagTypeEnum>(product.Type.ToString(), out var bagType) ? bagType : default,
|
||||
Status = UserBagStatusEnum.Available,
|
||||
Status = (int)UserBagStatusEnum.Available,
|
||||
IsDeleted = false,
|
||||
CreatedBy = userId.ToString(),
|
||||
CreatedAt = DateTime.Now,
|
||||
@ -318,7 +318,7 @@ public class WxMallService(
|
||||
public async Task<List<UserBagOutput>> GetBagItemsAsync(long userId, string? itemType = null)
|
||||
{
|
||||
var query = exchangeRecordRepository.Context.Queryable<UserBag>()
|
||||
.Where(b => b.UserId == userId && !b.IsDeleted && b.Status == UserBagStatusEnum.Available)
|
||||
.Where(b => b.UserId == userId && !b.IsDeleted && b.Status == (int)UserBagStatusEnum.Available)
|
||||
.WhereIF(!string.IsNullOrEmpty(itemType), b => b.ItemType == itemType)
|
||||
.OrderByDescending(b => b.CreatedAt);
|
||||
|
||||
@ -403,7 +403,7 @@ public class WxMallService(
|
||||
throw new BusinessException("背包物品Id无效", 400);
|
||||
|
||||
var bagItem = await exchangeRecordRepository.Context.Queryable<UserBag>()
|
||||
.Where(b => b.Id == input.BagItemId && b.UserId == userId && !b.IsDeleted && b.Status == UserBagStatusEnum.Available)
|
||||
.Where(b => b.Id == input.BagItemId && b.UserId == userId && !b.IsDeleted && b.Status == (int)UserBagStatusEnum.Available)
|
||||
.FirstAsync();
|
||||
|
||||
if (bagItem == null)
|
||||
@ -444,7 +444,7 @@ public class WxMallService(
|
||||
if (bagItem.Quantity <= 1)
|
||||
{
|
||||
await exchangeRecordRepository.Context.Updateable<UserBag>()
|
||||
.SetColumns(b => b.Status == UserBagStatusEnum.Expired)
|
||||
.SetColumns(b => b.Status == (int)UserBagStatusEnum.Expired)
|
||||
.SetColumns(b => b.Quantity == 0)
|
||||
.SetColumns(b => b.UpdatedAt == DateTime.Now)
|
||||
.Where(b => b.Id == bagItem.Id)
|
||||
@ -507,7 +507,7 @@ public class WxMallService(
|
||||
|
||||
// 校验背包中是否拥有该皮肤(通过 MetaData 中的 SkinId 判断)
|
||||
var hasSkin = await exchangeRecordRepository.Context.Queryable<UserBag>()
|
||||
.Where(b => b.UserId == userId && !b.IsDeleted && b.Status == UserBagStatusEnum.Available && b.Quantity > 0
|
||||
.Where(b => b.UserId == userId && !b.IsDeleted && b.Status == (int)UserBagStatusEnum.Available && b.Quantity > 0
|
||||
&& b.ItemType == "PetBg")
|
||||
.ToListAsync();
|
||||
|
||||
|
||||
@ -145,7 +145,7 @@ public class PetManageController : BaseController
|
||||
/// 更新宠物模板状态(启用/禁用)
|
||||
/// </summary>
|
||||
[HttpPut("{id}/status")]
|
||||
public async Task<BaseResponse<object>> UpdateTemplateStatusAsync(long id, [FromBody] string status)
|
||||
public async Task<BaseResponse<object>> UpdateTemplateStatusAsync(long id, [FromBody] int status)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@ -0,0 +1,46 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using QYZH.InteractiveMagazine.IService;
|
||||
using QYZH.InteractiveMagazine.Models.Dto;
|
||||
using QYZH.InteractiveMagazine.Models.Dto.SystemManagement;
|
||||
using QYZH.InteractiveMagazine.Models.Enum;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.WebApi.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// 系统管理控制器
|
||||
/// </summary>
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
[ApiExplorerSettings(GroupName = nameof(ApiVersionEnum.Platform))]
|
||||
public class SystemManagementController : BaseController
|
||||
{
|
||||
private readonly ISystemManagementService _systemManagementService;
|
||||
private readonly ILogger<SystemManagementController> _logger;
|
||||
|
||||
public SystemManagementController(ISystemManagementService systemManagementService, ILogger<SystemManagementController> logger)
|
||||
{
|
||||
_systemManagementService = systemManagementService;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取系统中所有枚举信息
|
||||
/// </summary>
|
||||
/// <returns>枚举信息列表</returns>
|
||||
[AllowAnonymous]
|
||||
[HttpGet("enums")]
|
||||
public async Task<BaseResponse<List<EnumInfoOutput>>> GetAllEnumsAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = await _systemManagementService.GetAllEnumsAsync();
|
||||
return Success(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "获取枚举信息异常");
|
||||
return BaseResponse<List<EnumInfoOutput>>.Fail("获取枚举信息失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user