From ba17eded418c7eb1a14cdcd16a4d60619da8db73 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Fri, 23 Sep 2022 19:28:11 +0800
Subject: [PATCH] fix

---
 src/main/java/cc/mrbird/febs/mall/quartz/WxxcxJob.java |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/mall/quartz/WxxcxJob.java b/src/main/java/cc/mrbird/febs/mall/quartz/WxxcxJob.java
index 8c587d6..840d650 100644
--- a/src/main/java/cc/mrbird/febs/mall/quartz/WxxcxJob.java
+++ b/src/main/java/cc/mrbird/febs/mall/quartz/WxxcxJob.java
@@ -11,6 +11,7 @@
 import com.baomidou.mybatisplus.extension.exceptions.ApiException;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 import org.springframework.web.client.RestTemplate;
@@ -22,6 +23,7 @@
 
 @Slf4j
 @Component
+@ConditionalOnProperty(prefix = "system", name = "job", havingValue = "true")
 public class WxxcxJob {
 
     private final XcxProperties xcxProperties = SpringContextHolder.getBean(XcxProperties.class);
@@ -30,11 +32,13 @@
     private RedisUtils redisUtils;
     @Resource
     RestTemplate restTemplate;
+    @Autowired
+    private SpringContextHolder springContextHolder;
     /**
      * 获取access_token
      * 有效期两小时
      */
-    @Scheduled(cron = "0 0/5 * * * ? ")
+    @Scheduled(cron = "0 0 0/1 * * ? ")
     public void getAccessToken() throws IOException {
         String appId = xcxProperties.getXcxAppid();
         String appSecret = xcxProperties.getXcxSecret();

--
Gitblit v1.9.1