|
@@ -0,0 +1,42 @@
|
|
|
+package com.miaxis.job;
|
|
|
+
|
|
|
+import com.miaxis.common.core.domain.entity.SysDictData;
|
|
|
+import com.miaxis.system.service.ISysDictDataService;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.scheduling.annotation.Scheduled;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+@Slf4j
|
|
|
+@Component
|
|
|
+public class AppAdJob {
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ISysDictDataService dictDataService;
|
|
|
+
|
|
|
+ @Scheduled(cron = "0 0 23 * * ?")
|
|
|
+ public void openAd() {
|
|
|
+ log.info("--------打开广告!~---------------");
|
|
|
+ SysDictData splashAd = dictDataService.selectDictDataById(104l);
|
|
|
+ SysDictData nativeAd = dictDataService.selectDictDataById(105l);
|
|
|
+ splashAd.setDictValue("1");
|
|
|
+ nativeAd.setDictValue("1");
|
|
|
+ dictDataService.updateDictData(splashAd);
|
|
|
+ dictDataService.updateDictData(nativeAd);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Scheduled(cron = "0 0 6 * * ?")
|
|
|
+ public void closeAd() {
|
|
|
+ log.info("--------关闭广告!~---------------");
|
|
|
+ SysDictData splashAd = dictDataService.selectDictDataById(104l);
|
|
|
+ SysDictData nativeAd = dictDataService.selectDictDataById(105l);
|
|
|
+ splashAd.setDictValue("0");
|
|
|
+ nativeAd.setDictValue("0");
|
|
|
+ dictDataService.updateDictData(splashAd);
|
|
|
+ dictDataService.updateDictData(nativeAd);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+}
|