|
|
|
@ -1,6 +1,7 @@
@@ -1,6 +1,7 @@
|
|
|
|
|
package vip.xumy.idle.server.worker; |
|
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
|
import org.springframework.scheduling.annotation.EnableScheduling; |
|
|
|
|
import org.springframework.scheduling.annotation.Scheduled; |
|
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
@ -22,6 +23,8 @@ import vip.xumy.idle.server.service.WebSocketService;
@@ -22,6 +23,8 @@ import vip.xumy.idle.server.service.WebSocketService;
|
|
|
|
|
public class ActivityCountWorker { |
|
|
|
|
@Autowired |
|
|
|
|
private IActivityCountMapper countMapper; |
|
|
|
|
@Value("${server.name}") |
|
|
|
|
private String server; |
|
|
|
|
|
|
|
|
|
@Scheduled(cron = "0 * * * * ?") |
|
|
|
|
public void aliveCount() { |
|
|
|
@ -29,6 +32,7 @@ public class ActivityCountWorker {
@@ -29,6 +32,7 @@ public class ActivityCountWorker {
|
|
|
|
|
count.setTime(DateUtil.format()); |
|
|
|
|
count.setNum(WebSocketService.CLIENT_MAP.keySet().size()); |
|
|
|
|
count.setType("A"); |
|
|
|
|
count.setServer(server); |
|
|
|
|
countMapper.insert(count); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|