remove responseMsg
This commit is contained in:
parent
27a50bfdbe
commit
be0443b4a2
@ -207,8 +207,43 @@ class KefuController {
|
|||||||
} else {
|
} else {
|
||||||
echo 'signature error';
|
echo 'signature error';
|
||||||
}
|
}
|
||||||
|
die();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$msg_str = '';
|
||||||
|
$pc = new WXBizMsgCrypt(WEIXIN_TOKEN, WEIXIN_MSG_KEY, WEIXIN_APP_ID);
|
||||||
|
$errcode = $pc->decryptJsonMsg($_REQUEST['msg_signature'],
|
||||||
|
$_REQUEST['timestamp'],
|
||||||
|
$_REQUEST['nonce'],
|
||||||
|
file_get_contents('php://input'),
|
||||||
|
$msg_str);
|
||||||
|
if ($errcode == 0) {
|
||||||
|
$msg = json_decode($msg_str, true);
|
||||||
|
$accountid = phpcommon\createAccountId(WEIXIN_CHANNEL, $_REQUEST['gameid'], $msg['FromUserName']);
|
||||||
|
|
||||||
|
switch ($msg['MsgType']) {
|
||||||
|
case 'text':
|
||||||
|
{
|
||||||
|
// 文本消息
|
||||||
|
$this->processText($msg, $accountid);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'image':
|
||||||
|
{
|
||||||
|
// 图文消息
|
||||||
|
$this->processImage($msg, $accountid);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'event':
|
||||||
|
{
|
||||||
|
// 进入客服动作
|
||||||
|
$this->processEvent($msg, $accountid);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->responseMsg();
|
#error_log($errcode . "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -374,16 +409,11 @@ class KefuController {
|
|||||||
|
|
||||||
private function processImage($msg, $accountid)
|
private function processImage($msg, $accountid)
|
||||||
{
|
{
|
||||||
$openid = $msg['FromUserName'];
|
die('not implement');
|
||||||
$CreateTime = $msg['CreateTime'];
|
|
||||||
die();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function processEvent($msg, $accountid)
|
private function processEvent($msg, $accountid)
|
||||||
{
|
{
|
||||||
$openid = $msg['FromUserName'];
|
|
||||||
$CreateTime = $msg['CreateTime'];
|
|
||||||
|
|
||||||
if ($msg['Event'] == 'user_enter_tempsession') {
|
if ($msg['Event'] == 'user_enter_tempsession') {
|
||||||
$conn = $this->getMysql($accountid);
|
$conn = $this->getMysql($accountid);
|
||||||
$ret = $conn->execScript('INSERT INTO accounts_kefu(accountid, channel, gameid, openid, awardtime) ' .
|
$ret = $conn->execScript('INSERT INTO accounts_kefu(accountid, channel, gameid, openid, awardtime) ' .
|
||||||
@ -394,52 +424,16 @@ class KefuController {
|
|||||||
':accountid' => $accountid,
|
':accountid' => $accountid,
|
||||||
':channel' => WEIXIN_CHANNEL,
|
':channel' => WEIXIN_CHANNEL,
|
||||||
':gameid' => phpcommon\extractGameId($accountid),
|
':gameid' => phpcommon\extractGameId($accountid),
|
||||||
':openid' => $openid,
|
':openid' => $msg['FromUserName'],
|
||||||
':awardtime' => 0
|
':awardtime' => 0
|
||||||
));
|
));
|
||||||
$this->sendMsg($accountid, array(
|
if ($ret) {
|
||||||
"touser" => $openid,
|
$this->sendMsg($accountid, array(
|
||||||
"msgtype" => "text",
|
"touser" => $msg['FromUserName'],
|
||||||
"text" => array ("content" => "您好,有什么能帮助你? \n回复指定文字领取奖励。 ")
|
"msgtype" => "text",
|
||||||
));
|
"text" => array("content" => "您好,有什么能帮助你? \n回复指定文字领取奖励。 ")
|
||||||
}
|
));
|
||||||
}
|
|
||||||
|
|
||||||
private function responseMsg()
|
|
||||||
{
|
|
||||||
$msg_str = '';
|
|
||||||
$pc = new WXBizMsgCrypt(WEIXIN_TOKEN, WEIXIN_MSG_KEY, WEIXIN_APP_ID);
|
|
||||||
$errcode = $pc->decryptJsonMsg($_REQUEST['msg_signature'],
|
|
||||||
$_REQUEST['timestamp'],
|
|
||||||
$_REQUEST['nonce'],
|
|
||||||
file_get_contents('php://input'),
|
|
||||||
$msg_str);
|
|
||||||
if ($errcode == 0) {
|
|
||||||
$msg = json_decode($msg_str, true);
|
|
||||||
$accountid = phpcommon\createAccountId(WEIXIN_CHANNEL, $_REQUEST['gameid'], $msg['FromUserName']);
|
|
||||||
|
|
||||||
switch ($msg['MsgType']) {
|
|
||||||
case 'text':
|
|
||||||
{
|
|
||||||
// 文本消息
|
|
||||||
$this->processText($msg, $accountid);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case 'image':
|
|
||||||
{
|
|
||||||
// 图文消息
|
|
||||||
$this->processImage($msg, $accountid);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'event':
|
|
||||||
{
|
|
||||||
// 进入客服动作
|
|
||||||
$this->processEvent($msg, $accountid);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
#error_log($errcode . "\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user