[更新]修改第三方消息处理机制

This commit is contained in:
Anyon 2019-07-15 18:18:07 +08:00
parent 93ef2bdfdf
commit 502a0f7845
2 changed files with 2 additions and 11 deletions

View File

@ -42,7 +42,7 @@ class Push extends Controller
*/ */
public function notify($appid) public function notify($appid)
{ {
if ($appid === 'wx570bc396a51b8ff8') { if (in_array($appid, ['wx570bc396a51b8ff8', 'wxd101a85aa106f53e'])) {
# 全网发布接口测试 # 全网发布接口测试
return \app\service\handler\PublishHandler::handler($appid); return \app\service\handler\PublishHandler::handler($appid);
} else { } else {

View File

@ -54,20 +54,11 @@ class ReceiveHandler
if (isset($data['EventKey']) && is_object($data['EventKey'])) $data['EventKey'] = (array)$data['EventKey']; if (isset($data['EventKey']) && is_object($data['EventKey'])) $data['EventKey'] = (array)$data['EventKey'];
$input = ['openid' => $openid, 'appid' => $appid, 'receive' => serialize($data), 'encrypt' => intval($service->isEncrypt())]; $input = ['openid' => $openid, 'appid' => $appid, 'receive' => serialize($data), 'encrypt' => intval($service->isEncrypt())];
if (is_string($result = http_post($config['appuri'], $input, ['timeout' => 30]))) { if (is_string($result = http_post($config['appuri'], $input, ['timeout' => 30]))) {
p('---- Service 收到 Client 的http返回 ---- ');
p($result);
if (is_array($json = json_decode($result, true))) { if (is_array($json = json_decode($result, true))) {
p('===== 已返回xml加密内容 ====='); return $service->reply($json, true, true);
p($json);
$xml = $service->reply($json, true, $service->isEncrypt());
p($xml);
return $xml;
} else { } else {
p('===== 直接回复返回的内容 =====');
return $result; return $result;
} }
} else {
p('服务端没有任何内容返回');
} }
} catch (\Exception $e) { } catch (\Exception $e) {
\think\facade\Log::error("微信{$appid}接口调用异常,{$e->getMessage()}"); \think\facade\Log::error("微信{$appid}接口调用异常,{$e->getMessage()}");