Kirin il y a 3 ans
Parent
commit
3a41cc6c3f
1 fichiers modifiés avec 21 ajouts et 21 suppressions
  1. 21 21
      app/http/middleware/AuthTokenMiddleware.php

+ 21 - 21
app/http/middleware/AuthTokenMiddleware.php

@@ -31,27 +31,27 @@ class AuthTokenMiddleware implements MiddlewareInterface
         try {
             $authInfo = UserRepository::parseToken($token);
             if (!is_null($authInfo)) {
-                $sub_uid = $request->header('UID', 0);
-                if ($authInfo['user']['main_uid'] == 0) {
-                    $check = function ($item) use ($authInfo) {
-                        return User::getUserInfo($item)['main_uid'] == $authInfo['user']['uid'] || User::getUserInfo($item)['uid'] == $authInfo['user']['uid'];
-                    };
-                } else {
-                    $check = function ($item) use ($authInfo) {
-                        return (User::getUserInfo($item)['main_uid'] == $authInfo['user']['main_uid']) || User::getUserInfo($item)['uid'] == $authInfo['user']['main_uid'];
-                    };
-                }
-                if ($sub_uid) {
-                    if ($check($sub_uid)) {
-                        $authInfo['user'] = User::where('uid', $sub_uid)->find();
-                    }
-                    $main_user = User::getUserInfo($authInfo['user']['main_uid'] ?: $authInfo['user']['uid']);
-                    if ($main_user['real_check'] == 1) {
-                        $authInfo['user']['real_check'] = 1;
-                        $authInfo['user']['real_name'] = $main_user['real_name'];
-                        $authInfo['user']['card_id'] = $main_user['card_id'];
-                    }
-                }
+//                $sub_uid = $request->header('UID', 0);
+//                if ($authInfo['user']['main_uid'] == 0) {
+//                    $check = function ($item) use ($authInfo) {
+//                        return User::getUserInfo($item)['main_uid'] == $authInfo['user']['uid'] || User::getUserInfo($item)['uid'] == $authInfo['user']['uid'];
+//                    };
+//                } else {
+//                    $check = function ($item) use ($authInfo) {
+//                        return (User::getUserInfo($item)['main_uid'] == $authInfo['user']['main_uid']) || User::getUserInfo($item)['uid'] == $authInfo['user']['main_uid'];
+//                    };
+//                }
+//                if ($sub_uid) {
+//                    if ($check($sub_uid)) {
+//                        $authInfo['user'] = User::where('uid', $sub_uid)->find();
+//                    }
+//                    $main_user = User::getUserInfo($authInfo['user']['main_uid'] ?: $authInfo['user']['uid']);
+//                    if ($main_user['real_check'] == 1) {
+//                        $authInfo['user']['real_check'] = 1;
+//                        $authInfo['user']['real_name'] = $main_user['real_name'];
+//                        $authInfo['user']['card_id'] = $main_user['card_id'];
+//                    }
+//                }
                 if (!$authInfo['user']['real_check'] && !in_array($request->action(), ['realNameCheck', 'logout', 'user', 'userinfo', 'upload_image', 'image'])) {
                     throw new AuthException('请先进行实名认证');
                 }