别的用户access_token就可以 2019-12-16 10:29:49 > Controller.INFO > 设置名称参数{"nick_name":"MSTUIDOS","license":"TmfKVwEPGtF4Wp7S94ivhiozEAAbn0qrgUZ1f_WIXrn0vV5_R_LnlSFsimS26a36Ta7If6fNlYvL9SxFMdzrO783qyJ3pW4xKYr6BtM5oUs","id_card":""} 2019-12-16 10:29:49 > Controller.INFO > 设置名称返回 {"errcode":0,"errmsg":"ok"
第三方平台小程序名称设置错误system error?APPID:wx110eacaab9b189622019-12-16 11:09:44 > Controller.INFO > 设置名称参数{"nick_name":"田仓摄影基地","license":"fk4EFZSqUNU6ZEvP0CuIgwbaMy3sgPYB4iSIVj3LKRxkKN3cFH9br0fS155MAG5hVRPaF4XQU5ngPPLYjI8K485wER0E-XsHLjFhbCps0RE","id_card":""} 2019-12-16 11:09:44 > Controller.INFO > 设置名称返回 {"errcode":-1,"errmsg":"system error"} 这个错误怎么破.. 谢谢工作人员
2019-12-16public function notify_msg($fromAppId){ CLogger::info('微信消息1',$_GET); CLogger::info('微信消息2'.file_get_contents("php://input") ); $timeStamp = $this->input->get_post('timestamp'); $nonce = $this->input->get_post('nonce'); $msg_sign = $this->input->get_post('msg_signature'); $encryptMsg = file_get_contents('php://input'); if(!$encryptMsg){ CLogger::error('notify_msg没有input'); echo 'error'; exit(); } $token = 'paitume'; $encodingAesKey = '后台定义的解密字符串43位'; $myAppId = '自己的第三方appid'; //解密消息 $pc = new WxBizMsgCrypt($token, $encodingAesKey, $myAppId); $xml_tree = new DOMDocument(); $xml_tree->loadXML($encryptMsg); $array_e = $xml_tree->getElementsByTagName('Encrypt'); $encrypt = $array_e->item(0)->nodeValue; //替换百分号 $format = "<xml><ToUserName><![CDATA[toUser]]></ToUserName><Encrypt><![CDATA[%s]]></Encrypt></xml>"; $from_xml = sprintf($format, $encrypt); // 解密 $msg = ''; $errCode = $pc->decryptMsg($msg_sign, $timeStamp, $nonce, $from_xml, $msg); if ($errCode == 0) { CLogger::info('解密成功',[$msg]); $xml = new DOMDocument(); $xml->loadXML($msg); $array_content = $xml->getElementsByTagName('Content'); $array_user = $xml->getElementsByTagName('FromUserName'); $fromUserOpenId = $array_user->item(0)->nodeValue; $content = $array_content->item(0)->nodeValue; if($content == 'TESTCOMPONENT_MSG_TYPE_TEXT'){ CLogger::info('发送TESTCOMPONENT_MSG_TYPE_TEXT_callback'); $time = time(); header("Content-type:text/xml"); $xml = new \SimpleXMLElement('<xml></xml>'); $sendData['ToUserName'] = $fromUserOpenId; $sendData['FromUserName'] ='gh_xxxxxxx';//你的原始appID $sendData['CreateTime'] = $time; $sendData['MsgType'] = 'text'; $sendData['Content'] = 'TESTCOMPONENT_MSG_TYPE_TEXT_callback'; $this->_data2xml($xml, $sendData); $str = $xml->asXML(); $sEncryptMsg = ""; //xml格式的密文 $errCode = $pc->encryptMsg($str, $time, $nonce, $sEncryptMsg); CLogger::info('加密消息'.$errCode.'---'.$sEncryptMsg); echo $sEncryptMsg; exit(); } else if(strpos($content,'QUERY_AUTH_CODE') !== false){ CLogger::info('消息包含QUERY_AUTH_CODE'.$content); echo ""; $queryAuthCode = str_replace('QUERY_AUTH_CODE:','',$content); $componentAccessToken = $this->getComponentAccessToken(); $url = 'https://api.weixin.qq.com/cgi-bin/component/api_query_auth?component_access_token='.$componentAccessToken; $authDataArray['component_appid'] = $myAppId; $authDataArray['authorization_code'] = $queryAuthCode; $authResult = $this->curl_post($url, json_encode($authDataArray)); CLogger::info('授权Auth返回',$authResult); $authorizationInfo = $authResult['authorization_info']; $authorizerAccessToken = $authorizationInfo['authorizer_access_token']; if($authorizerAccessToken){ $sendMsgUrl = 'https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token='.$authorizerAccessToken; $msgData['access_token'] = $authorizerAccessToken; $msgData['touser'] = $fromUserOpenId; $msgData['msgtype'] = 'text'; $msgData['text'] = ['content'=>$queryAuthCode.'_from_api']; $sendMsgResult = $this->curl_post($sendMsgUrl, json_encode($msgData)); CLogger::info('发送客服消息返回'.json_encode($sendMsgResult)); } } } else { CLogger::error('消息解密失败'); } }
递交全网发布的时候 消息与事件接收URL接受不到微信推送的消息?递交全网发布的时候 授权URL能收到2条 一条授权 一条取消授权 普通消息URL收不到 https://paitume.com/api/wx/notify_msg/$APPID$ 第三方服务APPID:wxbba5163d50a0ff41 测试号已经加入到白名单:授权测试公众号列表:gh_3c884a361561 但是经常修改后再修改就没有了?? [图片] 是不是这个原因导致没有消息 和代码无关 Nginx的日志并没有微信的记录 授权的正常 谢谢工作人员~
2019-09-29