Jelajahi Sumber

export:sentence original 查询系统channel

visuddhinanda 3 tahun lalu
induk
melakukan
19d443b920

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

@@ -48,7 +48,7 @@ class ExportOffline extends Command
         //导出译文
         $this->call('export:sentence');
         //导出原文
-        $this->call('export:sentence',['channel'=>'28f2e33a-794f-11ed-9481-1395f6ece2de']);
+        $this->call('export:sentence',['type'=>'original']);
         shell_exec("XZ_OPT=-9 tar jcvf ".storage_path("app/public/export/offline.tar.xz")." ".storage_path("app/public/export/offline"));
         return 0;
     }

+ 14 - 5
app/Console/Commands/ExportSentence.php

@@ -6,6 +6,7 @@ use Illuminate\Console\Command;
 use Illuminate\Support\Facades\Storage;
 use App\Models\Sentence;
 use App\Models\Channel;
+use App\Http\Api\ChannelApi;
 
 class ExportSentence extends Command
 {
@@ -46,12 +47,20 @@ class ExportSentence extends Command
             $file_suf = $channel_id;
             $channels[] = $channel_id;
         }else{
-            $file_suf = $channel_type;
             $channel_type = $this->option('type');
-            $nissaya_channel = Channel::where('type',$channel_type)->where('status',30)->select('uid')->get();
-            foreach ($nissaya_channel as $key => $value) {
-                # code...
-                $channels[] = $value->uid;
+            $file_suf = $channel_type;
+            if($channel_type === "original"){
+                $pali_channel = ChannelApi::getSysChannel("_System_Pali_VRI_");
+                if($pali_channel === false){
+                    return 0;
+                }
+                $channels[] = $pali_channel;
+            }else{
+                $nissaya_channel = Channel::where('type',$channel_type)->where('status',30)->select('uid')->get();
+                foreach ($nissaya_channel as $key => $value) {
+                    # code...
+                    $channels[] = $value->uid;
+                }
             }
         }
         $db = Sentence::whereIn('channel_uid',$channels);