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