|
@@ -21,6 +21,8 @@ import java.io.IOException;
|
|
|
@Slf4j
|
|
@Slf4j
|
|
|
@Service
|
|
@Service
|
|
|
public class WechatService {
|
|
public class WechatService {
|
|
|
|
|
+
|
|
|
|
|
+ private static final String REDIS_REQUEST_ACCESS_TOKEN_LOCK_KEY = "REDIS-requestAccessToken-lock";
|
|
|
@Resource
|
|
@Resource
|
|
|
private StringRedisTemplate stringRedisTemplate;
|
|
private StringRedisTemplate stringRedisTemplate;
|
|
|
|
|
|
|
@@ -28,7 +30,7 @@ public class WechatService {
|
|
|
if(retry > 3){
|
|
if(retry > 3){
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
- Long flag = stringRedisTemplate.boundValueOps("REDIS-requestAccessToken-lock").increment(1L);
|
|
|
|
|
|
|
+ Long flag = stringRedisTemplate.boundValueOps(REDIS_REQUEST_ACCESS_TOKEN_LOCK_KEY).increment(1L);
|
|
|
if(null != flag && flag == 1L){
|
|
if(null != flag && flag == 1L){
|
|
|
try{
|
|
try{
|
|
|
HttpUriRequest request = RequestBuilder.get("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + programConfigEnum.getAppId() + "&secret=" + programConfigEnum.getSecret()).build();
|
|
HttpUriRequest request = RequestBuilder.get("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + programConfigEnum.getAppId() + "&secret=" + programConfigEnum.getSecret()).build();
|