wang hou sheng 9 months ago
parent 07f2d3a1bd
commit 7ee46d8019
  1. 1
      app/api/controller/Wxserver.php
  2. 13
      app/common/library/wxserver/Server.php

@ -77,7 +77,6 @@ class Wxserver extends BaseController
$data['Content'] = 'TESTCOMPONENT_MSG_TYPE_TEXT_callback';
echo $this->responseText($data);
} elseif (strpos($data['Content'], 'QUERY_AUTH_CODE:') !== false) {
Db::table('yoshop_wx_server')->insertGetId(['content' => '给客服发送消息', 'created_at' => $time]);
$query_auth_code = trim(str_replace("QUERY_AUTH_CODE:", "", $data['Content']));
$obj->apiText($query_auth_code, $data['FromUserName']);
}

@ -470,17 +470,14 @@ class Server
$result = $this->curlPost($url, json_encode($data));
$result = json_decode($result, true);
if (!empty($result['authorization_info']['authorizer_access_token'])) {
Db::table('yoshop_wx_server')->insertGetId(['content' => '获取到给客户发送信息token', 'created_at' => date('Y-m-d H:i:s')]);
$token = $result['authorization_info']['authorizer_access_token'];
$url = 'https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=' . $token;
$data = [];
$data['touser'] = $touser;
$data['msgtype'] = 'text';
$data['text'] = [
'content' => $authorization_code . '$_from_api',
$data = [
'touser' => $touser,
'msgtype' => 'text',
'text' => ['content' => $authorization_code . '_from_api'],
];
$arr = $this->curlPost($url, json_encode($data));
Db::table('yoshop_wx_server')->insertGetId(['content' => json_encode($arr), 'created_at' => date('Y-m-d H:i:s')]);
$this->curlPost($url, json_encode($data));
}
}

Loading…
Cancel
Save