Browse Source

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

visuddhinanda 1 year ago
parent
commit
9d9bd7e422
1 changed files with 5 additions and 0 deletions
  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,