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.
 
 
 
 
 
 

58 lines
1.2 KiB

<?php
namespace app\admin\model;
use think\Model;
class UserGroup extends Model
{
// 表名
protected $name = 'user_group';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'int';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
// 追加属性
protected $append = [
'status_text'
];
//角色唯一值
public static $group_type = [
[
'id' => 1,
'name' => '企业管理员'
],
[
'id' => 2,
'name' => '平台管理员'
],
[
'id' => 3,
'name' => '商城管理员'
],
[
'id' => 4,
'name' => '进销存管理员'
],
[
'id' => 5,
'name' => '工程管理员'
],
];
public function getStatusList()
{
return ['normal' => __('Normal'), 'hidden' => __('Hidden')];
}
public function getStatusTextAttr($value, $data)
{
$value = $value ? $value : $data['status'];
$list = $this->getStatusList();
return isset($list[$value]) ? $list[$value] : '';
}
}