GameActive.php 691 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace app\process\dataReport;
  3. use app\v1\logic\tool\GameActiveDayLogic;
  4. use Workerman\Crontab\Crontab;
  5. /**
  6. * 游戏活跃统计
  7. */
  8. class GameActive
  9. {
  10. public function onWorkerStart(): void
  11. {
  12. // 每2小时执行一次
  13. new Crontab('20 */2 * * *', function() {
  14. (new GameActiveDayLogic())->run();
  15. });
  16. }
  17. // {"type":"day","date":["2025-06-25","2025-06-26"]}
  18. public function run($args)
  19. {
  20. $params = $args ? json_decode($args, true) : [];
  21. if(!empty($params["type"]) && $params["type"] == "day"){
  22. return (new GameActiveDayLogic())->run($params);
  23. }
  24. return "无执行内容";
  25. }
  26. }