Files
TakeoutSaaS.AdminApi/src/Modules/TakeoutSaaS.Module.Scheduler/Options/SubscriptionAutomationOptions.cs
MSuMshk 98f49ea7ad feat: 实现订阅自动化定时任务系统
新增定时任务 (Scheduler Module):
- SubscriptionAutoRenewalJob: 自动续费账单生成
- SubscriptionRenewalReminderJob: 续费提醒发送 (7/3/1天)
- SubscriptionExpiryCheckJob: 到期检查与宽限期处理

新增 Command/Handler:
- ProcessAutoRenewalCommand: 处理自动续费逻辑
- ProcessRenewalRemindersCommand: 处理续费提醒逻辑
- ProcessSubscriptionExpiryCommand: 处理订阅到期逻辑

配置项 (SubscriptionAutomationOptions):
- AutoRenewalDaysBeforeExpiry: 到期前N天生成续费账单
- ReminderDaysBeforeExpiry: 提醒天数数组
- GracePeriodDays: 宽限期天数
- 各任务执行小时配置

Repository 增强:
- ISubscriptionRepository: 新增自动化查询方法
- ITenantBillingRepository: 新增账单创建方法
- ITenantNotificationRepository: 新增通知创建方法

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-17 21:06:01 +08:00

47 lines
1.3 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.
using System.ComponentModel.DataAnnotations;
namespace TakeoutSaaS.Module.Scheduler.Options;
/// <summary>
/// 订阅自动化相关配置(续费提醒、自动续费、宽限期处理)。
/// </summary>
public sealed class SubscriptionAutomationOptions
{
/// <summary>
/// 自动续费任务执行小时UTC
/// </summary>
[Range(0, 23)]
public int AutoRenewalExecuteHourUtc { get; set; } = 1;
/// <summary>
/// 自动续费:到期前 N 天生成续费账单。
/// </summary>
[Range(0, 365)]
public int AutoRenewalDaysBeforeExpiry { get; set; } = 3;
/// <summary>
/// 续费提醒任务执行小时UTC
/// </summary>
[Range(0, 23)]
public int RenewalReminderExecuteHourUtc { get; set; } = 10;
/// <summary>
/// 续费提醒:到期前 N 天发送提醒。
/// </summary>
[MinLength(1)]
public int[] ReminderDaysBeforeExpiry { get; set; } = [7, 3, 1];
/// <summary>
/// 订阅到期检查任务执行小时UTC
/// </summary>
[Range(0, 23)]
public int SubscriptionExpiryCheckExecuteHourUtc { get; set; } = 2;
/// <summary>
/// 宽限期天数。
/// </summary>
[Range(0, 365)]
public int GracePeriodDays { get; set; } = 7;
}