CleanTask.php 622 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace app\cron;
  3. use yunwuxin\cron\Task;
  4. class CleanTask extends Task
  5. {
  6. public function configure()
  7. {
  8. $this->everyMinute(); //每分钟执行一次
  9. }
  10. /**
  11. * 执行任务
  12. * @return mixed
  13. */
  14. protected function execute()
  15. {
  16. try{
  17. $this->cleantask();
  18. }catch (\Exception $e){
  19. trace($e->getMessage());
  20. }
  21. }
  22. //处理已超时的专项保洁任务
  23. public function cleantask(){
  24. set_time_limit(0);
  25. ini_set("memory_limit","1024M");
  26. (new \app\common\model\CleanTask())->timer_action();
  27. }
  28. }