Files
QYZH.InteractiveMagazine/QYZH.InteractiveMagazine.Models/Dto/Compensation/CompensationTaskDto.cs
glz 903ccd3073 feat: 新增签到、宠物、期刊绑定、补偿任务等业务模块,优化微信登录流程
本次提交完成了多个核心业务模块的开发与优化:
1.  宠物模块:新增宠物实体、服务接口与实现,支持创建默认宠物、激活、喂养、进化以及喂养记录查询
2.  签到模块:新增签到实体、服务接口、控制器以及相关DTO,支持用户签到和签到信息查询,新增成长值奖励字段
3.  期刊绑定模块:新增用户期刊关联实体、服务接口与控制器,支持扫码绑定期刊、解绑和查询绑定列表
4.  补偿任务模块:新增补偿任务实体、服务接口与实现,用于处理业务失败后的异步重试补偿
5.  优化微信登录流程:拆分登录与快捷登录接口,支持手机号获取,新增首次登录自动创建默认宠物逻辑
6.  调整基础路由与实体状态:修改微信控制器路由前缀,更新宠物状态枚举与默认值
2026-06-04 15:54:30 +08:00

164 lines
4.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

namespace QYZH.InteractiveMagazine.Models.Dto.Compensation;
/// <summary>
/// 补偿任务类型常量
/// </summary>
public static class CompensationTaskType
{
/// <summary>
/// 宠物喂养补偿
/// Payload: { "PetId": long, "GrowthPoints": int }
/// </summary>
public const string PetFeeding = "PetFeeding";
/// <summary>
/// 用户积分补偿
/// Payload: { "Points": int, "ChangeType": string, "Description": string }
/// </summary>
public const string UserPoints = "UserPoints";
/// <summary>
/// 用户成长值补偿
/// Payload: { "GrowthPoints": int }
/// </summary>
public const string UserGrowth = "UserGrowth";
/// <summary>
/// 发送通知补偿
/// Payload: { "TemplateId": string, "Data": object }
/// </summary>
public const string SendNotification = "SendNotification";
}
/// <summary>
/// 补偿任务状态常量
/// </summary>
public static class CompensationTaskStatus
{
public const string Pending = "Pending";
public const string Processing = "Processing";
public const string Success = "Success";
public const string Failed = "Failed";
public const string Cancelled = "Cancelled";
}
/// <summary>
/// 创建补偿任务输入
/// </summary>
public class CreateCompensationTaskInput
{
/// <summary>
/// 任务类型(使用 CompensationTaskType 常量)
/// </summary>
public string TaskType { get; set; } = string.Empty;
/// <summary>
/// 业务来源(如 CheckIn、Purchase
/// </summary>
public string BusinessSource { get; set; } = string.Empty;
/// <summary>
/// 关联业务记录Id
/// </summary>
public string? BusinessId { get; set; }
/// <summary>
/// 关联用户Id
/// </summary>
public long UserId { get; set; }
/// <summary>
/// 处理参数匿名对象或字典会自动序列化为JSON
/// </summary>
public object Payload { get; set; } = new { };
/// <summary>
/// 异常消息
/// </summary>
public string ErrorMessage { get; set; } = string.Empty;
/// <summary>
/// 异常来源(类名.方法名,如 CheckInService.CheckInAsync
/// </summary>
public string ErrorSource { get; set; } = string.Empty;
/// <summary>
/// 最大重试次数默认3次
/// </summary>
public int MaxRetries { get; set; } = 3;
}
/// <summary>
/// 补偿任务输出
/// </summary>
public class CompensationTaskOutput
{
public long Id { get; set; }
public string TaskType { get; set; } = string.Empty;
public string BusinessSource { get; set; } = string.Empty;
public string? BusinessId { get; set; }
public long UserId { get; set; }
public string Payload { get; set; } = string.Empty;
public string ErrorMessage { get; set; } = string.Empty;
public string ErrorSource { get; set; } = string.Empty;
public int RetryCount { get; set; }
public int MaxRetries { get; set; }
public string Status { get; set; } = string.Empty;
public DateTime? ProcessedAt { get; set; }
public DateTime? ScheduledAt { get; set; }
public string? ResultMessage { get; set; }
public DateTime CreatedAt { get; set; }
}
/// <summary>
/// 查询补偿任务输入(供外部项目按条件拉取)
/// </summary>
public class GetCompensationTasksInput
{
/// <summary>
/// 按状态筛选
/// </summary>
public string? Status { get; set; }
/// <summary>
/// 按任务类型筛选
/// </summary>
public string? TaskType { get; set; }
/// <summary>
/// 按业务来源筛选
/// </summary>
public string? BusinessSource { get; set; }
/// <summary>
/// 获取数量上限默认50
/// </summary>
public int Limit { get; set; } = 50;
}
/// <summary>
/// 更新补偿任务状态输入(供外部处理项目回调)
/// </summary>
public class UpdateCompensationStatusInput
{
/// <summary>
/// 目标状态(使用 CompensationTaskStatus 常量)
/// </summary>
public string Status { get; set; } = string.Empty;
/// <summary>
/// 处理结果描述
/// </summary>
public string? ResultMessage { get; set; }
/// <summary>
/// 更新重试次数(可选)
/// </summary>
public int? RetryCount { get; set; }
/// <summary>
/// 下次计划执行时间(用于退避重试,可选)
/// </summary>
public DateTime? ScheduledAt { get; set; }
}