| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- <?php
- namespace app\admin\model\service\skill;
- use think\Model;
- class Perfect extends Model
- {
-
-
- // 表名
- protected $name = 'service_apply_skill';
-
- // 自动写入时间戳字段
- protected $autoWriteTimestamp = 'integer';
- // 定义时间戳字段名
- protected $createTime = 'createtime';
- protected $updateTime = 'updatetime';
- protected $deleteTime = false;
- // 追加属性
- protected $append = [
- 'applytype_text',
- 'sex_text',
- 'edu_text',
- 'exper_text',
- 'state_text'
- ];
-
-
- public function getApplytypeList()
- {
- return ['0' => __('Applytype 0'), '1' => __('Applytype 1')];
- }
- public function getSexList()
- {
- return ['1' => __('Sex 1'), '0' => __('Sex 0')];
- }
- public function getEduList()
- {
- return ['0' => __('Edu 0'), '1' => __('Edu 1'), '2' => __('Edu 2'), '3' => __('Edu 3'), '4' => __('Edu 4'), '5' => __('Edu 5'), '6' => __('Edu 6')];
- }
- public function getExperList()
- {
- return ['0' => __('Exper 0'), '1' => __('Exper 1'), '2' => __('Exper 2'), '3' => __('Exper 3')];
- }
- public function getStateList()
- {
- return ['0' => __('State 0'), '1' => __('State 1'), '-1' => __('State -1')];
- }
- public function getApplytypeTextAttr($value, $data)
- {
- $value = $value ? $value : (isset($data['applytype']) ? $data['applytype'] : '');
- $list = $this->getApplytypeList();
- return isset($list[$value]) ? $list[$value] : '';
- }
- public function getSexTextAttr($value, $data)
- {
- $value = $value ? $value : (isset($data['sex']) ? $data['sex'] : '');
- $list = $this->getSexList();
- return isset($list[$value]) ? $list[$value] : '';
- }
- public function getEduTextAttr($value, $data)
- {
- $value = $value ? $value : (isset($data['edu']) ? $data['edu'] : '');
- $list = $this->getEduList();
- return isset($list[$value]) ? $list[$value] : '';
- }
- public function getExperTextAttr($value, $data)
- {
- $value = $value ? $value : (isset($data['exper']) ? $data['exper'] : '');
- $list = $this->getExperList();
- return isset($list[$value]) ? $list[$value] : '';
- }
- public function getStateTextAttr($value, $data)
- {
- $value = $value ? $value : (isset($data['state']) ? $data['state'] : '');
- $list = $this->getStateList();
- return isset($list[$value]) ? $list[$value] : '';
- }
- public function cate()
- {
- return $this->hasOne('Skillcate','id','skill_cate_id')->field('id,name');
- }
- public function category()
- {
- return $this->hasOne('app\admin\model\service\Category','id','category_id')->field('id,name');
- }
- }
|