TemperatureDevice.php 558 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace app\cron;
  3. use app\common\util\AppMsg;
  4. use app\temperature\controller\Push;
  5. use think\Db;
  6. use yunwuxin\cron\Task;
  7. class TemperatureDevice extends Task
  8. {
  9. public function configure()
  10. {
  11. $this->everyMinute(); //每分钟执行一次
  12. }
  13. /**
  14. * 执行任务
  15. * @return mixed
  16. */
  17. protected function execute()
  18. {
  19. try{
  20. $tem = new Push();
  21. $tem->getDeviceData();
  22. $tem->clearData();
  23. }catch (\Exception $e){
  24. trace($e->getMessage());
  25. }
  26. }
  27. }