<?php

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

class WechatTemplatesMsgTransformer
{
    public function transform($wechatTemplatesMsg){
        return [
            'id'       =>  $wechatTemplatesMsg->id,
            'template_id'       =>  $wechatTemplatesMsg->template_id,
            'name'       =>  $wechatTemplatesMsg->name,
            'send_time'       =>  $wechatTemplatesMsg->send_time,
            'template_content'       =>  $wechatTemplatesMsg->template_content,
            'redirect_url'       =>  $wechatTemplatesMsg->redirect_url,
            'appid'       =>  $wechatTemplatesMsg->appid,
            'status'       =>  $wechatTemplatesMsg->status,
            'remark'       =>  $wechatTemplatesMsg->remark,
            'distribution_channel_id'       =>  $wechatTemplatesMsg->distribution_channel_id,
            'common_template_id'       => $wechatTemplatesMsg->wechatTemplates->wechatPublicTemplates->common_template_id,
            'title'       => $wechatTemplatesMsg->wechatTemplates->wechatPublicTemplates->title,
            'primary_industry'       => $wechatTemplatesMsg->wechatTemplates->wechatPublicTemplates->primary_industry,
            'deputy_industry'       => $wechatTemplatesMsg->wechatTemplates->wechatPublicTemplates->deputy_industry,
            'content'       => $wechatTemplatesMsg->wechatTemplates->wechatPublicTemplates->content,
            'example'       => $wechatTemplatesMsg->wechatTemplates->wechatPublicTemplates->example,
            'subscribe_time'       =>  $wechatTemplatesMsg->subscribe_time,
            'sex'       =>  $wechatTemplatesMsg->sex,
            'balance'       =>  $wechatTemplatesMsg->balance,
            'order_type'       =>  $wechatTemplatesMsg->order_type,
            'category_id'       =>  $wechatTemplatesMsg->category_id,
            'is_full_send'       =>  $wechatTemplatesMsg->is_full_send,
            'user_num'       =>  $wechatTemplatesMsg->user_num,
            'is_activity'       =>  isset($wechatTemplatesMsg->is_activity)?$wechatTemplatesMsg->is_activity:'0',
            'user_category'       =>  isset($wechatTemplatesMsg->user_category)?$wechatTemplatesMsg->user_category:'',
            'uv'       =>  isset($wechatTemplatesMsg->uv)?$wechatTemplatesMsg->uv:'',
            'pv'       =>  isset($wechatTemplatesMsg->pv)?$wechatTemplatesMsg->pv:'',
            'register_user_num'       =>  isset($wechatTemplatesMsg->register_user_num)?$wechatTemplatesMsg->register_user_num:'',
            'pay_user_num'       =>  isset($wechatTemplatesMsg->pay_user_num)?$wechatTemplatesMsg->pay_user_num:'',
            'charge_amount'       =>  isset($wechatTemplatesMsg->charge_amount)?$wechatTemplatesMsg->charge_amount:'',
            'book_name'       =>  isset($wechatTemplatesMsg->book_name)?$wechatTemplatesMsg->book_name:'',
            'chapter_name'       =>  isset($wechatTemplatesMsg->chapter_name)?$wechatTemplatesMsg->chapter_name:'',
        ];
    }
}