Преглед изворни кода

Merge pull request #1613 from visuddhinanda/laravel

api log放在 storage/logs目录
visuddhinanda пре 2 година
родитељ
комит
655eeb4d0d

+ 5 - 5
app/Console/Commands/UpgradeChapterDynamic.php

@@ -16,7 +16,7 @@ class UpgradeChapterDynamic extends Command
      *
      * @var string
      */
-    protected $signature = 'upgrade:chapterdynamic {--test}';
+    protected $signature = 'upgrade:chapter.dynamic {--test}';
 
     /**
      * The console command description.
@@ -51,7 +51,7 @@ class UpgradeChapterDynamic extends Command
         $min = 30;
         $linewidth = 2;
 
-        
+
 //更新总动态
 		$this->info("更新总动态");
         $chapters = ProgressChapter::select('book','para')
@@ -65,11 +65,11 @@ class UpgradeChapterDynamic extends Command
             #章节长度
             $paraEnd = PaliText::where('book',$chapter->book)
                             ->where('paragraph',$chapter->para)
-                            ->value('chapter_len')+$chapter->para-1;            
+                            ->value('chapter_len')+$chapter->para-1;
 
             $svg = "<svg xmlns='http://www.w3.org/2000/svg'  fill='currentColor' viewBox='0 0 $img_width $img_height'>";
             $svg .= "<polyline points='";
-            for ($i=$days; $i >0 ; $i--) { 
+            for ($i=$days; $i >0 ; $i--) {
                 # code...
 
                 #这一天有多少次更新
@@ -136,7 +136,7 @@ class UpgradeChapterDynamic extends Command
 
             $svg = "<svg xmlns='http://www.w3.org/2000/svg'  fill='currentColor' viewBox='0 0 $img_width $img_height'>";
             $svg .= "<polyline points='";
-            for ($i=$days; $i >0 ; $i--) { 
+            for ($i=$days; $i >0 ; $i--) {
                 # code...
 
                 #这一天有多少次更新

+ 1 - 1
app/Console/Commands/UpgradeWeekly.php

@@ -38,7 +38,7 @@ class UpgradeWeekly extends Command
     public function handle()
     {
         # 段落更新图
-        $this->call('upgrade:chapterdynamic');
+        $this->call('upgrade:chapter.dynamic');
         $this->call('upgrade:chapter.dynamic.weekly');
         return 0;
     }

+ 6 - 2
app/Http/Middleware/ApiLog.php

@@ -6,7 +6,6 @@ use Closure;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Storage;
 use Illuminate\Support\Facades\Cache;
-use App\Tools\RedisClusters;
 use Illuminate\Support\Facades\Redis;
 
 class ApiLog
@@ -29,7 +28,12 @@ class ApiLog
             $api[] = $delay;
             $api[] = $request->method();
             $api[] = $request->path();
-            Storage::disk('local')->append("logs/api/".date("Y-m-d").".log",\implode(',',$api) );
+            $logFileName = storage_path('logs/api-'.date("Y-m-d").".log");
+            $logFile = fopen($logFileName, "a");
+            if($logFile){
+                fputcsv($logFile, $api);
+                fclose($logFile);
+            }
             //实时监控
             $apiPath = explode('/',$request->path());
             if(count($apiPath)>=3 && $apiPath[2] !== 'api'){

+ 48 - 0
documents/deploy/task.md

@@ -0,0 +1,48 @@
+# Redis 预热
+
+>下面任务需在安装或者redis重置的时候运行
+
+```bash
+php artisan cache:wbw.preference
+
+php artisan cache:dict.preference
+```
+
+# 每日任务
+
+```bash
+php artisan upgrade:daily
+```
+
+# 每周任务
+
+```bash
+php artisan upgrade:weekly
+```
+
+# 字典相关
+
+```bash
+#更新某个字典
+
+#更新所有字典
+
+#更新字典搜索索引表
+
+#复合词拆分
+
+#变格表
+```
+
+# 语料库
+
+# 逐词解析
+
+>逐词解析数据库有更新时,会自动更新这些数据。请在安装,redis重置,或者mq失效时运行。
+
+```bash
+#逐词解析首选项
+php artisan cache:wbw.preference
+
+php artisan cache:dict.preference
+```

+ 2 - 2
public/app/fts/README.md

@@ -87,7 +87,7 @@ ALTER TEXT SEARCH DICTIONARY pali_stem (
 
 ```sql
 -- dummy update
-UPDATE fts SET content = content,
+UPDATE fts_texts SET content = content,
                bold_single = bold_single,
                bold_double = bold_double,
                bold_multiple = bold_multiple
@@ -100,7 +100,7 @@ UPDATE fts SET content = content,
 
 ```sql
 -- dummy update
-UPDATE fts SET content = content,
+UPDATE fts_texts SET content = content,
                bold_single = bold_single,
                bold_double = bold_double,
                bold_multiple = bold_multiple;