refactor: 完成系统基础架构重构与业务逻辑优化

本次提交包含多项核心变更:
1.  **用户体系重构**:将管理员用户状态从字符串改为整型枚举,移除微信用户冗余字段Points和GrowthPoints,新增通用基础实体主键配置
2.  **代码清理**:删除HealthController、WxUserMedal、WxUserBag等废弃文件,移除WeChatDto中冗余查询字段
3.  **响应格式统一**:重构BaseResponse与ResultCode枚举,标准化全局响应格式
4.  **权限与验证优化**:添加JWT认证与开发环境免认证逻辑,新增模型验证过滤器,统一控制器认证配置
5.  **工具与配置更新**:新增dotnet-tools.json配置EF工具,调整Swagger与压缩中间件配置,优化SqlSugar默认值处理逻辑
6.  **业务逻辑简化**:移除AutoMapper映射,改为手动映射DTO以提升性能,修复异常处理与响应返回逻辑
This commit is contained in:
glz
2026-06-02 17:58:10 +08:00
parent 8ed012bba8
commit 0a32754740
24 changed files with 551 additions and 209 deletions

View File

@ -34,11 +34,5 @@ namespace QYZH.InteractiveMagazine.Models.Entity
/// </summary>
public string Type {get;set;}
/// <summary>
/// Desc:状态: Active, Inactive
/// Default:Active
/// Nullable:False
/// </summary>
public string Status {get;set;}
}
}

View File

@ -11,6 +11,7 @@ namespace QYZH.InteractiveMagazine.Models.Entity
/// Default:
/// Nullable:False
/// </summary>
[SugarColumn(IsPrimaryKey = true, ColumnName = "Id")]
public long Id { get; set; } = YitIdHelper.NextId();
/// <summary>
/// Desc:状态 0禁用 1启用
@ -18,7 +19,7 @@ namespace QYZH.InteractiveMagazine.Models.Entity
/// Nullable:False
/// </summary>
[SugarColumn(ColumnName = "Status")]
public string Status { get; set; }
public int Status { get; set; }
/// <summary>
/// Desc:是否删除
@ -49,7 +50,7 @@ namespace QYZH.InteractiveMagazine.Models.Entity
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "updatedBy", IsOnlyIgnoreInsert = true)]
[SugarColumn(ColumnName = "UpdatedBy")]
public string UpdatedBy { get; set; }
/// <summary>
@ -57,7 +58,7 @@ namespace QYZH.InteractiveMagazine.Models.Entity
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "UpdatedAt", IsOnlyIgnoreInsert = true)]
[SugarColumn(ColumnName = "UpdatedAt")]
public DateTime? UpdatedAt { get; set; }
}
}

View File

@ -0,0 +1,58 @@
using SqlSugar;
namespace QYZH.InteractiveMagazine.Models.Entity
{
///<summary>
///用户表
///</summary>
[SugarTable("User")]
public partial class User : SqlSugarBaseEntity
{
/// <summary>
/// Desc:微信用户ID
/// Default:
/// Nullable:True
/// </summary>
public string WxUserId { get; set; }
/// <summary>
/// Desc:昵称
/// Default:
/// Nullable:True
/// </summary>
public string Name { get; set; }
/// <summary>
/// Desc:当前成长值
/// Default:0
/// Nullable:False
/// </summary>
public int GrowthPoints { get; set; }
/// <summary>
/// Desc:头像地址
/// Default:
/// Nullable:True
/// </summary>
public string AvatarUrl { get; set; }
/// <summary>
/// Desc:积分余额
/// Default:0
/// Nullable:False
/// </summary>
public int Points { get; set; }
/// <summary>
/// Desc:用户类型: Normal, VIP
/// Default:Normal
/// Nullable:False
/// </summary>
public string Type { get; set; }
/// <summary>
/// Desc:状态: Active, Disabled
/// Default:Active
/// Nullable:False
/// </summary>
public string Status { get; set; }
}
}

View File

@ -5,10 +5,10 @@ namespace QYZH.InteractiveMagazine.Models.Entity
///<summary>
///用户背包表
///</summary>
[SugarTable("WxUserBag")]
public partial class WxUserBag : SqlSugarBaseEntity
[SugarTable("UserBag")]
public partial class UserBag : SqlSugarBaseEntity
{
public WxUserBag(){
public UserBag(){
}

View File

@ -5,10 +5,10 @@ namespace QYZH.InteractiveMagazine.Models.Entity
///<summary>
///用户勋章表
///</summary>
[SugarTable("WxUserMedal")]
public partial class WxUserMedal : SqlSugarBaseEntity
[SugarTable("UserMedal")]
public partial class UserMedal : SqlSugarBaseEntity
{
public WxUserMedal(){
public UserMedal(){
}

View File

@ -43,12 +43,6 @@ namespace QYZH.InteractiveMagazine.Models.Entity
/// </summary>
public string Phone { get; set; }
/// <summary>
/// Desc:积分余额
/// Default:0
/// Nullable:False
/// </summary>
public int Points { get; set; }
/// <summary>
/// Desc:用户类型: Normal, VIP
@ -70,11 +64,5 @@ namespace QYZH.InteractiveMagazine.Models.Entity
/// Nullable:False
/// </summary>
public string Pwd { get; set; }
/// <summary>
/// Desc:当前成长值
/// Default:0
/// Nullable:False
/// </summary>
public int GrowthPoints { get; set; }
}
}