优化代码
This commit is contained in:
parent
940889cdf5
commit
e7f0d44e86
@ -85,9 +85,7 @@ public class AuthTokenImpl extends HttpServlet implements AuthToken {
|
||||
Console.log("Refresh_token:==>" + refresh_token);
|
||||
config.setAccesstoken(access_token);
|
||||
config.setRefreshtoken(refresh_token);
|
||||
context.setAttribute("access_token", access_token);
|
||||
context.setAttribute("refresh_token", refresh_token);
|
||||
|
||||
context.setAttribute("OnedriveConfig", config);
|
||||
saveConfig.saveOnedriveConfig(config);
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,14 @@
|
||||
package com.dnslin.onemanager.task;/**
|
||||
* @author: DnsLin
|
||||
* @Title: TimeToRefresh
|
||||
* @ProjectName: Onemanager-java
|
||||
* @Description:
|
||||
* @date: 2021/10/30 0:12
|
||||
*/
|
||||
package com.dnslin.onemanager.task;
|
||||
|
||||
import com.dnslin.onemanager.logic.AuthToken;
|
||||
import com.dnslin.onemanager.pojo.Onedriveconfig;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
|
||||
/**
|
||||
* @author: DnsLin
|
||||
* @Title: TimeToRefresh
|
||||
@ -19,14 +17,17 @@ import org.springframework.stereotype.Component;
|
||||
* @date: 2021/10/30 0:12
|
||||
*/
|
||||
@Component
|
||||
public class TimeToRefresh {
|
||||
public class TimeToRefresh extends HttpServlet {
|
||||
|
||||
@Autowired
|
||||
private AuthToken authToken;
|
||||
|
||||
private final ServletContext context = this.getServletContext();
|
||||
|
||||
@Scheduled(fixedRate = 1000 * 60 * 29, initialDelay = 1000 * 290)
|
||||
public void runGetToken(){
|
||||
// authToken.getRefreshToken(clientId,redirectUri,clientSecret);
|
||||
public void runGetToken() {
|
||||
Onedriveconfig config = (Onedriveconfig) context.getAttribute("OnedriveConfig");
|
||||
authToken.getRefreshToken(config);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user