BusinessStatDataTransformer.php 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: tandunzhao
  5. * Date: 2017/12/26
  6. * Time: 下午5:37
  7. */
  8. namespace App\Http\Controllers\Manage\Channel\Transformers;
  9. class BusinessStatDataTransformer
  10. {
  11. public function transform($channelItem)
  12. {
  13. return [
  14. 'distribution_manages_id'=>(float)$channelItem->id,
  15. // 'distribution_manages_account'=>$channelItem->account,
  16. 'distribution_manages_nickname'=>$channelItem->nickname,
  17. 'distribution_manages_latest_login_time'=>isset($channelItem->latest_login_time) ? ($channelItem->latest_login_time ? date('Y-m-d H:i:s', strtotime($channelItem->latest_login_time)) : "") : "",
  18. 'distribution_manages_latest_login_ip'=>$channelItem->latest_login_ip,
  19. 'distribution_manages_is_enabled'=>(float)$channelItem->is_enabled,
  20. 'distribution_manages_remark'=>$channelItem->remark,
  21. 'distribution_manages_register_ip'=>$channelItem->register_ip,
  22. 'distribution_manages_create_time'=>isset($channelItem->created_at) ? ($channelItem->created_at ? date('Y-m-d H:i:s', strtotime($channelItem->created_at)) : "") : "",
  23. 'distribution_manages_update_time'=>isset($channelItem->updated_at) ? ($channelItem->updated_at ? date('Y-m-d H:i:s', strtotime($channelItem->updated_at)) : "") : "",
  24. 'distribution_manages_number'=>$channelItem->number,
  25. 'today_register_user_num'=>(float)$channelItem->today_register_user_num,
  26. 'yesterday_register_user_num'=>(float)$channelItem->yesterday_register_user_num,
  27. 'current_month_register_user_num'=>(float)$channelItem->current_month_register_user_num,
  28. 'last_month_register_user_num'=>(float)$channelItem->last_month_register_user_num,
  29. 'total_register_user_num'=>(float)$channelItem->total_register_user_num,
  30. 'total_send_order_num'=>(float)$channelItem->total_send_order_num,
  31. 'current_month_companies_num'=>(float)$channelItem->current_month_companies_num,
  32. 'current_month_channel_num'=>(float)$channelItem->current_month_channel_num,
  33. 'last_month_companies_num'=>(float)$channelItem->last_month_companies_num,
  34. 'last_month_channel_num'=>(float)$channelItem->last_month_channel_num,
  35. 'current_month_new_channels_recharge'=>(float)$channelItem->current_month_new_channels_recharge,
  36. 'current_month_channels_recharge'=>(float)$channelItem->current_month_channels_recharge,
  37. 'last_month_new_channels_recharge'=>(float)$channelItem->last_month_new_channels_recharge_sum,
  38. 'last_month_channels_recharge'=>(float)$channelItem->last_month_channels_recharge_sum,
  39. ];
  40. }
  41. }