ChannelTransformer.php 1.5 KB

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace App\Http\Controllers\Manage\Channel\Transformers;
  3. class ChannelTransformer
  4. {
  5. public function transform($channelItem)
  6. {
  7. return [
  8. 'id' => $channelItem->id,
  9. 'phone' => $channelItem->phone,
  10. 'name' => $channelItem->name,
  11. 'pay_merchant_id' => (float)$channelItem->pay_merchant_id,
  12. 'nickname' => $channelItem->nickname,
  13. 'latest_login_time' => isset($channelItem->latest_login_time) ? date("Y-m-d H:i:s",strtotime($channelItem->latest_login_time)) : "",
  14. 'latest_login_ip' => $channelItem->latest_login_ip,
  15. 'is_enabled' => $channelItem->is_enabled,
  16. 'remark' => $channelItem->remark,
  17. 'channel_user_id'=>$channelItem->channel_user_id,
  18. 'register_ip' => $channelItem->register_ip,
  19. 'person_in_charge_name'=>$channelItem->person_in_charge_name,
  20. 'create_time' => isset($channelItem->created_at) ? date("Y-m-d H:i:s",strtotime($channelItem->created_at)) : "",
  21. 'distribution_manages_id'=>(float)$channelItem->distribution_manages_id,
  22. 'distribution_manages_account'=>$channelItem->distribution_manages_account,
  23. 'distribution_manages_number'=>$channelItem->distribution_manages_number,
  24. 'distribution_manages_nickname'=>$channelItem->distribution_manages_nickname,
  25. 'price_rate'=>isset($channelItem->price_rate)?$channelItem->price_rate:''
  26. ];
  27. }
  28. }