瀏覽代碼

直接返回授权链接

liuzejian 1 年之前
父節點
當前提交
0960a73225

+ 2 - 1
modules/Channel/Http/Controllers/WechatOpenPlatformController.php

@@ -30,7 +30,8 @@ class WechatOpenPlatformController extends CatchController
         $app = WechatOpenPlatformService::buildApplication($componentInfo);
         $user_id = $request->input('user_id');
         $url = $app->createPreAuthorizationUrl(sprintf('%s/api/channel/openPlatform/auth/%s/%s',config('app.url'), $componentInfo->app_id, $user_id), []);
-        return view('wechat.openPlatform.preauth')->with('url', $url);
+//        return view('wechat.openPlatform.preauth')->with('url', $url);
+        return $url;
     }
 
     public function auth(Request $request, $component_appid, $user_id) {

+ 1 - 1
modules/Channel/routes/route.php

@@ -55,7 +55,7 @@ Route::prefix('channel')->group(function () {
      */
     Route::prefix('openPlatform')->group(function(){
         Route::get('auth/{component_appid}/{user_id}', [WechatOpenPlatformController::class, 'auth'])->withoutMiddleware(config('catch.route.middlewares'));
-        Route::get('preauth', [WechatOpenPlatformController::class, 'preauth'])->withoutMiddleware(config('catch.route.middlewares'));
+        Route::get('preauth', [WechatOpenPlatformController::class, 'preauth']);
         Route::post('authorCommand/{component_appid}', [WechatOpenPlatformController::class, 'authorCommand'])->withoutMiddleware(config('catch.route.middlewares'));
         Route::post('infoCommand/{authorizer_appid}/{component_appid}', [WechatOpenPlatformController::class, 'infoCommand'])->withoutMiddleware(config('catch.route.middlewares'));
     });