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.
30 lines
740 B
30 lines
740 B
2 months ago
|
<?php
|
||
|
|
||
|
namespace app\model;
|
||
|
|
||
|
use think\Env;
|
||
|
|
||
|
class AuthRoleModel extends BaseModel
|
||
|
{
|
||
|
protected $name = 'auth_role';
|
||
|
const STATUS_ON = 1; // 用户启用状态
|
||
|
const STATUS_FORBID = 2; // 用户禁用状态
|
||
|
|
||
|
/**
|
||
|
* @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();
|
||
|
}
|
||
|
}
|