123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- namespace app\api\model;
- use think\Model;
- class User extends Model
- {
-
-
- // 表名
- protected $name = 'user';
- public function getGenderList()
- {
- return ['1' => __('Gender 1'), '0' => __('Gender 0')];
- }
- public function getIdcardStatusList()
- {
- return ['-1' => __('Idcard_status -1'),'0' => __('Idcard_status 0'),'1' => __('Idcard_status 1'), '2' => __('Idcard_status 2')];
- }
- public function getStatusList()
- {
- return ['1' => __('Status 1'), '0' => __('Status 0')];
- }
- public function getGenderTextAttr($value, $data)
- {
- $value = $value ? $value : (isset($data['gender']) ? $data['gender'] : '');
- $list = $this->getGenderList();
- return isset($list[$value]) ? $list[$value] : '';
- }
- public function getIdcardStatusTextAttr($value, $data)
- {
- $value = $value ? $value : (isset($data['idcard_status']) ? $data['idcard_status'] : '');
- $list = $this->getIdcardStatusList();
- return isset($list[$value]) ? $list[$value] : '';
- }
- public function getStatusTextAttr($value, $data)
- {
- $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
- $list = $this->getStatusList();
- return isset($list[$value]) ? $list[$value] : '';
- }
- }
|