fix: 新增 StopReasonProtectPeriod 常量和 RedisCardResumeLockKey 函数

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-03-31 18:11:01 +08:00
parent ebc3e78ba9
commit 7f42d198eb
2 changed files with 12 additions and 0 deletions

View File

@@ -59,6 +59,7 @@ const (
StopReasonTrafficExhausted = "traffic_exhausted" // 流量耗尽
StopReasonManual = "manual" // 手动停机
StopReasonArrears = "arrears" // 欠费
StopReasonProtectPeriod = "protect_period" // 保护期一致性检查自动停机
)
// 套餐流量类型

View File

@@ -289,6 +289,17 @@ func RedisPollingInitProgressKey() string {
return "polling:init:progress"
}
// ========================================
// 复机并发保护相关 Redis Key
// ========================================
// RedisCardResumeLockKey 生成卡复机操作分布式锁的 Redis 键
// 用途:防止同一张卡并发触发多次 gateway.StartCard
// 过期时间30 秒
func RedisCardResumeLockKey(cardID uint) string {
return fmt.Sprintf("card:resume:lock:%d", cardID)
}
// ========================================
// 套餐激活锁相关键
// ========================================