diff --git a/pkg/constants/iot.go b/pkg/constants/iot.go index 5fecc0d..3c83358 100644 --- a/pkg/constants/iot.go +++ b/pkg/constants/iot.go @@ -59,6 +59,7 @@ const ( StopReasonTrafficExhausted = "traffic_exhausted" // 流量耗尽 StopReasonManual = "manual" // 手动停机 StopReasonArrears = "arrears" // 欠费 + StopReasonProtectPeriod = "protect_period" // 保护期一致性检查自动停机 ) // 套餐流量类型 diff --git a/pkg/constants/redis.go b/pkg/constants/redis.go index cb77cd4..f90a6ef 100644 --- a/pkg/constants/redis.go +++ b/pkg/constants/redis.go @@ -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) +} + // ======================================== // 套餐激活锁相关键 // ========================================