<?php
/**
 * Created by PhpStorm.
 * User: hp
 * Date: 2017/12/1
 * Time: 11:42
 */

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

class OrderDaySumStatTransformer
{
    public function transform($stat)
    {
        return [
            'date' => $stat->date,
            'pay_success_user_num' => (int)$stat->pay_success_user_num,
            'total_recharge_amount' => (float)$stat->total_recharge_amount,
            'unpaid_num' => (int)$stat->unpaid_num,
            'paid_num' => (int)$stat->paid_num,
            'promotion_total_uv' => (int)$stat->promotion_total_uv,
            'promotion_total_pv' => (int)$stat->promotion_total_pv,
            'send_order_num' => (int)$stat->send_order_num,
            'real_send_order_num' => (int)$stat->real_send_order_num,
            'register_user_num' =>(int) $stat->register_user_num,
            'real_register_user_num' =>(int) $stat->real_register_user_num,
            'force_user_num' => (int)$stat->force_user_num,
            'ticket_recharge_user_num' => (int)$stat->ticket_recharge_user_num,
            'year_recharge_user_num' => (int)$stat->year_recharge_user_num,
            'first_pay_user_num' => (int)$stat->first_recharge_user_num,
            'first_pay_amount' => (float)$stat->first_recharge_amount,
            'not_first_pay_user_num' => (int)$stat->pay_success_user_num - (int)$stat->first_recharge_user_num,
            'not_first_pay_amount' => round((float)$stat->total_recharge_amount - (float)$stat->first_recharge_amount,2),
            'reg_user_first_recharge_user_num'=>(float)$stat->reg_user_first_recharge_user_num,
            'reg_user_first_recharge_amount'=>(float)$stat->reg_user_first_recharge_amount,
            'channel_merchant_recharge_amount'=>(float)$stat->channel_merchant_recharge_amount
        ];
    }
}