GreenTask.php 514 B

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