UpgradeDaily.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?php
  2. namespace App\Console\Commands;
  3. use Illuminate\Console\Command;
  4. use Illuminate\Support\Carbon;
  5. class UpgradeDaily extends Command
  6. {
  7. /**
  8. * The name and signature of the console command.
  9. *
  10. * @var string
  11. */
  12. protected $signature = 'upgrade:daily';
  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. $start = time();
  36. if(app()->isLocal()==false){
  37. $this->call('message:webhook',[
  38. 'listener' => 'dingtalk',
  39. 'url' => 'dingtalk1',
  40. 'title' => "后台任务",
  41. 'message' => " wikipali: 每日统计后台任务开始执行。",
  42. ]);
  43. }
  44. $message = "wikipali: 每日统计后台任务执行完毕。";
  45. //巴利原文段落库目录结构改变时运行
  46. //$this->call('upgrade:palitext');
  47. #巴利段落标签
  48. //$this->call('upgrade:palitexttag');
  49. //更新单词首选意思
  50. $this->call('upgrade:dict.default.meaning');
  51. $time = time()-$start;
  52. $message .= "dict.default.meaning:{$time}; ";
  53. //社区术语表
  54. $this->call('upgrade:community.term',['lang'=>'zh-Hans']);
  55. $time = time()-$time;
  56. $message .= "community.term:{$time}; ";
  57. #译文进度
  58. $this->call('upgrade:progress');
  59. $time = time()-$time;
  60. $message .= "progress:{$time}; ";
  61. $this->call('upgrade:progress.chapter');
  62. $time = time()-$time;
  63. $message .= "progress.chapter:{$time}; ";
  64. # 逐词译数据库分析
  65. $this->call('upgrade:wbw.analyses');
  66. $time = time()-$time;
  67. $message .= "wbw.analyses:{$time}; ";
  68. $time = time()-$start;
  69. $message .= "总时间:{$time}; ";
  70. if(app()->isLocal()==false){
  71. $this->call('message:webhook',[
  72. 'listener' => 'dingtalk',
  73. 'url' => 'dingtalk1',
  74. 'title' => "后台任务",
  75. 'message' => $message,
  76. ]);
  77. //发送dingding消息
  78. $this->call('message:webhookarticlenew',[
  79. 'host' => 'https://oapi.dingtalk.com/robot/send?access_token=34143dbec80a8fc09c1cb5897a5639ee3a9a32ecfe31835ad29bf7013bdb9fdf',
  80. 'type' => 'dingtalk',
  81. ]);
  82. //发送微信消息
  83. $this->call('message:webhookarticlenew',[
  84. 'host' => 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=25dbd74f-c89c-40e5-8cbc-48b1ef7710b8',
  85. 'type' => 'wechat',
  86. ]);
  87. }
  88. return 0;
  89. }
  90. }