You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.1 KiB
54 lines
1.1 KiB
<?php
|
|
|
|
namespace app\common\model\user;
|
|
|
|
use app\common\enum\user\IdentityEnum;
|
|
use cores\BaseModel;
|
|
|
|
class Identity extends BaseModel
|
|
{
|
|
// 定义表名
|
|
protected $name = 'user_identity_price';
|
|
|
|
// 定义主键
|
|
protected $pk = 'identity_id';
|
|
|
|
protected $updateTime = false;
|
|
|
|
/**
|
|
* 追加字段
|
|
* @var array
|
|
*/
|
|
protected $append = [
|
|
'type_text', //身份文字描述
|
|
];
|
|
|
|
/**
|
|
* 获取器:身份文字描述
|
|
* @param $value
|
|
* @param $data
|
|
* @return string
|
|
*/
|
|
public function getTypeTextAttr($value, $data): string
|
|
{
|
|
// 身份
|
|
$result = IdentityEnum::data();
|
|
if (!empty($result[$data['type']]['name'])) {
|
|
return $result[$data['type']]['name'];
|
|
}
|
|
return '未知';
|
|
}
|
|
|
|
/**
|
|
* @notes:详情
|
|
* @param $where
|
|
* @param array $with
|
|
* @return static|array|null
|
|
* @author: wanghousheng
|
|
*/
|
|
public static function detail($where, array $with = [])
|
|
{
|
|
return static::get($where, $with);
|
|
}
|
|
|
|
} |