Prechádzať zdrojové kódy

优化一下 redis设置的过期时间

三七 1 deň pred
rodič
commit
2072e7d6ad

+ 4 - 2
fs-service/src/main/java/com/fs/qw/service/impl/QwExternalContactServiceImpl.java

@@ -2480,8 +2480,10 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
                                         currentCount = 1L;
                                     }
 
-                                    long expireSeconds = getSecondsUntilMidnight();
-                                    redisTemplate.expire(cacheKey, expireSeconds, java.util.concurrent.TimeUnit.SECONDS);
+                                    if (currentCount==1L){
+                                        long expireSeconds = getSecondsUntilMidnight();
+                                        redisTemplate.expire(cacheKey, expireSeconds, java.util.concurrent.TimeUnit.SECONDS);
+                                    }
 
                                     if (currentCount >= limitCount) {
                                         log.error("用户{}已达到每日添加上限{}/{}", userID, currentCount, limitCount);