UpgradeWeekly.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. namespace App\Console\Commands;
  3. use App\Tools\Tools;
  4. use Illuminate\Console\Command;
  5. class UpgradeWeekly extends Command
  6. {
  7. /**
  8. * The name and signature of the console command.
  9. *
  10. * @var string
  11. */
  12. protected $signature = 'upgrade:weekly';
  13. /**
  14. * The console command description.
  15. *
  16. * @var string
  17. */
  18. protected $description = '周更';
  19. /**
  20. * Create a new command instance.
  21. *
  22. * @return void
  23. */
  24. public function __construct()
  25. {
  26. parent::__construct();
  27. }
  28. /**
  29. * Execute the console command.
  30. *
  31. * @return int
  32. */
  33. public function handle()
  34. {
  35. if (Tools::isStop()) {
  36. return 0;
  37. }
  38. $currTime = time();
  39. // 译文进度
  40. $this->call('upgrade:progress');
  41. $time = time() - $currTime;
  42. $message = "progress time:{$time}; ";
  43. $this->info($message);
  44. $currTime = time();
  45. $this->call('upgrade:progress.chapter');
  46. $time = time() - $currTime;
  47. $message = "progress.chapter time:{$time}; ";
  48. $this->info($message);
  49. $currTime = time();
  50. // 逐词译数据库分析
  51. $this->call('upgrade:wbw.analyses');
  52. $time = time() - $currTime;
  53. $message = "wbw.analyses:{$time}; ";
  54. $this->info($message);
  55. // 段落更新图
  56. $this->call('upgrade:chapter.dynamic');
  57. $this->call('upgrade:chapter.dynamic.weekly');
  58. return 0;
  59. }
  60. }