Pārlūkot izejas kodu

fix : 定时器判断测试环境不启动

bilingfeng 1 gadu atpakaļ
vecāks
revīzija
8f2886ee75

+ 10 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/task/PayApplicationTask.java

@@ -5,6 +5,7 @@ import com.zanxiang.game.module.manage.service.IAppletCheckService;
 import com.zanxiang.module.redis.service.IDistributedLockComponent;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
@@ -26,11 +27,20 @@ public class PayApplicationTask {
     @Autowired
     private IAppletCheckService appletCheckService;
 
+    /**
+     * 服务器域名
+     */
+    @Value("${server.domain}")
+    private String serverUrl;
+
     /**
      * 小程序每10分钟检查
      */
     @Scheduled(cron = "0 0/10 * * * ?")
     public void payApplicationCheck() {
+        if (this.serverUrl.contains("test")) {
+            return;
+        }
         //上锁
         if (!distributedLockComponent.doLock(RedisKeyConstant.PAY_APP_CHECK_LOCK, 0L, 15L, TimeUnit.MINUTES)) {
             return;