
namespace app\common\model;

use think\Model;

class {$humpName} extends Model
{
    {php}
        if(!array_key_exists('create_time',$fieldsInfo) && !array_key_exists('update_time',$fieldsInfo)){
            echo 'protected $autoWriteTimestamp = false;';
        }else if(!array_key_exists('update_time',$fieldsInfo)){
            echo 'protected $updateTime = false;';
        }else if(!array_key_exists('create_time',$fieldsInfo)){
            echo 'protected $createTime = false;';
        }
    {/php}

    {volist name="$fieldsInfo" id="vo"}
        {php}
            if(in_array($vo['Field'],['id','create_time','update_time'])){
                continue;
            }
        {/php}
        {if condition="isset($vo['Component']) && $vo['Component'] == 2"}
            {php}
                //拆分，首字母大写
                $trems = explode('_', $vo['Field']);
                $humpName = "";
                foreach ($trems as $trem) {
                    $humpName .= ucfirst($trem);
                }
            {/php}
            public function get{$humpName}Attr($value, $data)
            {
                return $value ? date('Y-m-d H:i:s', $value) : '';
            }
        {/if}
    {/volist}

}
