tao.mo

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

mt
2022年12月7日15:57:23
...@@ -23,7 +23,7 @@ import java.util.Date; ...@@ -23,7 +23,7 @@ import java.util.Date;
23 @Slf4j 23 @Slf4j
24 public class VersionInterface { 24 public class VersionInterface {
25 //当前版本号 25 //当前版本号
26 - final String VERSION = "1.3"; 26 + final String VERSION = "1.4";
27 27
28 @ApiOperation(value = "获取当前API版本", httpMethod = "GET", notes = "ex: http://192.168.1.71:8080/version/version") 28 @ApiOperation(value = "获取当前API版本", httpMethod = "GET", notes = "ex: http://192.168.1.71:8080/version/version")
29 @GetMapping("/version") 29 @GetMapping("/version")
......
...@@ -55,20 +55,18 @@ public class IClearApiTask { ...@@ -55,20 +55,18 @@ public class IClearApiTask {
55 } 55 }
56 } 56 }
57 /** 57 /**
58 - * 获取token 58 + * 每次请求获取最新token
59 * @throws Exception 59 * @throws Exception
60 */ 60 */
61 private void getToken() throws Exception{ 61 private void getToken() throws Exception{
62 - if(token == null){ 62 + try {
63 - try { 63 + //获取token
64 - //获取token 64 + TokenResult tokenResult = apiService.getToken();
65 - TokenResult tokenResult = apiService.getToken(); 65 + if(tokenResult.getErrorcode().equals(Constants.ApiResponseKeys.SUCCESS)){
66 - if(tokenResult.getErrorcode().equals(Constants.ApiResponseKeys.SUCCESS)){ 66 + this.token = tokenResult.getData().getToken();
67 - this.token = tokenResult.getData().getToken();
68 - }
69 - }catch(Exception ex){
70 - log.error(ex.getMessage(),ex);
71 } 67 }
68 + }catch(Exception ex){
69 + log.error(ex.getMessage(),ex);
72 } 70 }
73 if(this.token == null){ 71 if(this.token == null){
74 throw new Exception("获取token失败!"); 72 throw new Exception("获取token失败!");
......