浏览代码

添加format 参数

visuddhinanda 2 年之前
父节点
当前提交
a1f628f242
共有 1 个文件被更改,包括 7 次插入2 次删除
  1. 7 2
      app/Http/Resources/ArticleResource.php

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

@@ -193,9 +193,14 @@ class ArticleResource extends JsonResource
             }
 
             $mode = $request->get('mode','read');
-            $data["html"] = MdRender::render($this->content,$channels,$query_id,$mode);
+            $format = $request->get('format','react');
+            $data["html"] = MdRender::render($this->content,
+                                            $channels,$query_id,$mode,
+                                            'translation','markdown',$format);
             if(empty($this->summary)){
-                $data["_summary"] = MdRender::render($this->content,$channels,$query_id,$mode,'translation','markdown','text');
+                $data["_summary"] = MdRender::render($this->content,
+                                                    $channels,$query_id,$mode,
+                                                    'translation','markdown','text');
             }
         }
         return $data;