| 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,
|
|
|
]
|
|
|
|
|
|
];
|
| xqd
@@ -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');
|
|
|
+ }
|
|
|
}
|