涩图模块:修复每日统计没效果

This commit is contained in:
Yutousama 2022-04-22 00:32:28 +08:00
parent 3dac0288f3
commit 61feb23f16
2 changed files with 5 additions and 4 deletions

View File

@ -79,7 +79,7 @@ public abstract class Model implements ModelInterface {
} }
} }
public void onTime(Long qq,String time) { public synchronized void onTime(Long qq,String time) {
} }
public static StringBuilder getCommands(Class<?> commands) { public static StringBuilder getCommands(Class<?> commands) {

View File

@ -18,9 +18,9 @@ import java.util.TimerTask;
public class ApplicationInit implements ApplicationRunner { public class ApplicationInit implements ApplicationRunner {
@Override @Override
public void run(ApplicationArguments args) throws Exception { public void run(ApplicationArguments args) throws Exception {
Log.i("ApplicationInit run");
new Timer().schedule(new TimerTask() { new Timer().schedule(new TimerTask() {
private String oldTime = ""; private String oldTime = "";
@Override @Override
public void run() { public void run() {
try { try {
@ -29,14 +29,15 @@ public class ApplicationInit implements ApplicationRunner {
return; return;
} }
oldTime = time; oldTime = time;
Log.i("ApplicationInit run > "+oldTime );
for (Class<?> model : Model.classList) { for (Class<?> model : Model.classList) {
new Thread(() -> { new Thread(() -> {
try { try {
Bot bot = QQBotManager.getInstance().getBot(); Bot bot = QQBotManager.getInstance().getBot();
Model useModel = (Model) model.getDeclaredConstructor().newInstance(); Model useModel = (Model) model.getDeclaredConstructor().newInstance();
for (Group group : bot.getGroups()) { for (Group group : bot.getGroups()) {
if(QQNumberManager.getManager().isUseModel(group.getId(),model)){ if (QQNumberManager.getManager().isUseModel(group.getId(), model)) {
useModel.onTime(group.getId(),time); useModel.onTime(group.getId(), time);
} }
} }
} catch (Exception e) { } catch (Exception e) {