mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
[更新]修改第三方消息处理机制
This commit is contained in:
parent
1717fcfd85
commit
109764ad53
@ -52,10 +52,7 @@ class PublishHandler
|
|||||||
case 'text':
|
case 'text':
|
||||||
$receive = $wechat->getReceive();
|
$receive = $wechat->getReceive();
|
||||||
if ($receive['Content'] === 'TESTCOMPONENT_MSG_TYPE_TEXT') {
|
if ($receive['Content'] === 'TESTCOMPONENT_MSG_TYPE_TEXT') {
|
||||||
$xml = $wechat->text('TESTCOMPONENT_MSG_TYPE_TEXT_callback')->reply([], true);
|
return $wechat->text('TESTCOMPONENT_MSG_TYPE_TEXT_callback')->reply([], true);
|
||||||
p('====测试回复文本======');
|
|
||||||
p($xml);
|
|
||||||
return $xml;
|
|
||||||
} else {
|
} else {
|
||||||
$key = str_replace("QUERY_AUTH_CODE:", '', $receive['Content']);
|
$key = str_replace("QUERY_AUTH_CODE:", '', $receive['Content']);
|
||||||
WechatService::instance('Service')->getQueryAuthorizerInfo($key);
|
WechatService::instance('Service')->getQueryAuthorizerInfo($key);
|
||||||
|
@ -55,12 +55,7 @@ class ReceiveHandler
|
|||||||
$input = ['openid' => $openid, 'appid' => $appid, 'receive' => serialize($data), 'encrypt' => intval($wechat->isEncrypt())];
|
$input = ['openid' => $openid, 'appid' => $appid, 'receive' => serialize($data), 'encrypt' => intval($wechat->isEncrypt())];
|
||||||
if (is_string($result = http_post($config['appuri'], $input, ['timeout' => 30]))) {
|
if (is_string($result = http_post($config['appuri'], $input, ['timeout' => 30]))) {
|
||||||
if (is_array($json = json_decode($result, true))) {
|
if (is_array($json = json_decode($result, true))) {
|
||||||
$xml = $wechat->reply($json, true, $wechat->isEncrypt());
|
return $wechat->reply($json, true, $wechat->isEncrypt());
|
||||||
p("");
|
|
||||||
p("====== 准备回复的内容如下 ========");
|
|
||||||
p($xml);
|
|
||||||
ob_clean();
|
|
||||||
exit($xml);
|
|
||||||
} else {
|
} else {
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
@ -95,8 +95,8 @@ class Push extends Controller
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if ($this->request->has('receive', 'post') && WechatService::getType() === 'thr') {
|
if ($this->request->has('receive', 'post') && WechatService::getType() === 'thr') {
|
||||||
$this->forceJson = true; // 强制返回JSON到服务端再转发
|
$this->forceJson = false; // 强制返回JSON到服务端再转发
|
||||||
$this->forceCustom = false; // 暂停使用客户消息模式
|
$this->forceCustom = true; // 强制使用客户消息模式
|
||||||
$this->appid = $this->request->post('appid', '', null);
|
$this->appid = $this->request->post('appid', '', null);
|
||||||
$this->openid = $this->request->post('openid', '', null);
|
$this->openid = $this->request->post('openid', '', null);
|
||||||
$this->encrypt = boolval($this->request->post('encrypt', 0));
|
$this->encrypt = boolval($this->request->post('encrypt', 0));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user