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.
39 lines
1003 B
39 lines
1003 B
<?php
|
|
|
|
namespace app\model;
|
|
|
|
use think\Env;
|
|
|
|
class AuthRoleModel extends BaseModel
|
|
{
|
|
const STATUS_ON = 1; // 用户启用状态
|
|
const STATUS_FORBID = 2; // 用户禁用状态
|
|
const NAME_ADMIN = '超级管理员';
|
|
const NAME_AGENT = '代理';
|
|
const NAME_DIRECTOR = '总监';
|
|
const NAME_TEAM_HEADER = '组长';
|
|
const NAME_CUSTOMER = '客服';
|
|
const NAME_SELLER = '电销';
|
|
const NAME_TRANSLATOR = '翻译员';
|
|
|
|
|
|
protected $name = 'auth_role';
|
|
|
|
/**
|
|
* @desc 根据用户id 查询指定字段
|
|
* @param $fields
|
|
* @param $userId
|
|
* @return array
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
* @throws \think\db\exception\DbException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
*/
|
|
public static function getFieldsById($fields, $id): array
|
|
{
|
|
$self = self::where('id', $id)->field($fields)->find();
|
|
if(empty($self)){
|
|
return [];
|
|
}
|
|
return $self->toArray();
|
|
}
|
|
}
|