UpgradeDaily.php 2.2 KB

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