AnimeTransformer.php 911 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace App\Transformer\Anime;
  3. class AnimeTransformer
  4. {
  5. public function newBuildChatList($data): array
  6. {
  7. return [
  8. 'meta' => getMeta($data),
  9. // 'header' => $data['header'],
  10. 'list' => $this->newEachChatList($data),
  11. ];
  12. }
  13. private function newEachChatList($list): array
  14. {
  15. $result = [];
  16. if (empty($list)) return $result;
  17. foreach ($list as $item) {
  18. $result[] = [
  19. 'anime_id' => getProp($item, 'id'),
  20. 'anime_name' => '《'.getProp($item, 'anime_name').'》',
  21. 'first_frame_url' => getProp($item, 'first_frame_url'),
  22. 'is_multi' => getProp($item, 'is_multi'),
  23. 'created_at' => transDate(getProp($item, 'created_at')),
  24. ];
  25. }
  26. return $result;
  27. }
  28. }