12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <?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] : '';
- }
- }
|