CommentRecordTransformer.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace App\Transformers\Behavior;
  3. /**
  4. * Created by PhpStorm.
  5. * User: durong
  6. * Date: 2019/6/14
  7. * Time: 下午18:34
  8. */
  9. use App\Models\CommentRecord;
  10. use League\Fractal\TransformerAbstract;
  11. class CommentRecordTransformer extends TransformerAbstract
  12. {
  13. public function transform(CommentRecord $commentList)
  14. {
  15. return [
  16. 'id' => $commentList['id'],
  17. 'created_at' => date($commentList['created_at']),
  18. 'virus_behavior_id' => $commentList['virus_behavior_id'],
  19. 'uid' => $commentList['uid'],
  20. 'upper_trigger_time' => $commentList['upper_trigger_time'],
  21. 'related_content_id' => $commentList['related_content_id'],
  22. 'content_author_id' => $commentList['content_author_id'],
  23. 'superior_commentator_id' => $commentList['superior_commentator_id'],
  24. 'physical_exertion' => $commentList['physical_exertion'],
  25. 'trigger_type' => $commentList['trigger_type'],
  26. 'generation_type' => $commentList['generation_type'],
  27. 'release_status' => $commentList['release_status'],
  28. 'generation_quantity' => $commentList['generation_quantity'],
  29. 'quantity_issued' => $commentList['quantity_issued'],
  30. 'current_comment_id' => $commentList['current_comment_id'],
  31. 'superior_comment_id' => $commentList['superior_comment_id'],
  32. 'behavior_cycle_type' => $commentList->Behavior->behavior_cycle_type,
  33. 'name' => $commentList->Behavior->name,
  34. 'relative_series' => $commentList->Behavior->relative_series,
  35. 'is_open' => $commentList->Behavior->is_open,
  36. 'bahavior_created_at' => date($commentList->Behavior->created_at),
  37. 'all_trigger_times' => $commentList['all_trigger_times'],//总触发数
  38. 'all_effective_trigger' => $commentList['all_effective_trigger'],//有效触发数
  39. 'all_physical_exertion' => $commentList['physical_exertion'],//总消耗体力值
  40. 'all_generation_quantity' => $commentList['generation_quantity'],//总生成彩虹豆
  41. 'all_quantity_issued' => $commentList['quantity_issued'],//总发放彩虹豆
  42. ];
  43. }
  44. }