1
This commit is contained in:
parent
33115ca733
commit
d018c15443
@ -443,7 +443,7 @@ class KefuController {
|
|||||||
#error_log('dot save to db');
|
#error_log('dot save to db');
|
||||||
$kefu_info = array(
|
$kefu_info = array(
|
||||||
'accountid' => $accountid,
|
'accountid' => $accountid,
|
||||||
'channel' => 6001,
|
'channel' => WEIXIN_CHANNEL,
|
||||||
'gameid' => phpcommon\extractGameId($accountid),
|
'gameid' => phpcommon\extractGameId($accountid),
|
||||||
'openid' => $openid,
|
'openid' => $openid,
|
||||||
'awardtime' => '0'
|
'awardtime' => '0'
|
||||||
@ -463,32 +463,25 @@ class KefuController {
|
|||||||
|
|
||||||
private function responseMsg()
|
private function responseMsg()
|
||||||
{
|
{
|
||||||
$postStr_key = $GLOBALS["HTTP_RAW_POST_DATA"];
|
$msg_str = '';
|
||||||
$gameid = $_REQUEST['gameid'];
|
|
||||||
$msg_sign = $_REQUEST['msg_signature'];
|
|
||||||
$timeStamp = $_REQUEST['timestamp'];
|
|
||||||
$nonce = $_REQUEST['nonce'];
|
|
||||||
|
|
||||||
$pc = new WXBizMsgCrypt(WEIXIN_TOKEN, WEIXIN_MSG_KEY, WEIXIN_APP_ID);
|
$pc = new WXBizMsgCrypt(WEIXIN_TOKEN, WEIXIN_MSG_KEY, WEIXIN_APP_ID);
|
||||||
$errcode = $pc->decryptJsonMsg($msg_sign, $timeStamp, $nonce, $postStr_key, $postStr);
|
$errcode = $pc->decryptJsonMsg($_REQUEST['msg_signature'],
|
||||||
|
$_REQUEST['timestamp'],
|
||||||
|
$_REQUEST['nonce'],
|
||||||
|
file_get_contents('php://input'),
|
||||||
|
$msg);
|
||||||
if ($errcode == 0) {
|
if ($errcode == 0) {
|
||||||
#error_log("解密后: " . $postStr . "\n");
|
$msg = json_decode($msg_str, true);
|
||||||
if (!empty( $postStr ) && is_string( $postStr )){
|
$accountid = phpcommon\createAccountId(WEIXIN_CHANNEL, $_REQUEST['gameid'], $msg['FromUserName']);
|
||||||
$postArr = json_decode( $postStr , true );
|
|
||||||
$accountid = phpcommon\createAccountId(6001, $gameid, $postArr['FromUserName']);
|
|
||||||
|
|
||||||
if (!empty( $postArr ['MsgType']) && $postArr['MsgType'] == 'text'){ // 文本消息
|
if (!empty( $msg ['MsgType']) && $msg['MsgType'] == 'text'){ // 文本消息
|
||||||
$this->disposeText($postArr, $accountid);
|
$this->disposeText($msg, $accountid);
|
||||||
} elseif (!empty( $postArr ['MsgType']) && $postArr['MsgType'] == 'image'){ // 图文消息
|
} elseif (!empty( $msg ['MsgType']) && $msg['MsgType'] == 'image'){ // 图文消息
|
||||||
$this->disposeImage($postArr, $accountid);
|
$this->disposeImage($msg, $accountid);
|
||||||
} elseif (!empty( $postArr ['MsgType']) && $postArr['MsgType'] == 'event' ){ // 进入客服动作
|
} elseif (!empty( $msg ['MsgType']) && $msg['MsgType'] == 'event' ){ // 进入客服动作
|
||||||
$this->disposeEvent($postArr, $accountid);
|
$this->disposeEvent($msg, $accountid);
|
||||||
} else {
|
|
||||||
exit ();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
echo "" ;
|
exit ();
|
||||||
exit ;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
#error_log($errcode . "\n");
|
#error_log($errcode . "\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user