<?php

namespace app\common\model;

use think\Model;

class OutRecruit extends Model
{

    // 设置字段信息
    protected $schema = [
        'id'           => 'int',
        'title'        => 'string',
        'company_name' => 'string',
        'num'          => 'int',

        'province' => 'string',
        'city'     => 'string',
        'district' => 'string',
        'address'  => 'string',

        'agegroup'    => 'string',
        'tags'        => 'string',
        'requirement' => 'string',
        'comdetails'  => 'string',
        'picall'      => 'string',

        'salary'     => 'string',
        'telephone'  => 'string',
        'remark'     => 'string',
        'status'     => 'tinyint',
        'priority'   => 'int',
        'updatetime' => 'int',
        'createtime' => 'int',
        'volume'     => 'int',

        'worker_id'      => 'int',
        'agent_id'       => 'int',
        'market_content' => 'string',
        'is_bargain'     => 'int',
    ];

    // 设置字段自动转换类型
    protected $type = [
        'tags'       => 'json',
        'picall'     => 'json',
        'updatetime' => 'timestamp:Y-m-d H:i:s',
        'createtime' => 'timestamp:Y-m-d H:i:s',
    ];
    // 设置JSON数据返回数组
    protected $jsonAssoc = true;

    public function getStatusTextAttr($value, $data)
    {
        $status = [1 => '审核通过', 2 => '待审核', 3 => '审核不通过'];
        return $status[$data['status']];
    }
}