schedule.php 773 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /**
  3. * @var \omnilight\scheduling\Schedule $schedule
  4. */
  5. $path = Yii::getAlias('@runtime') . '/logs/';
  6. /**
  7. * 清理过期的微信历史消息记录
  8. *
  9. * 每天凌晨执行一次
  10. */
  11. $filePath = $path . 'msgHistory.log';
  12. $schedule->command('wechat/msg-history/index')->cron('0 0 * * *')->sendOutputTo($filePath);
  13. /**
  14. * 定时群发微信消息
  15. *
  16. * 每分钟执行一次
  17. */
  18. $filePath = $path . 'sendMessage.log';
  19. $schedule->command('wechat/send-message/index')->cron('* * * * *')->sendOutputTo($filePath);
  20. /**
  21. * 重启ws
  22. *
  23. * 每天凌晨执行一次
  24. */
  25. $filePath = $path . 'websocket.log';
  26. $schedule->command('websocket/stop')->cron('0 0 * * *')->sendOutputTo($filePath);
  27. $schedule->command('websocket/start')->cron('1 0 * * *')->sendOutputTo($filePath);
粤ICP备19079148号