Просмотр исходного кода

Merge pull request #2150 from visuddhinanda/laravel

add log url
visuddhinanda 1 год назад
Родитель
Сommit
63ecb1436f

+ 11 - 2
app/Http/Api/TemplateRender.php

@@ -508,16 +508,19 @@ class TemplateRender{
         $type = $this->get_param($this->param,"type",1);
         $id = $this->get_param($this->param,"id",2);
         $title = $this->get_param($this->param,"title",3);
-        $channel = $this->get_param($this->param,"channel",4,$this->channel_id[0]);
+        $channel = $this->get_param($this->param,"channel",4);
         $style = $this->get_param($this->param,"style",5);
         $book = $this->get_param($this->param,"book",6);
         $paragraphs = $this->get_param($this->param,"paragraphs",7);
+        $anthology = $this->get_param($this->param,"anthology",8);
         $props = [
                     "type" => $type,
                     "id" => $id,
-                    "channel" => $channel,
                     'style' => $style,
                 ];
+        if(!empty($channel)){
+            $props['channel'] = $channel;
+        }
         if(!empty($title)){
             $props['title'] = $title;
         }
@@ -527,6 +530,12 @@ class TemplateRender{
         if(!empty($paragraphs)){
             $props['paragraphs'] = $paragraphs;
         }
+        if(!empty($anthology)){
+            $props['anthology'] = $anthology;
+        }
+        if(is_array($this->channel_id)){
+            $props['parentChannels'] = $this->channel_id;
+        }
         switch ($this->format) {
             case 'react':
                 $output = [

+ 2 - 1
app/Http/Resources/ArticleResource.php

@@ -66,9 +66,10 @@ class ArticleResource extends JsonResource
         //渲染简化版标题
         $channels = [];
         if($request->has('channel')){
+            //有channel
             $channels = explode('_',$request->get('channel')) ;
         }else if(isset($anthology) && $anthology && !empty($anthology->default_channel)){
-            //使用文集channel
+            //没有channel,使用文集channel
             $channels[] = $anthology->default_channel;
         }
         $mdRender = new MdRender(['format'=>'simple']);

+ 1 - 1
app/Tools/ExportDownload.php

@@ -196,7 +196,7 @@ class ExportDownload
         }
         $this->downloadUrl = $s3Link;
         $this->setStatus(1,'export chapter done');
-        Log::debug('export chapter done, upload filename='.$tmpFile);
+        Log::debug('export chapter done, upload',['filename'=>$tmpFile,'url'=>$s3Link] );
         unlink($zipFile);
         return true;
     }