<?php

namespace app\common\model;

class RecruitAppointBasicModel extends BaseModel
{
    // 设置表名
    protected $name = 'recruit_appoint_basic';

    //自动完成
    protected $autoWriteTimestamp = true;

    //常量
    const SEX = [1 => '男', 2 => '女'];

    const SEX_MAN = 1;
    const SEX_WOMAN = 2;

    public function getSexTextAttr($value, $data)
    {
        return self::SEX[$data['sex']];
    }

    public function getFamilyAttr($value, $data)
    {
        if (empty($value)) {
            return [];
        } else {
            return json_decode($value,true);
        }
    }
}