1
This commit is contained in:
parent
f04143038a
commit
2cee273b56
@ -308,6 +308,7 @@ class KefuController {
|
|||||||
|
|
||||||
private function processText($msg, $accountid)
|
private function processText($msg, $accountid)
|
||||||
{
|
{
|
||||||
|
$this->createUser($accountid);
|
||||||
$openid = $msg['FromUserName'];
|
$openid = $msg['FromUserName'];
|
||||||
$CreateTime = $msg['CreateTime'];
|
$CreateTime = $msg['CreateTime'];
|
||||||
//$text = $msg['Content'];
|
//$text = $msg['Content'];
|
||||||
@ -373,26 +374,30 @@ class KefuController {
|
|||||||
private function processEvent($msg, $accountid)
|
private function processEvent($msg, $accountid)
|
||||||
{
|
{
|
||||||
if ($msg['Event'] == 'user_enter_tempsession') {
|
if ($msg['Event'] == 'user_enter_tempsession') {
|
||||||
$conn = $this->getMysql($accountid);
|
$this->createUser($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);',
|
private function createUser($accountid) {
|
||||||
array(
|
$conn = $this->getMysql($accountid);
|
||||||
':accountid' => $accountid,
|
$ret = $conn->execScript('INSERT INTO accounts(accountid, channel, gameid, openid, awardtime, activetime) ' .
|
||||||
':channel' => WEIXIN_CHANNEL,
|
'SELECT :accountid, :channel, :gameid, :openid, :awardtime, :activetime ' .
|
||||||
':gameid' => phpcommon\extractGameId($accountid),
|
'FROM DUAL ' .
|
||||||
':openid' => $msg['FromUserName'],
|
'WHERE NOT EXISTS(SELECT accountid FROM accounts WHERE accountid=:accountid);',
|
||||||
':awardtime' => 0,
|
array(
|
||||||
':activetime' => 0
|
':accountid' => $accountid,
|
||||||
));
|
':channel' => WEIXIN_CHANNEL,
|
||||||
if ($ret) {
|
':gameid' => phpcommon\extractGameId($accountid),
|
||||||
$this->sendKefuMsg($accountid, array(
|
':openid' => $msg['FromUserName'],
|
||||||
"touser" => $msg['FromUserName'],
|
':awardtime' => 0,
|
||||||
"msgtype" => "text",
|
':activetime' => 0
|
||||||
//"text" => array("content" => "您好,有什么能帮助你? \n ")
|
));
|
||||||
));
|
if ($ret) {
|
||||||
}
|
$this->sendKefuMsg($accountid, array(
|
||||||
|
"touser" => $msg['FromUserName'],
|
||||||
|
"msgtype" => "text",
|
||||||
|
//"text" => array("content" => "您好,有什么能帮助你? \n ")
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user