From 5274e48fdb951e007b3ffdb1e4a9fcfe84b7c72c Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Thu, 29 Sep 2022 17:57:08 +0800 Subject: [PATCH] 20220902 --- 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