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

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

class OrdersRechargeTransformer
{
    public function transform($orderItem)
    {
        return [
            'book_name'=>$orderItem->book_name,
            'send_orders_num'=>$orderItem->send_orders_num?$orderItem->send_orders_num:0,
            'recharge_sum'=>$orderItem->recharge_amount_sum?$orderItem->recharge_amount_sum:0,
            'orders_num'=>$orderItem->order_total?$orderItem->order_total:0,
            'paid_num'=>$orderItem->paid_num_sum?$orderItem->paid_num_sum:0,
            'pay_user_num'=>$orderItem->pay_user_num_sum,
            'average_recharge'=>$orderItem->average_recharge,
            'yesterday_recharge'=>$orderItem->yesterday_recharge?$orderItem->yesterday_recharge:0,
            'success_rate'=>$orderItem->success_rate
        ];
    }
}