|
|
@@ -6,6 +6,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
+import top.husj.husj_wx.properties.EmailProperties;
|
|
|
import top.husj.husj_wx.properties.WeChatProperties;
|
|
|
import top.husj.husj_wx.utils.AccessTokenUtil;
|
|
|
import top.husj.husj_wx.utils.EmailUtil;
|
|
|
@@ -17,6 +18,8 @@ public class AccessTokenService {
|
|
|
private RestTemplate restTemplate;
|
|
|
@Autowired
|
|
|
private WeChatProperties weChatProperties;
|
|
|
+ @Autowired
|
|
|
+ private EmailProperties emailProperties;
|
|
|
|
|
|
/**
|
|
|
* 刷新access_token的核心逻辑
|
|
|
@@ -43,12 +46,13 @@ public class AccessTokenService {
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
log.error("获取access_token时发生异常: ", e);
|
|
|
- String host = "smtp.030208.xyz";
|
|
|
- String port = "465";
|
|
|
- String username = "husj@030208.xyz";
|
|
|
- String password = "15629747218hsjH";
|
|
|
- EmailUtil emailUtil = new EmailUtil(host, port, username, password);
|
|
|
- emailUtil.sendTextEmail("807244836@qq.com", "微信公众号token获取失败请检查", "微信公众号token获取失败请检查");
|
|
|
+ EmailUtil emailUtil = new EmailUtil(
|
|
|
+ emailProperties.getHost(),
|
|
|
+ emailProperties.getPort(),
|
|
|
+ emailProperties.getUsername(),
|
|
|
+ emailProperties.getPassword()
|
|
|
+ );
|
|
|
+ emailUtil.sendTextEmail(emailProperties.getNotifyTo(), "微信公众号token获取失败请检查", "微信公众号token获取失败请检查");
|
|
|
}
|
|
|
}
|
|
|
|