暂存一下,防止丢失

This commit is contained in:
2026-07-24 16:07:18 +08:00
parent 5d6e23f1a5
commit a18ed8bc8d
180 changed files with 13597 additions and 1986 deletions

View File

@@ -474,6 +474,36 @@ func RedisPollingRealnameReversalCountKey(cardID uint) string {
return fmt.Sprintf("polling:card:realname:reversal:%d", cardID)
}
// RedisCardObservationSeriesKey 返回同场景观测序列合并键。
func RedisCardObservationSeriesKey(scene, resourceType, resourceID, syncType string) string {
return fmt.Sprintf("cardsync:series:%s:%s:%s:%s", scene, resourceType, resourceID, syncType)
}
// RedisCardObservationSeriesIndexKey 返回同资源、同步类型的活跃序列索引键。
func RedisCardObservationSeriesIndexKey(resourceType, resourceID, syncType string) string {
return fmt.Sprintf("cardsync:series:index:%s:%s:%s", resourceType, resourceID, syncType)
}
// RedisCardObservationSeriesCompletedKey 返回序列提前完成标记键。
func RedisCardObservationSeriesCompletedKey(seriesID string) string {
return fmt.Sprintf("cardsync:series:completed:%s", seriesID)
}
// RedisCardObservationAttemptKey 返回 series_id + attempt 幂等键。
func RedisCardObservationAttemptKey(seriesID string, attempt int) string {
return fmt.Sprintf("cardsync:attempt:%s:%d", seriesID, attempt)
}
// RedisCardObservationInflightKey 返回一次实际 Gateway 请求的互斥键。
func RedisCardObservationInflightKey(provider, syncType, resourceID string) string {
return fmt.Sprintf("cardsync:inflight:%s:%s:%s", provider, syncType, resourceID)
}
// RedisCardObservationLastRequestKey 返回运营商接入与同步类型的最近请求时间键。
func RedisCardObservationLastRequestKey(provider, syncType, resourceID string) string {
return fmt.Sprintf("cardsync:last_request:%s:%s:%s", provider, syncType, resourceID)
}
// RedisPollingDeviceOpLockKey 设备维度停复机操作锁 Key
// 防止设备下多张卡并发触发 EvaluateAndAct 导致重复 Gateway 调用
// TTL 建议 30 秒(覆盖 stopDeviceCards/resumeDeviceCards 最长执行时间)