|
@@ -83,7 +83,7 @@ public class WxGzhServiceImpl implements IWxGzhService {
|
|
|
if (redisTemplate.hasKey(Constants.GZH_MESSAGE_TOKEN)){
|
|
|
token = (String)redisTemplate.opsForValue().get(Constants.GZH_MESSAGE_TOKEN);
|
|
|
}
|
|
|
- if (StringUtils.isEmpty(token)){
|
|
|
+ if (StringUtils.isEmpty(token)|| notEffect(token)){
|
|
|
String result = wxSendService.getAccessToken("client_credential",appid,secret);
|
|
|
JSONObject json = JSONObject.parseObject(result);
|
|
|
token = json.getString("access_token");
|
|
@@ -99,6 +99,13 @@ public class WxGzhServiceImpl implements IWxGzhService {
|
|
|
return token;
|
|
|
}
|
|
|
|
|
|
+ //判定是否失效
|
|
|
+ private boolean notEffect(String token) {
|
|
|
+ String res = wxSendService.userInfo( token, "ovKTX5-FKLF6_sgTtCIXpG_lz3PY", "zh_CN");
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(res);
|
|
|
+ return jsonObject.getString("unionid") ==null;
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
|
|
|
/**
|