feat: 新增数据库迁移,重命名 device_no 为 virtual_no,新增 iot_card.virtual_no 和 package.virtual_ratio 字段
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m3s

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

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-03-14 18:27:28 +08:00
parent b5147d1acb
commit b9c3875c08
77 changed files with 5832 additions and 2393 deletions

View File

@@ -285,3 +285,31 @@ func RedisOrderIdempotencyKey(businessKey string) string {
func RedisOrderCreateLockKey(carrierType string, carrierID uint) string {
return fmt.Sprintf("order:create:lock:%s:%d", carrierType, carrierID)
}
// ========================================
// 设备保护期相关 Redis Key
// ========================================
// RedisDeviceProtectKey 生成设备保护期 Redis 键
// action: "stop"(停机保护期)或 "start"(复机保护期),两者互斥
// 过期时间DeviceProtectPeriodDuration1 小时)
func RedisDeviceProtectKey(deviceID uint, action string) string {
return fmt.Sprintf("protect:device:%d:%s", deviceID, action)
}
// RedisDeviceRefreshCooldownKey 生成设备刷新冷却期 Redis 键
// 用途:防止同一设备短时间内多次调网关刷新(限频)
// 过期时间DeviceRefreshCooldownDuration30 秒)
func RedisDeviceRefreshCooldownKey(deviceID uint) string {
return fmt.Sprintf("refresh:cooldown:device:%d", deviceID)
}
// ========================================
// 轮询保护期队列 Redis Key
// ========================================
// RedisPollingQueueProtectKey 保护期一致性检查轮询队列键
// 用途:存储需要进行保护期一致性检查的卡 IDZSet按时间排序
func RedisPollingQueueProtectKey() string {
return "polling:queue:protect"
}