UpgradeDaily.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. namespace App\Console\Commands;
  3. use Illuminate\Console\Command;
  4. use Illuminate\Support\Carbon;
  5. use Illuminate\Support\Facades\Http;
  6. class UpgradeDaily extends Command
  7. {
  8. /**
  9. * The name and signature of the console command.
  10. *
  11. * @var string
  12. */
  13. protected $signature = 'upgrade:daily';
  14. /**
  15. * The console command description.
  16. *
  17. * @var string
  18. */
  19. protected $description = '每天的任务';
  20. /**
  21. * Create a new command instance.
  22. *
  23. * @return void
  24. */
  25. public function __construct()
  26. {
  27. parent::__construct();
  28. }
  29. /**
  30. * Execute the console command.
  31. *
  32. * @return int
  33. */
  34. public function handle()
  35. {
  36. $start = time();
  37. # 刷巴利语句子uuid 仅调用一次
  38. //$this->call('upgrade:palitextid');
  39. //巴利原文段落库目录结构改变时运行
  40. $this->call('upgrade:palitext');
  41. #巴利段落标签
  42. $this->call('upgrade:palitexttag');
  43. #译文进度
  44. $this->call('upgrade:progress');
  45. $this->call('upgrade:progresschapter');
  46. # 段落更新图
  47. $this->call('upgrade:chapterdynamic');
  48. # 逐词译数据库分析
  49. $this->call('upgrade:wbwanalyses');
  50. $time = time()-$start;
  51. $url = "https://oapi.dingtalk.com/robot/send?access_token=34143dbec80a8fc09c1cb5897a5639ee3a9a32ecfe31835ad29bf7013bdb9fdf";
  52. $param = [
  53. "markdown"=> [
  54. "title"=> "后台任务",
  55. "text"=> " wikipali: 后台任务成功执行。用时{$time}",
  56. ],
  57. "msgtype"=>"markdown"
  58. ];
  59. $response = Http::post($url, $param);
  60. return 0;
  61. }
  62. }