GreenTask.php 500 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace app\cron;
  3. use yunwuxin\cron\Task;
  4. //近12个小时的绿化养护任务加入到任务栏
  5. class GreenTask extends Task
  6. {
  7. public function configure()
  8. {
  9. $this->everyMinute(); //每分钟执行一次
  10. }
  11. /**
  12. * 执行任务
  13. * @return mixed
  14. */
  15. protected function execute()
  16. {
  17. try{
  18. (new \app\common\model\GreenTask())->addGreenTask();
  19. }catch (\Exception $e){
  20. trace($e->getMessage());
  21. }
  22. }
  23. }