tao.mo

获取token频率调整为每次刷新获取

mt
2022年12月7日15:57:23
......@@ -23,7 +23,7 @@ import java.util.Date;
@Slf4j
public class VersionInterface {
//当前版本号
final String VERSION = "1.3";
final String VERSION = "1.4";
@ApiOperation(value = "获取当前API版本", httpMethod = "GET", notes = "ex: http://192.168.1.71:8080/version/version")
@GetMapping("/version")
......
......@@ -55,20 +55,18 @@ public class IClearApiTask {
}
}
/**
* 获取token
* 每次请求获取最新token
* @throws Exception
*/
private void getToken() throws Exception{
if(token == null){
try {
//获取token
TokenResult tokenResult = apiService.getToken();
if(tokenResult.getErrorcode().equals(Constants.ApiResponseKeys.SUCCESS)){
this.token = tokenResult.getData().getToken();
}
}catch(Exception ex){
log.error(ex.getMessage(),ex);
try {
//获取token
TokenResult tokenResult = apiService.getToken();
if(tokenResult.getErrorcode().equals(Constants.ApiResponseKeys.SUCCESS)){
this.token = tokenResult.getData().getToken();
}
}catch(Exception ex){
log.error(ex.getMessage(),ex);
}
if(this.token == null){
throw new Exception("获取token失败!");
......