|
@@ -43,13 +43,14 @@ public class WxGzhServiceImpl implements IWxGzhService {
|
|
|
Integer expiresIn;
|
|
|
if (redisTemplate.hasKey(Constants.GZH_MESSAGE_TOKEN)){
|
|
|
token = (String)redisTemplate.opsForValue().get(Constants.GZH_MESSAGE_TOKEN);
|
|
|
- }else if (StringUtils.isEmpty(token)){
|
|
|
+ }
|
|
|
+ if (StringUtils.isEmpty(token)){
|
|
|
String result = wxSendService.getAccessToken("client_credential",appid,secret);
|
|
|
JSONObject json = JSONObject.parseObject(result);
|
|
|
token = json.getString("access_token");
|
|
|
expiresIn = json.getIntValue("expires_in");
|
|
|
if (expiresIn <= 0){
|
|
|
- expiresIn = 1000;
|
|
|
+ expiresIn = 7000;
|
|
|
}
|
|
|
|
|
|
redisTemplate.opsForValue().set(Constants.GZH_MESSAGE_TOKEN,token,expiresIn, TimeUnit.SECONDS);
|