<?php

namespace app\admin\model\help;

use think\Model;


class HelpExt extends Model
{

    

    

    // 表名
    protected $name = 'help_ext';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

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

    // 追加属性
    protected $append = [
        'sex_text',
        'politics_text',
        'marriage_text',
        'medical_insurance_text'
    ];
    

    
    public function getSexList()
    {
        return ['0' => __('Sex 0'), '1' => __('Sex 1')];
    }

    public function getPoliticsList()
    {
        return ['0' => __('Politics 0'), '1' => __('Politics 1'), '2' => __('Politics 2')];
    }

    public function getMarriageList()
    {
        return ['0' => __('Marriage 0'), '1' => __('Marriage 1')];
    }

    public function getMedicalInsuranceList()
    {
        return ['0' => __('Medical_insurance 0'), '1' => __('Medical_insurance 1')];
    }


    public function getSexTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['sex']) ? $data['sex'] : '');
        $list = $this->getSexList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getPoliticsTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['politics']) ? $data['politics'] : '');
        $list = $this->getPoliticsList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getMarriageTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['marriage']) ? $data['marriage'] : '');
        $list = $this->getMarriageList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getMedicalInsuranceTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['medical_insurance']) ? $data['medical_insurance'] : '');
        $list = $this->getMedicalInsuranceList();
        return isset($list[$value]) ? $list[$value] : '';
    }




}
