瀏覽代碼

没有id 的情况下用book 和 paragraphs 拼接

visuddhinanda 1 年之前
父節點
當前提交
9d9bd7e422
共有 1 個文件被更改,包括 5 次插入0 次删除
  1. 5 0
      api-v8/app/Http/Api/TemplateRender.php

+ 5 - 0
api-v8/app/Http/Api/TemplateRender.php

@@ -614,6 +614,11 @@ class TemplateRender
         $book = $this->get_param($this->param, "book", 6);
         $paragraphs = $this->get_param($this->param, "paragraphs", 7);
         $anthology = $this->get_param($this->param, "anthology", 8);
+        if ($type === 'chapter' && empty($id)) {
+            $book = (int)$book;
+            $paragraphs = (int)$paragraphs;
+            $id = "{$book}-{$paragraphs}";
+        }
         $props = [
             "type" => $type,
             "id" => $id,