|
@@ -230,20 +230,20 @@ public class WeChatService {
|
|
|
* @return access_token
|
|
|
*/
|
|
|
public String getAccessToken() throws Exception {
|
|
|
- String access_token = String.valueOf(redisService.get("access_token:"+crmAppId));
|
|
|
- // 过期后会得到"null"值,所以需判断字符串"null"
|
|
|
- if (access_token != null && access_token.length() != 0 && !"null".equals(access_token)) {
|
|
|
- return access_token;
|
|
|
- }
|
|
|
+// String access_token = String.valueOf(redisService.get("access_token:"+crmAppId));
|
|
|
+// // 过期后会得到"null"值,所以需判断字符串"null"
|
|
|
+// if (access_token != null && access_token.length() != 0 && !"null".equals(access_token)) {
|
|
|
+// return access_token;
|
|
|
+// }
|
|
|
String link = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET";
|
|
|
link = link.replace("APPID", crmAppId);
|
|
|
link = link.replace("APPSECRET", crmAppSecret);
|
|
|
String result = RequestUtil.sendGet(link);
|
|
|
log.info("微信公众号获取access_token>>>" + result);
|
|
|
Map<String, Object> map = JSONObject.parseObject(result, Map.class);
|
|
|
- access_token = (String) map.get("access_token");
|
|
|
- // 将token存入redis, access_token的有效期目前为2个小时(redis存1.5小时)
|
|
|
- redisService.set("access_token:"+crmAppId, access_token, 5400L);
|
|
|
+ String access_token = (String) map.get("access_token");
|
|
|
+// // 将token存入redis, access_token的有效期目前为2个小时(redis存1.5小时)
|
|
|
+// redisService.set("access_token:"+crmAppId, access_token, 5400L);
|
|
|
return access_token;
|
|
|
}
|
|
|
|