|
@@ -61,12 +61,20 @@ public class GetWeChatAccessTokenTask {
|
|
|
return ResultVoUtil.success(token);
|
|
|
}
|
|
|
|
|
|
+ @PassToken
|
|
|
+ @GetMapping("/refreshToken")
|
|
|
+ public ResultVo<String> refreshToken() {
|
|
|
+ getAccessToken();
|
|
|
+ return ResultVoUtil.success();
|
|
|
+ }
|
|
|
+
|
|
|
@Scheduled(fixedRate = 3580 * 1000)
|
|
|
public void getAccessToken() {
|
|
|
if (canScheduleRun && production) {
|
|
|
RestTemplate restTemplate = new RestTemplate();
|
|
|
String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&" +
|
|
|
- "appid=" + PropertiesUtil.getLocalProperty("appId") +"&secret=" + PropertiesUtil.getLocalProperty("appSecret");
|
|
|
+ "appid=" + PropertiesUtil.getLocalProperty("appId") +
|
|
|
+ "&secret=" + PropertiesUtil.getLocalProperty("appSecret");
|
|
|
String httpRes = restTemplate.getForObject(url, String.class);
|
|
|
JSONObject json = JSONObject.parseObject(httpRes);
|
|
|
String token = json.getString("access_token");
|