Ver Fonte

Merge branch 'wx-kw' into test

zqwang há 1 ano atrás
pai
commit
2ca9b26a00

+ 7 - 4
modules/Channel/Http/Controllers/WechatOpenPlatformController.php

@@ -136,13 +136,16 @@ class WechatOpenPlatformController extends CatchController
             'param' => $request->all(),
             'msg' => $message,
         ]);
-        $refreshToken = WechatOpenPlatformService::getRefreshToken($authorizer_appid,$component_appid);
-        $app = $openPlatform->officialAccount($authorizer_appid, $refreshToken);
-        $app->server->push(function ($message) use($authorizer_appid,$component_appid) {
+        $appInfo = WechatOpenPlatformService::getRefreshToken($authorizer_appid,$component_appid);
+        $wechatAppId = getProp($appInfo,'id');
+
+        $app = $openPlatform->officialAccount($authorizer_appid, getProp($appInfo,'authorizer_refresh_token'));
+        unset($appInfo);
+        $app->server->push(function ($message) use($app,$wechatAppId) {
             myLog("wx-xiaoxi")->info("----文本消息---");
             myLog("wx-xiaoxi")->info("体消息:");
             myLog("wx-xiaoxi")->info($message);
-            return WechatCommonService::handleMessage($authorizer_appid,$message);
+            return WechatCommonService::handleMessage($app,$wechatAppId ,$message);
         });
 
         myLog("wx-xiaoxi")->info('-------结束处理---'.get_date());

+ 1 - 1
modules/Channel/Services/WechatOpenPlatform/WechatOpenPlatformService.php

@@ -87,6 +87,6 @@ class WechatOpenPlatformService
             'component_appid' => $component_appid,
             'authorizer_appid' => $authorizer_appid,
             'is_enabled'  =>  1,
-        ])->value('authorizer_refresh_token');
+        ])->select('authorizer_refresh_token','id')->first();
     }
 }