This commit is contained in:
aozhiwei 2019-07-04 11:32:18 +08:00
parent 5578d5dc4a
commit 684248cdb4

View File

@ -105,7 +105,6 @@ class KefuController {
$gameid = $_REQUEST['gameid'];
$config_name = "../config/game$gameid/weixin/config.php";
require $config_name;
if (isset($_REQUEST['echostr'])) {
if ($this->checkSignature()) {
echo $_REQUEST['echostr'];
@ -125,6 +124,7 @@ class KefuController {
$msg_str);
if ($errcode == 0) {
$msg = json_decode($msg_str, true);
//error_log(json_encode($msg));
$accountid = phpcommon\createAccountId(WEIXIN_CHANNEL, $_REQUEST['gameid'], $msg['FromUserName']);
switch ($msg['MsgType']) {
case 'event':
@ -145,6 +145,12 @@ class KefuController {
die('not implement');
break;
}
case 'miniprogrampage':
{
// 小程序消息
$this->processText($msg, $accountid);
break;
}
}
} else {
#error_log($errcode . "\n");
@ -238,8 +244,14 @@ class KefuController {
{
$openid = $msg['FromUserName'];
$CreateTime = $msg['CreateTime'];
$text = $msg['Content'];
//$text = $msg['Content'];
$text = '';
$gameid = phpcommon\extractGameId($accountid);
if (strcmp($msg['MsgType'], 'miniprogrampage') == 0) {
$text = 1;
} else {
$text = $msg['Content'];
}
$awardConfig = $this->getAwardConfig($gameid, $text);
if (!isset($awardConfig)) {
$this->sendKefuMsg($accountid, array (
@ -272,8 +284,8 @@ class KefuController {
));
return;
}
if ($this->sendAwardMail($accountid, $awardConfig)) {
error_log(json_encode($awardConfig));
$ret = $conn->execScript("UPDATE accounts SET " .
' awardtime=:awardtime ' .
'WHERE accountid=:accountid; ',