96 lines
2.2 KiB
PHP
96 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace app\admin\model;
|
|
|
|
use think\Model;
|
|
|
|
|
|
class Hdrquestionnairequestion extends Model
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
// 表名
|
|
protected $name = 'hdrquestionnairequestion';
|
|
|
|
// 自动写入时间戳字段
|
|
protected $autoWriteTimestamp = false;
|
|
|
|
// 定义时间戳字段名
|
|
protected $createTime = false;
|
|
protected $updateTime = false;
|
|
protected $deleteTime = false;
|
|
|
|
// 追加属性
|
|
protected $append = [
|
|
'is_common_text',
|
|
'is_only_boy_text',
|
|
'is_only_girl_text',
|
|
'type_text'
|
|
];
|
|
|
|
|
|
|
|
public function getIsCommonList()
|
|
{
|
|
return ['yes' => __('Is_common yes'), 'no' => __('Is_common no')];
|
|
}
|
|
|
|
public function getIsOnlyBoyList()
|
|
{
|
|
return ['yes' => __('Is_only_boy yes'), 'no' => __('Is_only_boy no')];
|
|
}
|
|
|
|
public function getIsOnlyGirlList()
|
|
{
|
|
return ['yes' => __('Is_only_girl yes'), 'no' => __('Is_only_girl no')];
|
|
}
|
|
|
|
public function getTypeList()
|
|
{
|
|
return ['one' => __('Type one'), 'more' => __('Type more')];
|
|
}
|
|
|
|
|
|
public function getIsCommonTextAttr($value, $data)
|
|
{
|
|
$value = $value ? $value : (isset($data['is_common']) ? $data['is_common'] : '');
|
|
$list = $this->getIsCommonList();
|
|
return isset($list[$value]) ? $list[$value] : '';
|
|
}
|
|
|
|
|
|
public function getIsOnlyBoyTextAttr($value, $data)
|
|
{
|
|
$value = $value ? $value : (isset($data['is_only_boy']) ? $data['is_only_boy'] : '');
|
|
$list = $this->getIsOnlyBoyList();
|
|
return isset($list[$value]) ? $list[$value] : '';
|
|
}
|
|
|
|
|
|
public function getIsOnlyGirlTextAttr($value, $data)
|
|
{
|
|
$value = $value ? $value : (isset($data['is_only_girl']) ? $data['is_only_girl'] : '');
|
|
$list = $this->getIsOnlyGirlList();
|
|
return isset($list[$value]) ? $list[$value] : '';
|
|
}
|
|
|
|
|
|
public function getTypeTextAttr($value, $data)
|
|
{
|
|
$value = $value ? $value : (isset($data['type']) ? $data['type'] : '');
|
|
$list = $this->getTypeList();
|
|
return isset($list[$value]) ? $list[$value] : '';
|
|
}
|
|
|
|
|
|
|
|
|
|
public function hdrdepartment()
|
|
{
|
|
return $this->belongsTo('Hdrdepartment', 'hdrdepartment_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
|
}
|
|
}
|