<?php

namespace app\admin\model\shopro\agent;

use app\admin\model\shopro\Common;

class Apply extends Common
{

    protected $type = [
        'id_card_images' => 'json',
    ];

    // 审核状态
    const STATUS_PENDING = 'pending';     // 审核中
    const STATUS_APPROVED = 'approved';   // 已通过
    const STATUS_REJECTED = 'rejected';   // 已驳回

    public function statusList()
    {
        return [
            self::STATUS_PENDING => '审核中',
            self::STATUS_APPROVED => '已通过',
            self::STATUS_REJECTED => '已驳回',
        ];
    }

    protected $append = [
        'status_text',
    ];


    // 表名
    protected $name = 'shopro_agent_apply';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = false;

    protected function setAuditTimeAttr($value)
    {
        return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
    }
}
