This commit is contained in:
aozhiwei 2019-10-24 14:09:23 +08:00
parent 2cee273b56
commit 3e86e77179

View File

@ -224,6 +224,7 @@ class KefuController {
try { try {
$gameid = phpcommon\extractGameId($accountid); $gameid = phpcommon\extractGameId($accountid);
$access_token = $this->getAccessToken($gameid); $access_token = $this->getAccessToken($gameid);
error_log($access_token);
$url = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=" . urlencode($access_token); $url = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=" . urlencode($access_token);
$response = ''; $response = '';
@ -279,7 +280,7 @@ class KefuController {
' FROM accounts WHERE activetime > :time AND idx > :last_idx LIMIT 0, 1000;', ' FROM accounts WHERE activetime > :time AND idx > :last_idx LIMIT 0, 1000;',
array( array(
':last_idx' => $last_idx, ':last_idx' => $last_idx,
':time' => time() - 3600 * 24 ':time' => time() - 3600 * 6
)); ));
if (!$rows || count($rows) <= 0) { if (!$rows || count($rows) <= 0) {
break; break;
@ -352,7 +353,7 @@ class KefuController {
)); ));
return; return;
} }
$this->updateActiveTime($conn); $this->updateActiveTime($conn, $accountid);
if ($this->sendAwardMail($accountid, $awardConfig)) { if ($this->sendAwardMail($accountid, $awardConfig)) {
$ret = $conn->execScript('UPDATE accounts SET ' . $ret = $conn->execScript('UPDATE accounts SET ' .
' awardtime=:awardtime ' . ' awardtime=:awardtime ' .
@ -388,17 +389,17 @@ class KefuController {
':accountid' => $accountid, ':accountid' => $accountid,
':channel' => WEIXIN_CHANNEL, ':channel' => WEIXIN_CHANNEL,
':gameid' => phpcommon\extractGameId($accountid), ':gameid' => phpcommon\extractGameId($accountid),
':openid' => $msg['FromUserName'], ':openid' => phpcommon\extractOpenId($accountid),
':awardtime' => 0, ':awardtime' => 0,
':activetime' => 0 ':activetime' => 0
)); ));
if ($ret) { /*if ($ret) {
$this->sendKefuMsg($accountid, array( $this->sendKefuMsg($accountid, array(
"touser" => $msg['FromUserName'], "touser" => $msg['FromUserName'],
"msgtype" => "text", "msgtype" => "text",
//"text" => array("content" => "您好,有什么能帮助你? \n ") //"text" => array("content" => "您好,有什么能帮助你? \n ")
)); ));
} }*/
} }
private function getAccessToken($gameid) private function getAccessToken($gameid)
@ -457,7 +458,7 @@ class KefuController {
} }
} }
protected function updateActiveTime($conn) protected function updateActiveTime($conn, $accountid)
{ {
$ret = $conn->execScript('UPDATE accounts SET ' . $ret = $conn->execScript('UPDATE accounts SET ' .
' activetime=:activetime ' . ' activetime=:activetime ' .