TipitakaChapterResource.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace App\Http\Resources\V3;
  3. use App\Services\V3\TipitakaChapterService;
  4. use Illuminate\Http\Request;
  5. /**
  6. * 三藏里的一个章节标题。
  7. *
  8. * 载荷是 {@see TipitakaChapterService::search()} 组好的数组,不查库。底层是 pali_texts 中
  9. * level < 8 的一行;译名来自公开 channel 的 progress_chapters.title。
  10. *
  11. * 类型核对自 information_schema:pali_texts.book / paragraph / level / chapter_len /
  12. * chapter_strlen / parent / prev_chapter / next_chapter 都是 integer,toc 是 text,path 是 json。
  13. */
  14. class TipitakaChapterResource extends BaseResource
  15. {
  16. /**
  17. * @param Request $request
  18. * @return array{
  19. * book: int,
  20. * para: int,
  21. * level: int,
  22. * title: string,
  23. * translations: array<int, array{lang: string, title: string}>,
  24. * layer: string,
  25. * paragraphs: int,
  26. * chars: int,
  27. * parent: int|null,
  28. * prev: int|null,
  29. * next: int|null,
  30. * path: array<int, array{book: int, para: int, title: string, level: int}>,
  31. * score?: float
  32. * }
  33. */
  34. public function toArray($request): array
  35. {
  36. return $this->resource;
  37. }
  38. }