diff --git a/application/service/handler/ReceiveHandler.php b/application/service/handler/ReceiveHandler.php index b145cc7bf..9e27fc309 100644 --- a/application/service/handler/ReceiveHandler.php +++ b/application/service/handler/ReceiveHandler.php @@ -59,7 +59,9 @@ class ReceiveHandler if (is_array($json = json_decode($result, true))) { p('===== 已返回xml加密内容 ====='); p($json); - return $service->reply($json, true, $service->isEncrypt()); + $xml = $service->reply($json, true, $service->isEncrypt()); + p($xml); + return $xml; } else { p('===== 直接回复返回的内容 ====='); return $result; diff --git a/application/wechat/controller/api/Push.php b/application/wechat/controller/api/Push.php index a8bd726a1..033cf0c8d 100644 --- a/application/wechat/controller/api/Push.php +++ b/application/wechat/controller/api/Push.php @@ -94,7 +94,6 @@ class Push extends Controller public function index() { try { - $this->wechat = WechatService::WeChatReceive(); if ($this->request->has('receive', 'post') && WechatService::getType() === 'thr') { $this->forceJson = true; // 强制返回JSON到服务端再转发 $this->forceCustom = false; // 暂停使用客户消息模式 @@ -108,6 +107,7 @@ class Push extends Controller } else { $this->forceJson = false; // 暂停返回JSON消息对象 $this->forceCustom = false; // 暂停使用客户消息模式 + $this->wechat = WechatService::WeChatReceive(); $this->appid = WechatService::getAppid(); $this->openid = $this->wechat->getOpenid(); $this->encrypt = $this->wechat->isEncrypt();