|
@@ -0,0 +1,66 @@
|
|
|
+package com.sxtvs.open.api.odata.job;
|
|
|
+
|
|
|
+import com.sxtvs.open.api.odata.service.*;
|
|
|
+import org.apache.commons.lang3.SystemUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.scheduling.annotation.Scheduled;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+@Component
|
|
|
+public class RefreshTokenJob {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private DouyinAccountService douyinAccountService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ToutiaoAccountService toutiaoAccountService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private KuaishouAccountService kuaishouAccountService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private WxRestService wxRestService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private YoumeiTokenService youmeiTokenService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private BilibiliAccountService bilibiliAccountService;
|
|
|
+
|
|
|
+
|
|
|
+ @Scheduled(cron = "0 0 3 * * *")
|
|
|
+ public void refreshToutiao() {
|
|
|
+ toutiaoAccountService.refresh();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Scheduled(cron = "0 0 3 * * *")
|
|
|
+ public void refreshDouyin() {
|
|
|
+ douyinAccountService.refresh();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Scheduled(cron = "0 0 3 * * *")
|
|
|
+ public void refreshKuaiShou() {
|
|
|
+ kuaishouAccountService.refresh();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Scheduled(cron = "0 0 4 * * *")
|
|
|
+ public void refreshBilibili() {
|
|
|
+ bilibiliAccountService.refresh();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Scheduled(cron = "0 5 * * * *")
|
|
|
+ public void refreshYoumei() {
|
|
|
+ if (SystemUtils.IS_OS_LINUX) {
|
|
|
+ youmeiTokenService.refreshToken();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Scheduled(cron = "0 */5 * * * *")
|
|
|
+ public void refreshWeixinComponentToken() {
|
|
|
+ if (SystemUtils.IS_OS_LINUX) {
|
|
|
+ wxRestService.refreshComponentToken();
|
|
|
+ wxRestService.refreshAllAccessToken();
|
|
|
+ wxRestService.refreshJsTicket();
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|