NoGd.php 950 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace app\common\command;
  3. use app\service\mobile_get\Gdian;
  4. use think\console\Command;
  5. use think\console\Input;
  6. use think\console\Output;
  7. class NoGd extends Command{
  8. protected function configure()
  9. {
  10. $this->setName('no:gd')->setDescription('广电同步号码');
  11. }
  12. protected function execute(Input $input, Output $output)
  13. {
  14. $name='command:'.$this->getName();
  15. try {
  16. $has=redis()->get($name);
  17. if($has){
  18. return;
  19. }
  20. redis()->set($name,time());
  21. $class=new Gdian();
  22. $class->fetchNo();
  23. }catch (\Exception $e){
  24. $output->error($e->getMessage());
  25. user_log('NoGd',[
  26. 'e'=>$e->getMessage(),
  27. 'file'=>$e->getFile(),
  28. 'line'=>$e->getLine(),
  29. 'trace'=>$e->getTrace(),
  30. ]);
  31. }
  32. redis()->del($name);
  33. }
  34. }