<?php
/**
 * Created by PhpStorm.
 * User: hp
 * Date: 2017/11/22
 * Time: 14:17
 */

namespace App\Http\Controllers\Manage\SendOrder\Transformers;

class SendOrderStatTransformer
{
    public function transform($sendOrderItem)
    {
        return [
            'id' => $sendOrderItem->send_order_id,
            'name' => $sendOrderItem->name,
            'distribution_channel_id' => $sendOrderItem->distribution_channel_id,
            'book_name' => $sendOrderItem->book_name,
            'book_id' => $sendOrderItem->bid,
            'totalChargeAmount' => $sendOrderItem->recharge_amount,
            'distribution_channel_name' => $sendOrderItem->distribution_channel_name,
            'charge_type' => $sendOrderItem->charge_type,
            'cost' => $sendOrderItem->cost,
            'send_time' => $sendOrderItem->send_time,
            'half_day_charge_amount' => $sendOrderItem->recharge_amount_in_half_day,
            'recharge_amount_in_one_day' => (float)$sendOrderItem->recharge_amount_in_one_day,
            'recharge_amount_in_three_days' => (float)$sendOrderItem->recharge_amount_in_three_days,
            'weekend_charge_amount' => $sendOrderItem->recharge_amount_in_two_weeks,
            'firstChargeUserNum' => $sendOrderItem->first_recharge_user_num,
            'updated_at' => date("Y-m-d H:i:s", strtotime($sendOrderItem->updated_at)),
            'created_at' => date("Y-m-d H:i:s", strtotime($sendOrderItem->created_at)),
            'fansNum' => $sendOrderItem->force_user_num,
            'registerNum' => $sendOrderItem->register_user_num,
            'payUserNum' => $sendOrderItem->pay_user_num,
            'paid_num' => $sendOrderItem->paid_num,
            'unpaid_num' => $sendOrderItem->unpaid_num,
            'first_recharge_amount' => $sendOrderItem->first_recharge_amount,
            'vipPayUserNum' => $sendOrderItem->year_recharge_user_num,
            'normalPayUserNum' => $sendOrderItem->ticket_recharge_user_num,
            'vipOrderCount' => $sendOrderItem->year_paid_num,
            'pv' => $sendOrderItem->pv,
            'uv' => $sendOrderItem->uv,
            'total_pv' => $sendOrderItem->pv,
            'total_uv' => $sendOrderItem->uv,
            'date' => $sendOrderItem->create_time,
            'sum_fee' => $sendOrderItem->sum_fee,
            'sum_charge_balance' => $sendOrderItem->sum_charge_balance,
            'sum_reward_balance' => $sendOrderItem->sum_reward_balance,
            'beforeforcesubuv' => isset($sendOrderItem->beforeforcesubuv) ? $sendOrderItem->beforeforcesubuv : 0,
            'beforevipuv' => isset($sendOrderItem->beforevipuv) ? $sendOrderItem->beforevipuv : 0,
        ];
    }
}