UpgradeDaily.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. # 刷巴利语句子uuid 仅调用一次
  45. //$this->call('upgrade:palitextid');
  46. //巴利原文段落库目录结构改变时运行
  47. $this->call('upgrade:palitext');
  48. #巴利段落标签
  49. $this->call('upgrade:palitexttag');
  50. //更新单词首选意思
  51. $this->call('upgrade:dict.default.meaning');
  52. #译文进度
  53. $this->call('upgrade:progress');
  54. $this->call('upgrade:progresschapter');
  55. $this->call('upgrade:community.term',['zh-Hans']);
  56. # 逐词译数据库分析
  57. $this->call('upgrade:wbwanalyses');
  58. $time = time()-$start;
  59. if(app()->isLocal()==false){
  60. $this->call('message:webhook',[
  61. 'listener' => 'dingtalk',
  62. 'url' => 'dingtalk1',
  63. 'title' => "后台任务",
  64. 'message' => "wikipali: 每日统计后台任务执行完毕。用时{$time}",
  65. ]);
  66. //发送dingding消息
  67. $this->call('message:webhookarticlenew',[
  68. 'host' => 'https://oapi.dingtalk.com/robot/send?access_token=34143dbec80a8fc09c1cb5897a5639ee3a9a32ecfe31835ad29bf7013bdb9fdf',
  69. 'type' => 'dingtalk',
  70. ]);
  71. //发送微信消息
  72. $this->call('message:webhookarticlenew',[
  73. 'host' => 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=25dbd74f-c89c-40e5-8cbc-48b1ef7710b8',
  74. 'type' => 'wechat',
  75. ]);
  76. }
  77. return 0;
  78. }
  79. }