dyjh hace 6 años
padre
commit
76c72a0c95

+ 21 - 1
app/Http/Controllers/Web/AuthController.php

xqd xqd
@@ -24,7 +24,7 @@ class AuthController extends Controller
             'response_type' => 'array',
             'oauth' => [
                 'scopes'   => ['snsapi_userinfo'],
-                'callback' => '/web/notify',
+                'callback' => '/web/notify?store_id=' . $store_id,
             ]
 
         ];
@@ -37,7 +37,27 @@ class AuthController extends Controller
     }
     public function notify(Request $request)
     {
+        $store_id = $request->input('store_id');
+        $weChatApp = AlbumManufacturerModel::where('store_id', $store_id)->first();
+        $config = [
+            'app_id' => $weChatApp->G_app_id,
+            'secret' => $weChatApp->G_app_secret,
+            'response_type' => 'array',
+            'oauth' => [
+                'scopes'   => ['snsapi_userinfo'],
+                'callback' => '/web/notify',
+            ]
+        ];
+        $app = Factory::officialAccount($config);
+        $oauth = $app->oauth;
+// 获取 OAuth 授权结果用户信息
+        $user = $oauth->user();
+        dd($user);
         \Log::info('授权回调');
     }
 
+    public function welcome()
+    {
+        return view('welcome');
+    }
 }

+ 0 - 1
app/Http/Middleware/AuthenticateAdmin.php

xqd
@@ -24,7 +24,6 @@ class AuthenticateAdmin
         if ($path == 'admin') {
             $path = str_replace('admin' ,'/', $path);
         }else{
-            dd(111);
             $path = str_replace('admin/' ,'', $path);
         }
         $role = session(LOGIN_MARK_SESSION_KEY);

+ 1 - 1
routes/web.php

xqd
@@ -12,7 +12,7 @@
 */
 
 Route::get('/', function () {
-    return redirect('/web/bind');
+    return view('welcome');
 });