Commit 5d905504 by 孙喜旺

代码还原

1 parent 74078da5
...@@ -56,21 +56,20 @@ public class WeiXinAuthInterceptor implements Interceptor { ...@@ -56,21 +56,20 @@ public class WeiXinAuthInterceptor implements Interceptor {
private String findAccessToken(String openId){ private String findAccessToken(String openId){
//获取用户token //获取用户token
String accessToken =redisCache.getCacheObject(WeConstans.WX_AUTH_ACCESS_TOKEN+":"+ openId); WxTokenDto wxTokenDto = redisCache.getCacheObject(WeConstans.WX_AUTH_ACCESS_TOKEN + ":" + openId);
if (StringUtils.isEmpty(accessToken)){ if (wxTokenDto == null){
//当用户token失效,则获取refreshToken //当用户token失效,则获取refreshToken
String refreshToken = redisCache.getCacheObject(WeConstans.WX_AUTH_REFRESH_ACCESS_TOKEN + ":" + openId); String refreshToken = redisCache.getCacheObject(WeConstans.WX_AUTH_REFRESH_ACCESS_TOKEN + ":" + openId);
if(StringUtils.isEmpty(refreshToken)){ if(StringUtils.isEmpty(refreshToken)){
throw new WeComException(1001,"token失效,请重新授权"); throw new WeComException(1001,"token失效,请重新授权");
}else { }else {
WxTokenDto wxTokenDto = wxAuthClient.refreshToken(appId, secret, grantType, refreshToken); wxTokenDto = wxAuthClient.refreshToken(appId, grantType, refreshToken);
if(wxTokenDto != null && StringUtils.isNotEmpty(wxTokenDto.getAccessToken())){ if(wxTokenDto != null && StringUtils.isNotEmpty(wxTokenDto.getAccessToken())){
redisCache.setCacheObject(WeConstans.WX_AUTH_ACCESS_TOKEN+":"+ openId, wxTokenDto.getAccessToken(), wxTokenDto.getExpiresIn(), TimeUnit.SECONDS); redisCache.setCacheObject(WeConstans.WX_AUTH_ACCESS_TOKEN+":"+ openId, wxTokenDto, wxTokenDto.getExpiresIn(), TimeUnit.SECONDS);
accessToken = wxTokenDto.getAccessToken();
} }
} }
} }
return accessToken; return wxTokenDto.getAccessToken();
} }
......
...@@ -74,15 +74,15 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS ...@@ -74,15 +74,15 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void addWeCustomerMessagePush(CustomerMessagePushDto customerMessagePushDto) throws JsonProcessingException, ParseException { public void addWeCustomerMessagePush(CustomerMessagePushDto customerMessagePushDto) throws JsonProcessingException, ParseException {
// if ((null != customerMessagePushDto.getSettingTime() && !"".equals(customerMessagePushDto.getSettingTime())) if ((null != customerMessagePushDto.getSettingTime() && !"".equals(customerMessagePushDto.getSettingTime()))
// && DateUtils.diffTime(new Date(), DateUtil.parse(customerMessagePushDto.getSettingTime(), "yyyy-MM-dd HH:mm")) > 0) { && DateUtils.diffTime(new Date(), DateUtil.parse(customerMessagePushDto.getSettingTime(), "yyyy-MM-dd HH:mm")) > 0) {
// throw new WeComException("发送时间不能小于当前时间"); throw new WeComException("发送时间不能小于当前时间");
// } }
if(StrUtil.isBlank(customerMessagePushDto.getSettingTime())){ /*if(StrUtil.isBlank(customerMessagePushDto.getSettingTime())){
throw new WeComException("发送时间不能为空"); throw new WeComException("发送时间不能为空");
} }*/
List<WeCustomer> customers = Lists.newArrayList(); List<WeCustomer> customers = Lists.newArrayList();
......
...@@ -31,15 +31,13 @@ public interface WxAuthClient { ...@@ -31,15 +31,13 @@ public interface WxAuthClient {
/** /**
* 刷新access_token * 刷新access_token
* *
*
* @param id
* @param appId 公众号的唯一标识 * @param appId 公众号的唯一标识
* @param grantType 填写为refresh_token * @param grantType 填写为refresh_token
* @param refreshToken 填写通过access_token获取到的refresh_token参数 * @param refreshToken 填写通过access_token获取到的refresh_token参数
* @return * @return
*/ */
@Request(url = "/oauth2/refresh_token", type = "GET") @Request(url = "/oauth2/refresh_token", type = "GET")
WxTokenDto refreshToken(String id, @Query("appid") String appId, @Query("grant_type") String grantType, WxTokenDto refreshToken(@Query("appid") String appId, @Query("grant_type") String grantType,
@Query("refresh_token") String refreshToken); @Query("refresh_token") String refreshToken);
/** /**
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!