Jelajahi Sumber

Merge pull request #1642 from visuddhinanda/laravel

task 开头添加.stop判断
visuddhinanda 2 tahun lalu
induk
melakukan
ba09bf2f18
88 mengubah file dengan 415 tambahan dan 95 penghapusan
  1. 6 0
      app/Console/Commands/CacheDictPreference.php
  2. 3 0
      app/Console/Commands/CacheWbwPreference.php
  3. 6 1
      app/Console/Commands/ExportChannel.php
  4. 5 0
      app/Console/Commands/ExportChapter.php
  5. 6 1
      app/Console/Commands/ExportChapterIndex.php
  6. 7 1
      app/Console/Commands/ExportCreateDb.php
  7. 3 0
      app/Console/Commands/ExportNissaya.php
  8. 18 2
      app/Console/Commands/ExportOffline.php
  9. 6 1
      app/Console/Commands/ExportPalitext.php
  10. 6 1
      app/Console/Commands/ExportSentence.php
  11. 7 1
      app/Console/Commands/ExportTag.php
  12. 6 1
      app/Console/Commands/ExportTagmap.php
  13. 6 1
      app/Console/Commands/ExportTerm.php
  14. 3 0
      app/Console/Commands/InitCs6sentence.php
  15. 3 0
      app/Console/Commands/InitDependence.php
  16. 3 0
      app/Console/Commands/InitSystemChannel.php
  17. 3 0
      app/Console/Commands/InitSystemDict.php
  18. 14 33
      app/Console/Commands/Install.php
  19. 3 0
      app/Console/Commands/InstallPaliSeries.php
  20. 3 0
      app/Console/Commands/InstallPaliText.php
  21. 13 10
      app/Console/Commands/InstallWbwTemplate.php
  22. 3 0
      app/Console/Commands/InstallWordAll.php
  23. 3 0
      app/Console/Commands/InstallWordBook.php
  24. 3 0
      app/Console/Commands/InstallWordIndex.php
  25. 3 0
      app/Console/Commands/InstallWordStatistics.php
  26. 3 0
      app/Console/Commands/MqDiscussion.php
  27. 3 0
      app/Console/Commands/MqIssues.php
  28. 3 0
      app/Console/Commands/MqPr.php
  29. 3 0
      app/Console/Commands/MqProgress.php
  30. 3 0
      app/Console/Commands/MqTask.php
  31. 3 0
      app/Console/Commands/MqWbwAnalyses.php
  32. 3 0
      app/Console/Commands/RemoveTermCache.php
  33. 3 0
      app/Console/Commands/StatisticsDict.php
  34. 3 0
      app/Console/Commands/StatisticsExp.php
  35. 3 0
      app/Console/Commands/StatisticsNissaya.php
  36. 3 0
      app/Console/Commands/StatisticsWbw.php
  37. 3 0
      app/Console/Commands/TestCaseMan.php
  38. 3 0
      app/Console/Commands/TestJsonToXml.php
  39. 3 1
      app/Console/Commands/TestMdRender.php
  40. 3 1
      app/Console/Commands/TestMq.php
  41. 8 6
      app/Console/Commands/TestMqWorker.php
  42. 3 0
      app/Console/Commands/TestRedis.php
  43. 3 0
      app/Console/Commands/TestSchedule.php
  44. 3 0
      app/Console/Commands/TestSendMail.php
  45. 3 0
      app/Console/Commands/TestTex.php
  46. 3 0
      app/Console/Commands/UpdateRelationTo.php
  47. 3 0
      app/Console/Commands/UpgradeAt20230227.php
  48. 3 0
      app/Console/Commands/UpgradeChapterDynamic.php
  49. 3 0
      app/Console/Commands/UpgradeChapterDynamicWeekly.php
  50. 7 3
      app/Console/Commands/UpgradeCommunityTerm.php
  51. 4 0
      app/Console/Commands/UpgradeCompound.php
  52. 3 21
      app/Console/Commands/UpgradeDaily.php
  53. 3 0
      app/Console/Commands/UpgradeDict.php
  54. 3 0
      app/Console/Commands/UpgradeDictDefaultMeaning.php
  55. 3 0
      app/Console/Commands/UpgradeDictId.php
  56. 4 1
      app/Console/Commands/UpgradeDictSysRegular.php
  57. 3 0
      app/Console/Commands/UpgradeDictSysWbwExtract.php
  58. 3 0
      app/Console/Commands/UpgradeDictVocabulary.php
  59. 3 1
      app/Console/Commands/UpgradeFts.php
  60. 3 0
      app/Console/Commands/UpgradePageNumber.php
  61. 3 0
      app/Console/Commands/UpgradePaliText.php
  62. 3 0
      app/Console/Commands/UpgradePaliTextId.php
  63. 3 0
      app/Console/Commands/UpgradePaliTextTag.php
  64. 3 0
      app/Console/Commands/UpgradePaliToc.php
  65. 3 0
      app/Console/Commands/UpgradePcdBookId.php
  66. 3 0
      app/Console/Commands/UpgradeProgress.php
  67. 3 0
      app/Console/Commands/UpgradeProgressChapter.php
  68. 3 0
      app/Console/Commands/UpgradeQuote.php
  69. 3 0
      app/Console/Commands/UpgradeRelatedParagraph.php
  70. 3 0
      app/Console/Commands/UpgradeSimIndex.php
  71. 3 0
      app/Console/Commands/UpgradeTestData.php
  72. 3 0
      app/Console/Commands/UpgradeVocabulary.php
  73. 3 0
      app/Console/Commands/UpgradeWbwAnalyses.php
  74. 3 0
      app/Console/Commands/UpgradeWbwTemplate.php
  75. 19 0
      app/Console/Commands/UpgradeWeekly.php
  76. 3 0
      app/Console/Commands/UpgradeWordPart.php
  77. 3 0
      app/Console/Commands/UuidViranyani.php
  78. 3 0
      app/Console/Commands/WebHook.php
  79. 3 0
      app/Console/Commands/WebHookArticleNew.php
  80. 3 0
      app/Console/Commands/WebhookDingtalk.php
  81. 3 0
      app/Console/Commands/WebhookWechat.php
  82. 2 3
      app/Http/Api/Mq.php
  83. 4 1
      app/Http/Controllers/DictController.php
  84. 1 1
      app/Http/Controllers/InviteController.php
  85. 1 1
      app/Http/Middleware/ApiLog.php
  86. 52 0
      app/Http/Middleware/UserOperation.php
  87. 9 2
      app/Mail/InviteMail.php
  88. 9 0
      app/Tools/Tools.php

+ 6 - 0
app/Console/Commands/CacheDictPreference.php

@@ -41,6 +41,9 @@ class CacheDictPreference extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $prefix = 'dict-preference';
         $words = UserDict::select(['word','language'])
                        ->groupBy(['word','language'])
@@ -60,6 +63,9 @@ class CacheDictPreference extends Command
                 Cache::put("{$prefix}/{$word->word}/{$word->language}",$m[0]);
             }
             $bar->advance();
+            if(\App\Tools\Tools::isStop()){
+                return 0;
+            }
         }
         $bar->finish();
 

+ 3 - 0
app/Console/Commands/CacheWbwPreference.php

@@ -41,6 +41,9 @@ class CacheWbwPreference extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $prefix = 'wbw-preference';
         if($this->option('view')==='all' ||
            $this->option('view')==='my'){

+ 6 - 1
app/Console/Commands/ExportChannel.php

@@ -42,7 +42,11 @@ class ExportChannel extends Command
      */
     public function handle()
     {
-        $exportFile = storage_path('app/public/export/offline/sentence-'.date("Y-m-d").'.db3');
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
+        Log::debug('task export offline channel-table start');
+        $exportFile = storage_path('app/public/export/offline/wikipali-offline-'.date("Y-m-d").'.db3');
         $dbh = new \PDO('sqlite:'.$exportFile, "", "", array(\PDO::ATTR_PERSISTENT => true));
         $dbh->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_WARNING);
         $dbh->beginTransaction();
@@ -77,6 +81,7 @@ class ExportChannel extends Command
         }
         $dbh->commit();
         $bar->finish();
+        Log::debug('task export offline channel-table finished');
         return 0;
     }
 }

+ 5 - 0
app/Console/Commands/ExportChapter.php

@@ -46,6 +46,10 @@ class ExportChapter extends Command
      */
     public function handle()
     {
+        Log::debug('task export offline chapter-table start');
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $book = $this->argument('book');
         $para = $this->argument('para');
         $channelId = $this->argument('channel');
@@ -172,6 +176,7 @@ class ExportChapter extends Command
             $this->error($data['code'].'-'.$data['message']);
         }
 
+        Log::debug('task export offline chapter-table finished');
         return 0;
     }
 }

+ 6 - 1
app/Console/Commands/ExportChapterIndex.php

@@ -42,7 +42,11 @@ class ExportChapterIndex extends Command
      */
     public function handle()
     {
-        $exportFile = storage_path('app/public/export/offline/sentence-'.date("Y-m-d").'.db3');
+        Log::debug('task export offline chapter-index-table start');
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
+        $exportFile = storage_path('app/public/export/offline/wikipali-offline-'.date("Y-m-d").'.db3');
         $dbh = new \PDO('sqlite:'.$exportFile, "", "", array(\PDO::ATTR_PERSISTENT => true));
         $dbh->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_WARNING);
         $dbh->beginTransaction();
@@ -80,6 +84,7 @@ class ExportChapterIndex extends Command
         }
         $dbh->commit();
         $bar->finish();
+        Log::debug('task export offline chapter-index-table finished');
         return 0;
     }
 }

+ 7 - 1
app/Console/Commands/ExportCreateDb.php

@@ -4,6 +4,7 @@ namespace App\Console\Commands;
 
 use Illuminate\Console\Command;
 use Illuminate\Support\Facades\Storage;
+use Illuminate\Support\Facades\Log;
 
 class ExportCreateDb extends Command
 {
@@ -38,9 +39,13 @@ class ExportCreateDb extends Command
      */
     public function handle()
     {
+        Log::debug('task export offline create-db start');
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $sqlPath = database_path('export/sentence.sql');
         $exportDir = storage_path('app/public/export/offline');
-        $exportFile = $exportDir.'/sentence-'.date("Y-m-d").'.db3';
+        $exportFile = $exportDir.'/wikipali-offline-'.date("Y-m-d").'.db3';
         $file = fopen($exportFile,'w');
         fclose($file);
         $dbh = new \PDO('sqlite:'.$exportFile, "", "", array(\PDO::ATTR_PERSISTENT => true));
@@ -52,6 +57,7 @@ class ExportCreateDb extends Command
         foreach ($_arr as $_value) {
             $dbh->query($_value . ';');
         }
+        Log::debug('task export offline create-db finished');
         return 0;
     }
 }

+ 3 - 0
app/Console/Commands/ExportNissaya.php

@@ -42,6 +42,9 @@ class ExportNissaya extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $nissaya_channel = Channel::where('type','nissaya')->select('uid')->get();
         $channels = [];
         foreach ($nissaya_channel as $key => $value) {

+ 18 - 2
app/Console/Commands/ExportOffline.php

@@ -5,6 +5,7 @@ namespace App\Console\Commands;
 use Illuminate\Console\Command;
 use Illuminate\Support\Facades\Storage;
 use Illuminate\Support\Facades\Cache;
+use Illuminate\Support\Facades\Log;
 
 class ExportOffline extends Command
 {
@@ -39,6 +40,9 @@ class ExportOffline extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $exportDir = storage_path('app/public/export/offline');
         if(!is_dir($exportDir)){
             $res = mkdir($exportDir,0700,true);
@@ -50,7 +54,7 @@ class ExportOffline extends Command
         $exportStop = $exportDir.'/.stop';
         $file = fopen($exportStop,'w');
         fclose($file);
-             
+
         //建表
         $this->info('create db');
         $this->call('export:create.db');
@@ -58,10 +62,11 @@ class ExportOffline extends Command
         //term
         $this->info('term');
         $this->call('export:term');
-        
+
         //导出channel
         $this->info('channel');
         $this->call('export:channel');
+        
         //tag
         $this->info('tag');
         $this->call('export:tag');
@@ -80,8 +85,14 @@ class ExportOffline extends Command
         $this->call('export:sentence',['--type'=>'original']);
 
         $this->info('zip');
+        
         $exportPath = 'app/public/export/offline';
         $exportFile = 'wikipali-offline-'.date("Y-m-d").'.db3';
+        Log::debug('zip file {filename} {format}',
+                    [
+                        'filename'=>$exportFile,
+                        'format'=>$this->argument('format')
+                    ]);
         switch ($this->argument('format')) {
             case '7z':
                 $zipFile = $exportFile . ".7z";
@@ -118,6 +129,11 @@ class ExportOffline extends Command
                     ];
         Cache::put('/offline/index',$info);
         unlink($exportStop);
+        Log::debug('zip file {filename} in {format} finished',
+                    [
+                        'filename'=>$exportFile,
+                        'format'=>$this->argument('format')
+                    ]);
         return 0;
     }
 }

+ 6 - 1
app/Console/Commands/ExportPalitext.php

@@ -40,7 +40,11 @@ class ExportPalitext extends Command
      */
     public function handle()
     {
-        $exportFile = storage_path('app/public/export/offline/sentence-'.date("Y-m-d").'.db3');
+        Log::debug('task export offline palitext-table start');
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
+        $exportFile = storage_path('app/public/export/offline/wikipali-offline-'.date("Y-m-d").'.db3');
         $dbh = new \PDO('sqlite:'.$exportFile, "", "", array(\PDO::ATTR_PERSISTENT => true));
         $dbh->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_WARNING);
         $dbh->beginTransaction();
@@ -76,6 +80,7 @@ class ExportPalitext extends Command
         }
         $dbh->commit();
         $bar->finish();
+        Log::debug('task: export offline palitext-table finished');
 
         return 0;
     }

+ 6 - 1
app/Console/Commands/ExportSentence.php

@@ -44,6 +44,10 @@ class ExportSentence extends Command
      */
     public function handle()
     {
+        Log::debug('task export offline sentence-table start');
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $channels = [];
         $channel_id = $this->option('channel');
         if($channel_id){
@@ -68,7 +72,7 @@ class ExportSentence extends Command
         }
 
 
-        $exportFile = storage_path('app/public/export/offline/sentence-'.date("Y-m-d").'.db3');
+        $exportFile = storage_path('app/public/export/offline/wikipali-offline-'.date("Y-m-d").'.db3');
         $dbh = new \PDO('sqlite:'.$exportFile, "", "", array(\PDO::ATTR_PERSISTENT => true));
         $dbh->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_WARNING);
         $dbh->beginTransaction();
@@ -120,6 +124,7 @@ class ExportSentence extends Command
         }
         $dbh->commit();
         $bar->finish();
+        Log::debug('task export sentence finished');
         return 0;
     }
 }

+ 7 - 1
app/Console/Commands/ExportTag.php

@@ -40,7 +40,11 @@ class ExportTag extends Command
      */
     public function handle()
     {
-        $exportFile = storage_path('app/public/export/offline/sentence-'.date("Y-m-d").'.db3');
+        Log::debug('task: export offline data tag-table start');
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
+        $exportFile = storage_path('app/public/export/offline/wikipali-offline-'.date("Y-m-d").'.db3');
         $dbh = new \PDO('sqlite:'.$exportFile, "", "", array(\PDO::ATTR_PERSISTENT => true));
         $dbh->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_WARNING);
         $dbh->beginTransaction();
@@ -69,6 +73,8 @@ class ExportTag extends Command
         }
         $dbh->commit();
         $bar->finish();
+        Log::debug('task: export offline data tag-table start');
+
         return 0;
     }
 }

+ 6 - 1
app/Console/Commands/ExportTagmap.php

@@ -40,7 +40,11 @@ class ExportTagmap extends Command
      */
     public function handle()
     {
-        $exportFile = storage_path('app/public/export/offline/sentence-'.date("Y-m-d").'.db3');
+        Log::debug('task: export offline tagmap-table start');
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
+        $exportFile = storage_path('app/public/export/offline/wikipali-offline-'.date("Y-m-d").'.db3');
         $dbh = new \PDO('sqlite:'.$exportFile, "", "", array(\PDO::ATTR_PERSISTENT => true));
         $dbh->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_WARNING);
         $dbh->beginTransaction();
@@ -65,6 +69,7 @@ class ExportTagmap extends Command
         }
         $dbh->commit();
         $bar->finish();
+        Log::debug('task: export offline tagmap-table finished');
         return 0;
     }
 }

+ 6 - 1
app/Console/Commands/ExportTerm.php

@@ -40,7 +40,11 @@ class ExportTerm extends Command
      */
     public function handle()
     {
-        $exportFile = storage_path('app/public/export/offline/sentence-'.date("Y-m-d").'.db3');
+        Log::debug('task export offline term-table start');
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
+        $exportFile = storage_path('app/public/export/offline/wikipali-offline-'.date("Y-m-d").'.db3');
         $dbh = new \PDO('sqlite:'.$exportFile, "", "", array(\PDO::ATTR_PERSISTENT => true));
         $dbh->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_WARNING);
         $dbh->beginTransaction();
@@ -88,6 +92,7 @@ class ExportTerm extends Command
         }
         $dbh->commit();
         $bar->finish();
+        Log::debug('task export offline term-table finished');
         return 0;
     }
 }

+ 3 - 0
app/Console/Commands/InitCs6sentence.php

@@ -43,6 +43,9 @@ class InitCs6sentence extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
 		$start = time();
         $channelId = ChannelApi::getSysChannel('_System_Pali_VRI_');
         if($channelId === false){

+ 3 - 0
app/Console/Commands/InitDependence.php

@@ -39,6 +39,9 @@ class InitDependence extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
 		#克隆依赖的数据仓库到本地
 		$depDir = $this->info(config("mint.path.dependence"));
 		foreach ($this->info(config("mint.dependence")) as $key => $value) {

+ 3 - 0
app/Console/Commands/InitSystemChannel.php

@@ -101,6 +101,9 @@ class InitSystemChannel extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $this->info("start");
         foreach ($this->channels as $key => $value) {
             # code...

+ 3 - 0
app/Console/Commands/InitSystemDict.php

@@ -72,6 +72,9 @@ class InitSystemDict extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $this->info("start");
         foreach ($this->dictionary as $key => $value) {
             # code...

+ 14 - 33
app/Console/Commands/Install.php

@@ -35,49 +35,30 @@ class Install extends Command
      *
      * @return int
      */
-	/*
-	php ../../public/app/install/db_insert_templet_cli.php 1 217
-	php ../../public/app/install/db_update_toc_cli.php 1 217 pali
-	php ../../public/app/install/db_update_toc_cli.php 1 217 zh-hans
-	php ../../public/app/install/db_update_toc_cli.php 1 217 zh-hant
-	php ../../public/app/install/db_insert_palitext_cli.php 1 217
-	php ../../public/app/install/db_update_palitext_cli.php 1 217
-	php ../../public/app/install/db_insert_bookword_from_csv_cli.php 1 217
-	php ../../public/app/install/db_insert_word_from_csv_cli.php 1 217
-	php ../../public/app/install/db_insert_wordindex_from_csv_cli.php
 
-	php ./migrations/20211202084900_init_pali_serieses.php
-	php ./migrations/20211125155600_word_statistics.php
-	php ./migrations/20211125155700_pali_sent_org.php
-	php ./migrations/20211125165700-pali_sent-upgrade.php
-	php ./migrations/20211126220400-pali_sent_index-upgrade.php
-	php ./migrations/20211127214800_sent_sim.php
-	php ./migrations/20211127214900-sent_sim_index.php
-
-	php ../../public/app/fts/sql.php
-
-	php ../../public/app/admin/word_index_weight_refresh.php 1 217
-	*/
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
 		$isTest = $this->option('test');
 		if($isTest){
 			$this->call('install:wbwtemplate', ['from' => 1]);
 		}else{
-			$this->call('install:wbwtemplate');	
-			$this->call('install:palitext');	
-			$this->call('install:wordbook');	
-			$this->call('install:wordall');	
+			$this->call('install:wbwtemplate');
+			$this->call('install:palitext');
+			$this->call('install:wordbook');
+			$this->call('install:wordall');
 			$this->call('install:wordindex');
 
-			$this->call('upgrade:palitext');	
-			$this->call('upgrade:palitoc',['lang'=>'pali']);	
-			$this->call('upgrade:palitoc',['lang'=>'zh-hans']);	
-			$this->call('upgrade:palitoc',['lang'=>'zh-hant']);	
+			$this->call('upgrade:palitext');
+			$this->call('upgrade:palitoc',['lang'=>'pali']);
+			$this->call('upgrade:palitoc',['lang'=>'zh-hans']);
+			$this->call('upgrade:palitoc',['lang'=>'zh-hant']);
+
+			$this->call('install:paliseries');
+			$this->call('install:wordstatistics');
 
-			$this->call('install:paliseries');	
-			$this->call('install:wordstatistics');	
-			
 		}
 
         return 0;

+ 3 - 0
app/Console/Commands/InstallPaliSeries.php

@@ -40,6 +40,9 @@ class InstallPaliSeries extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
 		$this->info("upgrade pali serieses");
 		$startTime = time();
 

+ 3 - 0
app/Console/Commands/InstallPaliText.php

@@ -40,6 +40,9 @@ class InstallPaliText extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
 		$this->info("instert pali text");
 		$startTime = time();
 

+ 13 - 10
app/Console/Commands/InstallWbwTemplate.php

@@ -40,6 +40,9 @@ class InstallWbwTemplate extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
 		$this->info("instert wbw template");
 
 
@@ -61,22 +64,22 @@ class InstallWbwTemplate extends Command
 		}
 		$bar = $this->output->createProgressBar($_to-$_from+1);
 
-		for ($from=$_from; $from <=$_to ; $from++) { 
+		for ($from=$_from; $from <=$_to ; $from++) {
 			# code...
-			
+
 			$fileSn = $from-1;
 			$outputFileNameHead = $filelist[$fileSn][1];
-	
+
 			$dirXmlBase = public_path('/tmp/palicsv') . "/";
 			$dirXml = $outputFileNameHead . "/";
-		
-		
+
+
 			#删除目标数据库中数据
 			WbwTemplate::where('book', $from)->delete();
 
 
 			// 打开文件并读取数据
-			
+
 			if (($GLOBALS["fp"] = fopen($dirXmlBase . $dirXml . $outputFileNameHead . ".csv", "r")) !== false) {
 				$GLOBALS["row"]=0;
 				DB::transaction(function () {
@@ -95,7 +98,7 @@ class InstallWbwTemplate extends Command
 							'type'=>$data[6],
 							'gramma'=>$data[7],
 							'part'=>$data[10],
-							'style'=>$data[15]	
+							'style'=>$data[15]
 						];
 						WbwTemplate::insert($params);
 					}
@@ -105,11 +108,11 @@ class InstallWbwTemplate extends Command
 				$this->error("can not open csv file. filename=" . $dirXmlBase . $dirXml . $outputFileNameHead . ".csv".PHP_EOL) ;
 				Log::error("can not open csv file. filename=" . $dirXmlBase . $dirXml . $outputFileNameHead . ".csv".PHP_EOL) ;
 			}
-			
+
 			$bar->advance();
 		}
 		$bar->finish();
         return 0;
-    
+
 	}
-}
+}

+ 3 - 0
app/Console/Commands/InstallWordAll.php

@@ -40,6 +40,9 @@ class InstallWordAll extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
 		$startTime = time();
 
 		$this->info("instert word in palibook ");

+ 3 - 0
app/Console/Commands/InstallWordBook.php

@@ -40,6 +40,9 @@ class InstallWordBook extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
 		$startTime = time();
 
 		$this->info("instert word in palibook ");

+ 3 - 0
app/Console/Commands/InstallWordIndex.php

@@ -40,6 +40,9 @@ class InstallWordIndex extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
 		$startTime = time();
 
 		$info = "instert word in palibook ";

+ 3 - 0
app/Console/Commands/InstallWordStatistics.php

@@ -40,6 +40,9 @@ class InstallWordStatistics extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
 		$startTime = time();
 
 		$info = "instert wordstatistics ";

+ 3 - 0
app/Console/Commands/MqDiscussion.php

@@ -46,6 +46,9 @@ class MqDiscussion extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $exchange = 'router';
         $queue = 'discussion';
         $this->info(" [*] Waiting for {$queue}. To exit press CTRL+C");

+ 3 - 0
app/Console/Commands/MqIssues.php

@@ -38,6 +38,9 @@ class MqIssues extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $exchange = 'router';
         $queue = 'issues';
         $this->info(" [*] Waiting for {$queue}. To exit press CTRL+C");

+ 3 - 0
app/Console/Commands/MqPr.php

@@ -43,6 +43,9 @@ class MqPr extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $exchange = 'router';
         $queue = 'suggestion';
         $this->info(" [*] Waiting for {$queue}. To exit press CTRL+C");

+ 3 - 0
app/Console/Commands/MqProgress.php

@@ -38,6 +38,9 @@ class MqProgress extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $exchange = 'router';
         $queue = 'progress';
         $this->info(" [*] Waiting for {$queue}. To exit press CTRL+C");

+ 3 - 0
app/Console/Commands/MqTask.php

@@ -39,6 +39,9 @@ class MqTask extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $this->info('env='.env("RABBITMQ_HOST"));
         $this->info('config='.config("queue.connections.rabbitmq.host"));
         $exchange = 'router';

+ 3 - 0
app/Console/Commands/MqWbwAnalyses.php

@@ -38,6 +38,9 @@ class MqWbwAnalyses extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $exchange = 'router';
         $queue = 'wbw-analyses';
         $this->info(" [*] Waiting for {$queue}. To exit press CTRL+C");

+ 3 - 0
app/Console/Commands/RemoveTermCache.php

@@ -40,6 +40,9 @@ class RemoveTermCache extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $word = $this->argument('word');
         $channels = Channel::select('uid')->get();
         if(empty($word)){

+ 3 - 0
app/Console/Commands/StatisticsDict.php

@@ -40,6 +40,9 @@ class StatisticsDict extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $file = "public/statistics/lookup-monthly.csv";
         Storage::disk('local')->put($file, "");
         #按月获取数据

+ 3 - 0
app/Console/Commands/StatisticsExp.php

@@ -40,6 +40,9 @@ class StatisticsExp extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $file = "public/statistics/exp-monthly.csv";
         Storage::disk('local')->put($file, "");
         #按月获取数据

+ 3 - 0
app/Console/Commands/StatisticsNissaya.php

@@ -41,6 +41,9 @@ class StatisticsNissaya extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $nissaya_channel = Channel::where('type','nissaya')->select('uid')->get();
         $this->info('channel:'.count($nissaya_channel));
         $maxDay = 360;

+ 3 - 0
app/Console/Commands/StatisticsWbw.php

@@ -40,6 +40,9 @@ class StatisticsWbw extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $file = "public/statistics/wbw-monthly.csv";
         Storage::disk('local')->put($file, "");
         #按月获取数据

+ 3 - 0
app/Console/Commands/TestCaseMan.php

@@ -40,6 +40,9 @@ class TestCaseMan extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
 		$caseMan = new CaseMan();
         $case = $caseMan->Declension($this->argument('word'),'.n:base.','.nt.',0.5);
         print_r($case);

+ 3 - 0
app/Console/Commands/TestJsonToXml.php

@@ -38,6 +38,9 @@ class TestJsonToXml extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $array = [
             'pali'=>['status'=>'7','value'=>'bārāṇasiyaṃ'],
             'real'=>['status'=>'7','value'=>'bārāṇasiyaṃ'],

+ 3 - 1
app/Console/Commands/TestMdRender.php

@@ -40,8 +40,10 @@ class TestMdRender extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         Log::info('md render start item='.$this->argument('item'));
-
         $data = array();
         $data['bold'] = <<<md
         **三十位** 经

+ 3 - 1
app/Console/Commands/TestMq.php

@@ -42,7 +42,9 @@ class TestMq extends Command
      */
     public function handle()
     {
-
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
 		Mq::publish('hello',['hello world']);
         $discussion = $this->option('discussion');
         if($discussion && Str::isUuid($discussion)){

+ 8 - 6
app/Console/Commands/TestMqWorker.php

@@ -39,15 +39,17 @@ class TestMqWorker extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $exchange = 'router';
         $queue = 'hello';
         $consumerTag = 'consumer';
-
-        $connection = new AMQPStreamConnection(config("rabbitmq.host"),
-                                            config("rabbitmq.port"),
-                                            config("rabbitmq.user"),
-                                            config("rabbitmq.password"),
-                                            config("rabbitmq.virtual.host"));
+        $connection = new AMQPStreamConnection(config("queue.connections.rabbitmq.host"),
+                                            config("queue.connections.rabbitmq.port"),
+                                            config("queue.connections.rabbitmq.user"),
+                                            config("queue.connections.rabbitmq.password"),
+                                            config("queue.connections.rabbitmq.virtual_host"));
         $channel = $connection->channel();
 
         /*

+ 3 - 0
app/Console/Commands/TestRedis.php

@@ -40,6 +40,9 @@ class TestRedis extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
 		$value='this is a test';
 		$this->info("test redis start");
         $remember = Cache::store('redis')->remember('dd',10,function(){

+ 3 - 0
app/Console/Commands/TestSchedule.php

@@ -38,6 +38,9 @@ class TestSchedule extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         Log::info('schedule test start');
         $this->info('schedule test start');
         return 0;

+ 3 - 0
app/Console/Commands/TestSendMail.php

@@ -40,6 +40,9 @@ class TestSendMail extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $uuid = Str::uuid();
         Mail::to("visuddhinanda@gmail.com")
             ->send(new InviteMail($uuid,'en'));

+ 3 - 0
app/Console/Commands/TestTex.php

@@ -39,6 +39,9 @@ class TestTex extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $tex = array();
         $content = <<<'EOF'
 % 导言区

+ 3 - 0
app/Console/Commands/UpdateRelationTo.php

@@ -38,6 +38,9 @@ class UpdateRelationTo extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $count=0;
         $all=0;
         foreach (Relation::select(['id','to'])->cursor() as $relation) {

+ 3 - 0
app/Console/Commands/UpgradeAt20230227.php

@@ -37,6 +37,9 @@ class UpgradeAt20230227 extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $this->call('init:system.channel');
         $this->call('init:system.dict');
         $this->call('upgrade:dict');

+ 3 - 0
app/Console/Commands/UpgradeChapterDynamic.php

@@ -42,6 +42,9 @@ class UpgradeChapterDynamic extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
 		$this->info('upgrade:chapterdynamic start.');
 
         $startAt = time();

+ 3 - 0
app/Console/Commands/UpgradeChapterDynamicWeekly.php

@@ -43,6 +43,9 @@ class UpgradeChapterDynamicWeekly extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
 		$this->info('upgrade:chapter.dynamic.weekly start.');
 
         $startAt = time();

+ 7 - 3
app/Console/Commands/UpgradeCommunityTerm.php

@@ -44,6 +44,9 @@ class UpgradeCommunityTerm extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $lang = strtolower($this->argument('lang'));
         $langFamily = explode('-',$lang)[0];
         $localTerm = ChannelApi::getSysChannel(
@@ -81,12 +84,13 @@ class UpgradeCommunityTerm extends Command
                                         ->where('date_int','<=',date_timestamp_get(date_create($term->updated_at))*1000)
                                         ->sum('duration');
                 $iExp = (int)($exp/1000);
-                $noteStrLen = mb_strlen($term->note);
+                $noteStrLen = $term->note? mb_strlen($term->note,'UTF-8'):0;
                 $paliStrLen = 0;
                 $tranStrLen = 0;
                 $noteWithoutPali = "";
-                if(!empty(trim($term->note))){
-                    #查找句子模版
+                if($term->note && !empty(trim($term->note))){
+                    //计算note得分
+                    //查找句子模版
                     $pattern = "/\{\{[0-9].+?\}\}/";
                     //获取去掉句子模版的剩余部分
                     $noteWithoutPali = preg_replace($pattern,"",$term->note);

+ 4 - 0
app/Console/Commands/UpgradeCompound.php

@@ -9,6 +9,7 @@ use App\Models\UserDict;
 use App\Tools\TurboSplit;
 use App\Http\Api\DictApi;
 use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Facades\Log;
 
 class UpgradeCompound extends Command
 {
@@ -45,6 +46,9 @@ class UpgradeCompound extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         if(file_exists(base_path('.stop'))){
             $this->info('.stop exists');
             return 0;

+ 3 - 21
app/Console/Commands/UpgradeDaily.php

@@ -40,6 +40,9 @@ class UpgradeDaily extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         Log::info('daily task start');
         $start = time();
 		if(app()->isLocal()==false){
@@ -52,10 +55,6 @@ class UpgradeDaily extends Command
 		}
         Log::info('wikipali: 每日统计后台任务开始执行');
         $message = "wikipali: 每日统计后台任务执行完毕。";
-        //巴利原文段落库目录结构改变时运行
-        //$this->call('upgrade:palitext');
-        #巴利段落标签
-        //$this->call('upgrade:palitexttag');
 
         //更新单词首选意思
         $this->call('upgrade:dict.default.meaning');
@@ -71,23 +70,6 @@ class UpgradeDaily extends Command
         $currTime = time();
         Log::info('社区术语表完毕');
 
-        /*
-        #译文进度
-        $this->call('upgrade:progress');
-        $time = time()-$currTime;
-        $message .= "progress:{$time}; ";
-        $currTime = time();
-
-        $this->call('upgrade:progress.chapter');
-        $time = time()-$currTime;
-        $message .= "progress.chapter:{$time}; ";
-        $currTime = time();
-
-        # 逐词译数据库分析
-        $this->call('upgrade:wbw.analyses');
-        $time = time()-$currTime;
-        $message .= "wbw.analyses:{$time}; ";
-*/
         # 导出离线数据
         $this->call('export:offline',['format'=>'lzma']);
         $time = time()-$currTime;

+ 3 - 0
app/Console/Commands/UpgradeDict.php

@@ -215,6 +215,9 @@ class UpgradeDict extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
 		$this->info("upgrade dict start");
 		$this->scandict(config("mint.path.dict_text"));
 		$this->info("upgrade dict done");

+ 3 - 0
app/Console/Commands/UpgradeDictDefaultMeaning.php

@@ -87,6 +87,9 @@ class UpgradeDictDefaultMeaning extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $_word = $this->argument('word');
         # 获取字典中所有的语言
         $langInDict = UserDict::select('language')->groupBy('language')->get();

+ 3 - 0
app/Console/Commands/UpgradeDictId.php

@@ -39,6 +39,9 @@ class UpgradeDictId extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $this->info($this->description);
         $user_dict_id = DictApi::getSysDict('community');
         if($user_dict_id){

+ 4 - 1
app/Console/Commands/UpgradeDictSysRegular.php

@@ -19,7 +19,7 @@ class UpgradeDictSysRegular extends Command
 {
     /**
      * The name and signature of the console command.
-     *
+     * php artisan upgrade:regular
      * @var string
      */
     protected $signature = 'upgrade:regular {word?} {--debug}';
@@ -47,6 +47,9 @@ class UpgradeDictSysRegular extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $dict_id = DictApi::getSysDict('system_regular');
         if(!$dict_id){
             $this->error('没有找到 system_regular 字典');

+ 3 - 0
app/Console/Commands/UpgradeDictSysWbwExtract.php

@@ -43,6 +43,9 @@ class UpgradeDictSysWbwExtract extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $user_dict_id = DictApi::getSysDict('community');
         if(!$user_dict_id){
             $this->error('没有找到 community 字典');

+ 3 - 0
app/Console/Commands/UpgradeDictVocabulary.php

@@ -40,6 +40,9 @@ class UpgradeDictVocabulary extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $words = UserDict::where('source','_PAPER_')->selectRaw('word,count(*)')->groupBy('word')->cursor();
 
 		$bar = $this->output->createProgressBar(230000);

+ 3 - 1
app/Console/Commands/UpgradeFts.php

@@ -42,7 +42,9 @@ class UpgradeFts extends Command
      */
     public function handle()
     {
-
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         if($this->option('content')){
             if(!empty($this->argument('para'))){
                 $para = explode('-',$this->argument('para'));

+ 3 - 0
app/Console/Commands/UpgradePageNumber.php

@@ -39,6 +39,9 @@ class UpgradePageNumber extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $table = WbwTemplate::where('type','.ctl.')->orderBy('book')->orderBy('paragraph')->cursor();
         $pageHead = ['M','P','T','V','O'];
         $bar = $this->output->createProgressBar(WbwTemplate::where('type','.ctl.')->count());

+ 3 - 0
app/Console/Commands/UpgradePaliText.php

@@ -44,6 +44,9 @@ class UpgradePaliText extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
 		$this->info("upgrade pali text");
 		$startTime = time();
 

+ 3 - 0
app/Console/Commands/UpgradePaliTextId.php

@@ -40,6 +40,9 @@ class UpgradePaliTextId extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $this->info("upgrade pali text uuid");
         $startTime = time();
 

+ 3 - 0
app/Console/Commands/UpgradePaliTextTag.php

@@ -41,6 +41,9 @@ class UpgradePaliTextTag extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $this->info("upgrade pali text tag");
         $startTime = time();
 

+ 3 - 0
app/Console/Commands/UpgradePaliToc.php

@@ -41,6 +41,9 @@ class UpgradePaliToc extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
 		$this->info("upgrade pali text");
 		$startTime = time();
 

+ 3 - 0
app/Console/Commands/UpgradePcdBookId.php

@@ -40,6 +40,9 @@ class UpgradePcdBookId extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $table = $this->option('table');
         $bookTitles = BookTitle::orderBy('sn')->get();
         $bar = $this->output->createProgressBar(count($bookTitles));

+ 3 - 0
app/Console/Commands/UpgradeProgress.php

@@ -42,6 +42,9 @@ class UpgradeProgress extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
 		$this->info('upgrade:progress start');
 		$startTime = time();
         $book = $this->option('book');

+ 3 - 0
app/Console/Commands/UpgradeProgressChapter.php

@@ -46,6 +46,9 @@ class UpgradeProgressChapter extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
 		$this->info("upgrade:progresschapter start.");
 		$startTime = time();
         $book = $this->option('book');

+ 3 - 0
app/Console/Commands/UpgradeQuote.php

@@ -42,6 +42,9 @@ class UpgradeQuote extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $start = time();
         $channelId = ChannelApi::getSysChannel('_System_Quote_');
         if($channelId===false){

+ 3 - 0
app/Console/Commands/UpgradeRelatedParagraph.php

@@ -43,6 +43,9 @@ class UpgradeRelatedParagraph extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $this->info("upgrade related.paragraph");
 		$startTime = time();
         #删除目标数据库中数据

+ 3 - 0
app/Console/Commands/UpgradeSimIndex.php

@@ -40,6 +40,9 @@ class UpgradeSimIndex extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $result = DB::select('select count(*) from (select sent1 from sent_sims where sim>0.5  group by sent1) T');
         $bar = $this->output->createProgressBar($result[0]->count);
         foreach (SentSim::selectRaw('sent1,count(*)')

+ 3 - 0
app/Console/Commands/UpgradeTestData.php

@@ -39,6 +39,9 @@ class UpgradeTestData extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $this->call('init:cs6sentence',[$this->argument('book')]);
         $this->call('upgrade:wbw.template',[$this->argument('book')]);
         $this->call('upgrade:chapter.dynamic.weekly',["--book"=>$this->argument('book'),"--offset"=>300]);

+ 3 - 0
app/Console/Commands/UpgradeVocabulary.php

@@ -40,6 +40,9 @@ class UpgradeVocabulary extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
 		$words = UserDict::select('word')->groupBy('word')->cursor();
 		$count=0;
 		foreach ($words as $word) {

+ 3 - 0
app/Console/Commands/UpgradeWbwAnalyses.php

@@ -40,6 +40,9 @@ class UpgradeWbwAnalyses extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
 		$startAt = time();
 		$this->info("upgrade:wbwanalyses start");
 

+ 3 - 0
app/Console/Commands/UpgradeWbwTemplate.php

@@ -42,6 +42,9 @@ class UpgradeWbwTemplate extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $start = time();
 		$pali = new PaliSentence;
 		if(!empty($this->argument('book'))){

+ 19 - 0
app/Console/Commands/UpgradeWeekly.php

@@ -37,6 +37,25 @@ class UpgradeWeekly extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
+        #译文进度
+        $this->call('upgrade:progress');
+        $time = time()-$currTime;
+        $message .= "progress:{$time}; ";
+        $currTime = time();
+
+        $this->call('upgrade:progress.chapter');
+        $time = time()-$currTime;
+        $message .= "progress.chapter:{$time}; ";
+        $currTime = time();
+
+        # 逐词译数据库分析
+        $this->call('upgrade:wbw.analyses');
+        $time = time()-$currTime;
+        $message .= "wbw.analyses:{$time}; ";
+
         # 段落更新图
         $this->call('upgrade:chapter.dynamic');
         $this->call('upgrade:chapter.dynamic.weekly');

+ 3 - 0
app/Console/Commands/UpgradeWordPart.php

@@ -42,6 +42,9 @@ class UpgradeWordPart extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $delete = WordPart::where('id','>',0)->delete();
         #载入纸质词典数据
         $paper = UserDict::selectRaw('word,count(*)')->where("source",'_PAPER_')->groupBy('word')->cursor();

+ 3 - 0
app/Console/Commands/UuidViranyani.php

@@ -50,6 +50,9 @@ class UuidViranyani extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $old = "C1AB2ABF-EAA8-4EEF-B4D9-3854321852B4";
 		$result = DB::select('UPDATE "articles" set "owner"=? where "owner"=? ',[strtolower($old),$old]);
 		$result = DB::select('UPDATE "channels" set "owner_uid"=? where "owner_uid"=? ',[strtolower($old),$old]);

+ 3 - 0
app/Console/Commands/WebHook.php

@@ -42,6 +42,9 @@ class WebHook extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
 		switch ($this->argument('listener')) {
 			case 'weixin':
 				break;

+ 3 - 0
app/Console/Commands/WebHookArticleNew.php

@@ -38,6 +38,9 @@ class WebHookArticleNew extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
 		# 获取最新文章数据
 		$url = config('app.url')."/api/v2/progress?view=chapter&channel_type=translation";
 

+ 3 - 0
app/Console/Commands/WebhookDingtalk.php

@@ -39,6 +39,9 @@ class WebhookDingtalk extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $url = $this->argument('url');
         $param = ["markdown"=> [
                         "title"=> $this->argument('title'),

+ 3 - 0
app/Console/Commands/WebhookWechat.php

@@ -39,6 +39,9 @@ class WebhookWechat extends Command
      */
     public function handle()
     {
+        if(\App\Tools\Tools::isStop()){
+            return 0;
+        }
         $url = $this->argument('url');
         $title =  $this->argument('title');
         $content = $this->argument('message');

+ 2 - 3
app/Http/Api/Mq.php

@@ -21,8 +21,7 @@ class Mq{
             return $connection;
     }
     public static function publish(string $channelName, $message){
-                //一对一
-
+       //一对一
         try{
             Log::debug('mq start {channel} {message}',['channel'=>$channelName,'message'=>$message]);
             $host = config("queue.connections.rabbitmq.host");
@@ -111,7 +110,7 @@ class Mq{
                 try{
                     $result = $callback(json_decode($message->body));
                     if($result !== 0){
-                        throw new \Exception('error');
+                        throw new \Exception('task error');
                     }
                 }catch(\Exception $e){
                     // push to issues

+ 4 - 1
app/Http/Controllers/DictController.php

@@ -2,6 +2,7 @@
 
 namespace App\Http\Controllers;
 
+use Illuminate\Support\Facades\App;
 use App\Models\UserDict;
 use App\Models\DictInfo;
 use App\Models\GroupMember;
@@ -45,7 +46,9 @@ class DictController extends Controller
         }else{
             $inMyHanGroup = false;
         }
-        if(config('app.env')==='local'){
+
+        if (App::environment('local')) {
+            // The environment is local
             $inMyHanGroup = true;
         }
         $resultCount=0;

+ 1 - 1
app/Http/Controllers/InviteController.php

@@ -77,7 +77,7 @@ class InviteController extends Controller
 
         $uuid = Str::uuid();
         Mail::to($request->get('email'))
-            ->send(new InviteMail($uuid,$request->get('lang')));
+            ->send(new InviteMail($uuid,$request->get('lang'),$request->get('dashboard')));
         if(Mail::failures()){
             return $this->error('send email fail',[],200);
         }else{

+ 1 - 1
app/Http/Middleware/ApiLog.php

@@ -22,7 +22,7 @@ class ApiLog
         $response = $next($request);
         if (defined('LARAVEL_START'))
         {
-            $delay = round((microtime(true) - LARAVEL_START)*1000,2);
+            $delay = round((microtime(true) - LARAVEL_START)*1000.0);
             $api = [];
             $api[] = date("h:i:sa",LARAVEL_START);
             $api[] = $delay;

+ 52 - 0
app/Http/Middleware/UserOperation.php

@@ -133,6 +133,36 @@ class UserOperation
                             "content"=>$request->get('channel'),
                         ];
                         break;
+                    /*
+                    case 'GET':
+                        if($request->get('view')==='sent-can-read' && $request->has('type')){
+                            $newLog = [
+                                "op_type"=>"res_read",
+                                "content"=>$request->get('sentence'),
+                            ];
+                            switch ($request->get('type')) {
+                                case 'translation':
+                                    $newLog["op_type_id"] = 101;
+                                    break;
+                                case 'nissaya':
+                                    $newLog["op_type_id"] = 102;
+                                    break;
+                                case 'original':
+                                    $newLog["op_type_id"] = 103;
+                                    break;
+                                case 'wbw':
+                                    $newLog["op_type_id"] = 104;
+                                    break;
+                                case 'commentary':
+                                    $newLog["op_type_id"] = 105;
+                                    break;
+                                default:
+                                    unset($newLog);
+                                    break;
+                            }
+                        }
+                        break;
+                        */
                 }
                 break;
             case 'anthology':
@@ -153,6 +183,28 @@ class UserOperation
                         break;
                 }
                 break;
+            /*
+            case 'article-map':
+                switch ($method) {
+                    case 'POST':
+                        $newLog = [
+                            "op_type_id"=>111,
+                            "op_type"=>"article_map_create",
+                            "content"=>$request->get('anthology_id'),
+                        ];
+                        break;
+                    case 'PUT':
+                        $newLog = [
+                            "op_type_id"=>110,
+                            "op_type"=>"article_map_update",
+                        ];
+                        if(isset($api[3])){
+                            $newLog['content'] = $api[3];
+                        }
+                        break;
+                }
+                break;
+                */
             case 'wbw':
                 switch ($method) {
                     case 'POST':

+ 9 - 2
app/Mail/InviteMail.php

@@ -14,16 +14,22 @@ class InviteMail extends Mailable
 
     protected $uuid;
     protected $lang;
+    protected $dashboard_url;
     /**
      * Create a new message instance.
      *
      * @return void
      */
-    public function __construct(string $uuid,string $lang='en-US')
+    public function __construct(string $uuid,string $lang='en-US',string $dashboard=null)
     {
         //
         $this->uuid = $uuid;
         $this->lang = $lang;
+        if($dashboard && !empty($dashboard)){
+            $this->dashboard_url = $dashboard;
+        }else{
+            $this->dashboard_url = config('mint.server.dashboard_base_path');
+        }
     }
 
     /**
@@ -33,9 +39,10 @@ class InviteMail extends Mailable
      */
     public function build()
     {
+
         return $this->view('emails.invite.'.$this->lang)
                     ->with([
-                        'url' => config('dashboard.url').'/anonymous/users/sign-up/'.$this->uuid,
+                        'url' => $this->dashboard_url.'/anonymous/users/sign-up/'.$this->uuid,
                     ]);
     }
 }

+ 9 - 0
app/Tools/Tools.php

@@ -1,7 +1,16 @@
 <?php
 namespace App\Tools;
+use Illuminate\Support\Facades\Log;
 
 class Tools{
+    public static function isStop(){
+        if(file_exists(base_path('.stop'))){
+            Log::debug('.stop exists');
+            return true;
+        }else{
+            return false;
+        }
+    }
 
     public static function getWordEn($strIn)
         {