dyjh 6 лет назад
Родитель
Сommit
1e8a35c916
3 измененных файлов с 8 добавлено и 5 удалено
  1. 4 4
      app/Http/Controllers/Web/AuthController.php
  2. 1 0
      app/Http/Kernel.php
  3. 3 1
      routes/web.php

+ 4 - 4
app/Http/Controllers/Web/AuthController.php

xqd xqd
@@ -16,9 +16,9 @@ class AuthController extends Controller
 {
     public function bind(Request $request)
     {
-      //  $user = session('wechat.oauth_user.default');
-       // dd($user);
-        $store_id = $request->input('store_id');
+        $user = session('wechat.oauth_user.default');
+        dd($user);
+        /*$store_id = $request->input('store_id');
         $weChatApp = AlbumManufacturerModel::where('store_id', $store_id)->first();
         $config = [
             'app_id' => $weChatApp->G_app_id,
@@ -30,7 +30,7 @@ class AuthController extends Controller
         $app = Factory::officialAccount($config);
         $response = $app->oauth
             ->redirect();
-        return $response;
+        return $response;*/
         //$res = $response->send();
       //  dd($res);
     }

+ 1 - 0
app/Http/Kernel.php

xqd
@@ -61,5 +61,6 @@ class Kernel extends HttpKernel
 
         //后台
         'auth.admin' => \App\Http\Middleware\AuthenticateAdmin::class,
+        'wechat.oauth' => \Overtrue\LaravelWeChat\Middleware\OAuthAuthenticate::class,
     ];
 }

+ 3 - 1
routes/web.php

xqd
@@ -40,5 +40,7 @@ Route::get('image/{md5}', [
 // });
 
 Route::get('/test', 'TestController@index');
-Route::get('/web/bind', 'Web\AuthController@bind');
+//Route::get('/web/bind', 'Web\AuthController@bind');
 Route::get('/web/notify', 'Web\AuthController@notify');
+Route::group(['prefix'=>'web','namespace'=>'Web','middleware' => ['web', 'wechat.oauth:snsapi_userinfo']],function (){
+    Route::any('bind','AuthController@bind');});