Parcourir la source

导出到offlin目录

visuddhinanda il y a 3 ans
Parent
commit
8b7fc0b1a6

+ 7 - 4
app/Console/Commands/ExportChannel.php

@@ -1,5 +1,7 @@
 <?php
-
+/**
+ * 导出离线用的channel数据
+ */
 namespace App\Console\Commands;
 
 use Illuminate\Console\Command;
@@ -20,7 +22,7 @@ class ExportChannel extends Command
      *
      * @var string
      */
-    protected $description = 'Command description';
+    protected $description = '导出离线用的channel数据';
 
     /**
      * Create a new command instance.
@@ -39,8 +41,9 @@ class ExportChannel extends Command
      */
     public function handle()
     {
-        Storage::disk('local')->put("public/export/channel.csv", "");
-        $file = fopen(storage_path('app/public/export/channel.csv'),"w");
+        $filename = "public/export/offline/channel.csv";
+        Storage::disk('local')->put($filename, "");
+        $file = fopen(storage_path("app/{$filename}"),"w");
         fputcsv($file,['id','name','type','language','summary','owner_id','setting','created_at']);
         $bar = $this->output->createProgressBar(Channel::where('status',30)->count());
         foreach (Channel::where('status',30)->select(['uid','name','type','lang','summary','owner_uid','setting','created_at'])->cursor() as $chapter) {

+ 3 - 2
app/Console/Commands/ExportChapterIndex.php

@@ -39,8 +39,9 @@ class ExportChapterIndex extends Command
      */
     public function handle()
     {
-        Storage::disk('local')->put("public/export/chapter.csv", "");
-        $file = fopen(storage_path('app/public/export/chapter.csv'),"w");
+        $filename = "public/export/offline/chapter.csv";
+        Storage::disk('local')->put($filename, "");
+        $file = fopen(storage_path("app/{$filename}"),"w");
         fputcsv($file,['id','book','paragraph','language','title','channel_id','progress','updated_at']);
         $bar = $this->output->createProgressBar(ProgressChapter::count());
         foreach (ProgressChapter::select(['uid','book','para','lang','title','channel_id','progress','updated_at'])->cursor() as $chapter) {

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

@@ -55,7 +55,7 @@ class ExportSentence extends Command
             }
         }
         $db = Sentence::whereIn('channel_uid',$channels);
-        $file_name = "public/export/sentence_{$file_suf}.csv";
+        $file_name = "public/export/offline/sentence_{$file_suf}.csv";
         Storage::disk('local')->put($file_name, "");
         $file = fopen(storage_path("app/{$file_name}"),"w");
         fputcsv($file,['id','book','paragraph','word_start','word_end','content','content_type','html','channel_id','editor_id','language','updated_at']);