Commit a3b2485f authored by hezhen's avatar hezhen

123

parent 5c1417a8
......@@ -8,16 +8,16 @@ package com.xxfc.platform.summit.model;
import java.io.Serializable;
import java.util.Map;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
/**
* 封装 access_token
*/
@Data
public class AccessToken implements Serializable {
private static final long serialVersionUID = -822464425433824314L;
......@@ -72,6 +72,18 @@ public class AccessToken implements Serializable {
return access_token != null;
}
public void setAccess_token(String access_token) {
this.access_token = access_token;
}
public void setExpires_in(Integer expires_in) {
this.expires_in = expires_in;
}
public void setExpiredTime(Long expiredTime) {
this.expiredTime = expiredTime;
}
public void setJson(String json) {
this.json = json;
......@@ -82,6 +94,17 @@ public class AccessToken implements Serializable {
return number == null ? null : number.intValue();
}
public String getAccessToken() {
return access_token;
}
public Integer getExpiresIn() {
return expires_in;
}
public Long getExpiredTime() {
return expiredTime;
}
}
......@@ -79,7 +79,7 @@ public class AccessTokenService {
* @return String accessToken
*/
public String getAccessTokenStr() {
return getAccessToken().getAccess_token();
return getAccessToken().getAccessToken();
}
/**
......@@ -92,7 +92,6 @@ public class AccessTokenService {
String json = HttpRequestUtil.httpGet(url+"&appid="+wy_appid+"&secret="+wy_secret);
log.info("---json===="+json);
result = new AccessToken(json);
log.info("---result===="+result.toString());
if (result.isAvailable())
break;
}
......@@ -101,7 +100,7 @@ public class AccessTokenService {
obj.put(wy_appid, result);
Boolean suc=summbitRedisTemplate.opsForValue().setIfAbsent(wy_appid, obj.toJSONString());
if (suc) {
summbitRedisTemplate.expire(wy_appid, result.getExpires_in(), TimeUnit.MINUTES);
summbitRedisTemplate.expire(wy_appid, result.getExpiresIn(), TimeUnit.MINUTES);
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment