修复卡轮训的问题
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 10m14s

This commit is contained in:
2026-04-26 12:41:16 +08:00
parent 7efcea2b54
commit a887f91686
5 changed files with 34 additions and 8 deletions

View File

@@ -46,6 +46,14 @@ func (b *PollingBase) updateCardCache(ctx context.Context, cardID uint, updates
}
}
// invalidateCardCache 删除轮询卡缓存,确保后续从数据库重建
func (b *PollingBase) invalidateCardCache(ctx context.Context, cardID uint) {
key := constants.RedisPollingCardInfoKey(cardID)
if err := b.redis.Del(ctx, key).Err(); err != nil {
b.logger.Warn("删除卡缓存失败", zap.Uint("card_id", cardID), zap.Error(err))
}
}
// parseCardFromCache 从 Redis Hash 反序列化卡信息
func parseCardFromCache(cardID uint, result map[string]string) *model.IotCard {
card := &model.IotCard{}