TipitakaPageNumberResource.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace App\Http\Resources\V3;
  3. use Illuminate\Http\Request;
  4. /**
  5. * 一处印本页码(或 CS 段落号)在三藏里的位置。
  6. *
  7. * `edition`:PTS / My(缅甸第六次结集版)/ VRI / Thai / Other / CS(CS 版印的段落号)。
  8. * `volume` 为 null 表示卷号未知(库里记作 0)或不分卷(CS)。`book` / `para` 是页码标记所在段落;
  9. * `book_id` 是 `pcd_book_id`,`book_title` 是书名,`book_para` 是书名所在段(CS 段落号按书编号,定位要用它)。
  10. * `edition_title` 是该版本的书名(静态书名表,PTS / 缅 / VRI 各有一套,其余用通用名;CS 为 null),
  11. * v6 的印本页阅读页按「版本_版本书名_卷_页」定位。`tags` 是书的 tag(同 tipitaka-word-paragraphs/aggregate),客户端按它做目录过滤。
  12. */
  13. class TipitakaPageNumberResource extends BaseResource
  14. {
  15. /**
  16. * @return array{
  17. * edition: string,
  18. * volume: int|null,
  19. * page: int,
  20. * book: int,
  21. * para: int,
  22. * book_id: int,
  23. * book_title: string,
  24. * book_para: int,
  25. * edition_title: string|null,
  26. * layer: string|null,
  27. * tags: list<string>
  28. * }
  29. */
  30. public function toArray(Request $request): array
  31. {
  32. return [
  33. 'edition' => $this['edition'],
  34. 'volume' => $this['volume'],
  35. 'page' => $this['page'],
  36. 'book' => $this['book'],
  37. 'para' => $this['para'],
  38. 'book_id' => $this['book_id'],
  39. 'book_title' => $this['book_title'],
  40. 'book_para' => $this['book_para'],
  41. 'edition_title' => $this['edition_title'],
  42. 'layer' => $this['layer'],
  43. 'tags' => $this['tags'],
  44. ];
  45. }
  46. }