where(['id' => $role_id]) ->value('name'); return empty($role_name) ? '系统管理员' : $role_name; } /** * Notes: 获取全部角色名称(以角色id为键,值为名称) * @param array $contidion * @author 段誉(2021/4/10 10:46) * @return array */ public function getNameColumn($contidion = []) { $role_name = $this ->where($contidion) ->where('del', 0) ->column('name', 'id'); return $role_name; } /** * Notes: * @param array $where * @param string $field * @author 段誉(2021/4/10 11:13) * @return \think\Collection * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function getRoleLists($where = [], $field = "*") { return $this->where(['del' => 0])->where($where)->field($field)->select(); } }