This commit is contained in:
aozhiwei 2019-10-24 10:26:57 +08:00
parent f04143038a
commit 2cee273b56

View File

@ -308,6 +308,7 @@ class KefuController {
private function processText($msg, $accountid)
{
$this->createUser($accountid);
$openid = $msg['FromUserName'];
$CreateTime = $msg['CreateTime'];
//$text = $msg['Content'];
@ -373,26 +374,30 @@ class KefuController {
private function processEvent($msg, $accountid)
{
if ($msg['Event'] == 'user_enter_tempsession') {
$conn = $this->getMysql($accountid);
$ret = $conn->execScript('INSERT INTO accounts(accountid, channel, gameid, openid, awardtime, activetime) ' .
'SELECT :accountid, :channel, :gameid, :openid, :awardtime, :activetime ' .
'FROM DUAL ' .
'WHERE NOT EXISTS(SELECT accountid FROM accounts WHERE accountid=:accountid);',
array(
':accountid' => $accountid,
':channel' => WEIXIN_CHANNEL,
':gameid' => phpcommon\extractGameId($accountid),
':openid' => $msg['FromUserName'],
':awardtime' => 0,
':activetime' => 0
));
if ($ret) {
$this->sendKefuMsg($accountid, array(
"touser" => $msg['FromUserName'],
"msgtype" => "text",
//"text" => array("content" => "您好,有什么能帮助你? \n ")
));
}
$this->createUser($accountid);
}
}
private function createUser($accountid) {
$conn = $this->getMysql($accountid);
$ret = $conn->execScript('INSERT INTO accounts(accountid, channel, gameid, openid, awardtime, activetime) ' .
'SELECT :accountid, :channel, :gameid, :openid, :awardtime, :activetime ' .
'FROM DUAL ' .
'WHERE NOT EXISTS(SELECT accountid FROM accounts WHERE accountid=:accountid);',
array(
':accountid' => $accountid,
':channel' => WEIXIN_CHANNEL,
':gameid' => phpcommon\extractGameId($accountid),
':openid' => $msg['FromUserName'],
':awardtime' => 0,
':activetime' => 0
));
if ($ret) {
$this->sendKefuMsg($accountid, array(
"touser" => $msg['FromUserName'],
"msgtype" => "text",
//"text" => array("content" => "您好,有什么能帮助你? \n ")
));
}
}