|
@@ -0,0 +1,45 @@
|
|
|
+<?php
|
|
|
+namespace App\Transformers\Behavior;
|
|
|
+/**
|
|
|
+ * Created by PhpStorm.
|
|
|
+ * User: durong
|
|
|
+ * Date: 2019/6/14
|
|
|
+ * Time: 下午18:34
|
|
|
+ */
|
|
|
+use App\Models\CommentRecord;
|
|
|
+use League\Fractal\TransformerAbstract;
|
|
|
+
|
|
|
+class CommentRecordTransformer extends TransformerAbstract
|
|
|
+{
|
|
|
+ public function transform(CommentRecord $commentList)
|
|
|
+ {
|
|
|
+ return [
|
|
|
+ 'id' => $commentList['id'],
|
|
|
+ 'created_at' => date($commentList['created_at']),
|
|
|
+ 'virus_behavior_id' => $commentList['virus_behavior_id'],
|
|
|
+ 'uid' => $commentList['uid'],
|
|
|
+ 'upper_trigger_time' => $commentList['upper_trigger_time'],
|
|
|
+ 'related_content_id' => $commentList['related_content_id'],
|
|
|
+ 'content_author_id' => $commentList['content_author_id'],
|
|
|
+ 'superior_commentator_id' => $commentList['superior_commentator_id'],
|
|
|
+ 'physical_exertion' => $commentList['physical_exertion'],
|
|
|
+ 'trigger_type' => $commentList['trigger_type'],
|
|
|
+ 'generation_type' => $commentList['generation_type'],
|
|
|
+ 'release_status' => $commentList['release_status'],
|
|
|
+ 'generation_quantity' => $commentList['generation_quantity'],
|
|
|
+ 'quantity_issued' => $commentList['quantity_issued'],
|
|
|
+ 'current_comment_id' => $commentList['current_comment_id'],
|
|
|
+ 'superior_comment_id' => $commentList['superior_comment_id'],
|
|
|
+ 'behavior_cycle_type' => $commentList->Behavior->behavior_cycle_type,
|
|
|
+ 'name' => $commentList->Behavior->name,
|
|
|
+ 'relative_series' => $commentList->Behavior->relative_series,
|
|
|
+ 'is_open' => $commentList->Behavior->is_open,
|
|
|
+ 'bahavior_created_at' => date($commentList->Behavior->created_at),
|
|
|
+ 'all_trigger_times' => $commentList['all_trigger_times'],//总触发数
|
|
|
+ 'all_effective_trigger' => $commentList['all_effective_trigger'],//有效触发数
|
|
|
+ 'all_physical_exertion' => $commentList['physical_exertion'],//总消耗体力值
|
|
|
+ 'all_generation_quantity' => $commentList['generation_quantity'],//总生成彩虹豆
|
|
|
+ 'all_quantity_issued' => $commentList['quantity_issued'],//总发放彩虹豆
|
|
|
+ ];
|
|
|
+ }
|
|
|
+}
|