<?php

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

class CustomSendStatsTransformers
{
    public function transform($customSendStats){
        return [
            'id'       =>  isset($customSendStats->id) ? $customSendStats->id : "",
            'distribution_channel_id'       =>  isset($customSendStats->distribution_channel_id) ? $customSendStats->distribution_channel_id : "",
            'date'       =>  isset($customSendStats->date) ? $customSendStats->date : "",
            'push_user_num'       =>  isset($customSendStats->push_user_num) ? $customSendStats->push_user_num : 0,
            'click_num'       =>  isset($customSendStats->click_num) ? $customSendStats->click_num : 0,
            'amount'       =>  isset($customSendStats->amount) ? $customSendStats->amount : 0,
            'success_pay_num'       =>  isset($customSendStats->success_pay_num) ? $customSendStats->success_pay_num : 0,
            'success_pay_rate'       =>  isset($customSendStats->success_pay_rate) ? ($customSendStats->success_pay_rate).'%' : 0,
            'click_rate'       =>  isset($customSendStats->click_rate) ? ($customSendStats->click_rate).'%' : 0,
            'from'       =>  isset($customSendStats->from) ? $customSendStats->from : "",
        ];
    }
}