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

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

use Hashids;

class SendOrderTransformer
{
    public function transform($sendOrderItem)
    {
        return [
            'id' => $sendOrderItem->id,
            'distribution_channel_id' => $sendOrderItem->distribution_channel_id,
            'entrance' => $sendOrderItem->entrance,
            'name' => $sendOrderItem->name,
            'book_id' => $sendOrderItem->book_id,
            'channel_type' => $sendOrderItem->channel_type,
            'chapter_id' => $sendOrderItem->chapter_id,
            'document_cover_id' => $sendOrderItem->document_cover_id,
            'headline_id' => $sendOrderItem->headline_id,
            'body_template_id' => $sendOrderItem->body_template_id,
            'original_guide_id' => $sendOrderItem->original_guide_id,
            'subscribe_chapter_id' => $sendOrderItem->subscribe_chapter_id,
            'book_name' => $sendOrderItem->book_name,
            'chapter_name' => $sendOrderItem->chapter_name,
            'subscribe_chapter_name' => $sendOrderItem->subscribe_chapter_name,
            'subscribe_chapter_seq' => $sendOrderItem->subscribe_chapter_seq,
            'remark' => $sendOrderItem->remark,
            'star_num' => $sendOrderItem->star_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)),
            'promotion_page_id' => $sendOrderItem->promotion_page_id,
            'redirect_url' => $sendOrderItem->redirect_url,
            'totalChargeAmount' => $sendOrderItem->totalChargeAmount,
            'fansNum' => $sendOrderItem->fansNum,
            'registerNum' => $sendOrderItem->registerNum,
            'payUserNum' => $sendOrderItem->payUserNum,
            'clickNum' => $sendOrderItem->clickNum,
            'vipPayUserNum' => $sendOrderItem->vipPayUserNum,
            'normalPayUserNum' => $sendOrderItem->normalPayUserNum,
            'clickNumUV' => $sendOrderItem->clickNumUV,
            'toatlOrderCount' => $sendOrderItem->toatlOrderCount,
            'cost' => $sendOrderItem->cost,
            'vipOrderCount' => $sendOrderItem->vipOrderCount,
            'normalOrderCount' => $sendOrderItem->normalOrderCount,
            'sex_preference' => $sendOrderItem->sex_preference,
            'document_end_chapter_seq' => $sendOrderItem->document_end_chapter_seq,
            'continue_read_uv' => $sendOrderItem->continue_read_uv,
            'consumeTotalFee' => $sendOrderItem->consumeTotalFee,
            'consumeChargeFee' => $sendOrderItem->consumeChargeFee,
            'consumeRewardFee' => $sendOrderItem->consumeRewardFee,
            'firstChargeUserNum' => $sendOrderItem->firstChargeUserNum,
            'channel_name' => $sendOrderItem->channel_name,
            'charge_type' => $sendOrderItem->charge_type,
            'weekend_charge_amount' => $sendOrderItem->weekend_charge_amount ? $sendOrderItem->weekend_charge_amount : 0,
            'half_day_charge_amount' => $sendOrderItem->half_day_charge_amount ? $sendOrderItem->half_day_charge_amount : 0,
            'charge_type' => $sendOrderItem->charge_type,
            'send_time' => $sendOrderItem->send_time,
            'repetitiousChargeUserNum' => $sendOrderItem->repetitiousChargeUserNum,
        ];
    }
}