|
@@ -3,7 +3,9 @@
|
|
namespace Modules\Channel\Http\Controllers;
|
|
namespace Modules\Channel\Http\Controllers;
|
|
|
|
|
|
use Catch\Base\CatchController;
|
|
use Catch\Base\CatchController;
|
|
|
|
+use EasyWeChat\OpenPlatform\Application;
|
|
use EasyWeChat\OpenPlatform\Server\Guard;
|
|
use EasyWeChat\OpenPlatform\Server\Guard;
|
|
|
|
+
|
|
use Illuminate\Foundation\Validation\ValidatesRequests;
|
|
use Illuminate\Foundation\Validation\ValidatesRequests;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\DB;
|
|
@@ -124,9 +126,9 @@ class WechatOpenPlatformController extends CatchController
|
|
{
|
|
{
|
|
|
|
|
|
$componentInfo = WechatOpenPlatformService::getComponentInfoByAppid($component_appid);
|
|
$componentInfo = WechatOpenPlatformService::getComponentInfoByAppid($component_appid);
|
|
- $app = WechatOpenPlatformService::buildApplication($componentInfo);
|
|
|
|
|
|
+ $openPlatform = WechatOpenPlatformService::buildApplication($componentInfo);
|
|
myLog("wx-xiaoxi")->info('-------开始处理---'.get_date());
|
|
myLog("wx-xiaoxi")->info('-------开始处理---'.get_date());
|
|
- $server = $app->server;
|
|
|
|
|
|
+ $server = $openPlatform->server;
|
|
$message = $server->getMessage();
|
|
$message = $server->getMessage();
|
|
myLog("wx-xiaoxi")->info([
|
|
myLog("wx-xiaoxi")->info([
|
|
'authorizer_appid' => $authorizer_appid,
|
|
'authorizer_appid' => $authorizer_appid,
|
|
@@ -135,15 +137,8 @@ class WechatOpenPlatformController extends CatchController
|
|
'msg' => $message,
|
|
'msg' => $message,
|
|
]);
|
|
]);
|
|
$refreshToken = WechatOpenPlatformService::getRefreshToken($authorizer_appid,$component_appid);
|
|
$refreshToken = WechatOpenPlatformService::getRefreshToken($authorizer_appid,$component_appid);
|
|
- $server = $app->officialAccount($authorizer_appid, $refreshToken);
|
|
|
|
- // $server->addMessageListener('text', function($message) {
|
|
|
|
- // myLog("wx-xiaoxi")->info('----文本消息---');
|
|
|
|
- // if ($message->Content == "pk"){
|
|
|
|
- // return $message->FromUserName;
|
|
|
|
- // }
|
|
|
|
- // });
|
|
|
|
-
|
|
|
|
- $server->server->push(function ($message) use($authorizer_appid,$component_appid) {
|
|
|
|
|
|
+ $app = $openPlatform->officialAccount($authorizer_appid, $refreshToken);
|
|
|
|
+ $app->server->push(function ($message) use($authorizer_appid,$component_appid) {
|
|
myLog("wx-xiaoxi")->info("----文本消息---");
|
|
myLog("wx-xiaoxi")->info("----文本消息---");
|
|
myLog("wx-xiaoxi")->info("体消息:");
|
|
myLog("wx-xiaoxi")->info("体消息:");
|
|
myLog("wx-xiaoxi")->info($message);
|
|
myLog("wx-xiaoxi")->info($message);
|
|
@@ -151,6 +146,7 @@ class WechatOpenPlatformController extends CatchController
|
|
});
|
|
});
|
|
|
|
|
|
myLog("wx-xiaoxi")->info('-------结束处理---'.get_date());
|
|
myLog("wx-xiaoxi")->info('-------结束处理---'.get_date());
|
|
- return $server->serve();
|
|
|
|
|
|
+
|
|
|
|
+ return $app->server->serve()->send();
|
|
}
|
|
}
|
|
}
|
|
}
|