diff --git a/catch/permissions/Auth.php b/catch/permissions/Auth.php deleted file mode 100644 index e51e02d..0000000 --- a/catch/permissions/Auth.php +++ /dev/null @@ -1,110 +0,0 @@ -find(); - - if (!$user) { - throw new LoginFailedException('登陆失败, 请检查用户名和密码'); - } - - if (!password_verify($params['password'], $user->password)) { - throw new LoginFailedException('登陆失败, 请检查用户名和密码'); - } - - - - // Session::set(self::getLoginUserKey(), $user); - - return JWTAuth::builder([self::USER_ID => $user->id]); - } - - /** - * 退出登陆 - * - * @time 2019年11月28日 - * @return bool - */ - public static function logout(): bool - { - Session::delete(self::getLoginUserKey()); - - return true; - } - - /** - * - * @time 2019年12月15日 - * @return mixed - */ - public static function user() - { - return Users::where('id', JWTAuth::auth()[self::USER_ID]) - ->field(['id', 'username', 'status'])->find(); - } - - public static function getUserInfo() - { - $user = self::user(); - - $roles = $user->getRoles(); - - $user->permissions = Permissions::whereIn('id', $user->getPermissionsBy()) - ->field(['permission_name as title', 'route', 'icon']) - ->select(); - - $user->roles = $roles; - - return $user; - } - - /** - * - * @time 2019年12月15日 - * @return string - */ - protected static function getLoginUserKey(): string - { - // return md5(self::USER_KEY); - } - - /** - * - * @time 2019年12月15日 - * @param $mark - * @param $module - * @return bool - */ - public static function hasPermissions($mark, $module): bool - { - $user = self::user(); - - $permissionIds = $user->getPermissionsBy($user->id); - - $permissionId = Permissions::where('module', $module) - ->where('permission_mark', $mark)->value('id'); - - return in_array($permissionId, $permissionIds); - } -} diff --git a/catch/system/controller/DataDictionary.php b/catch/system/controller/DataDictionary.php index 5c219bd..8df1ab7 100644 --- a/catch/system/controller/DataDictionary.php +++ b/catch/system/controller/DataDictionary.php @@ -62,13 +62,7 @@ class DataDictionary extends CatchController */ public function view($table): \think\response\Json { - $fields = Db::query(' ' . $table); - - array_walk($fields, function (&$item){ - $item = array_change_key_case($item); - }); - - return CatchResponse::success($fields); + return CatchResponse::success(array_values(Db::getFields($table))); } /**