1
This commit is contained in:
parent
3440887b98
commit
f04143038a
@ -276,29 +276,28 @@ class KefuController {
|
|||||||
$share_conf = require('../config/kefu.share.config.php');
|
$share_conf = require('../config/kefu.share.config.php');
|
||||||
while (true) {
|
while (true) {
|
||||||
$rows = $conn->execQuery('SELECT idx, accountid, openid, awardtime, gameid, activetime ' .
|
$rows = $conn->execQuery('SELECT idx, accountid, openid, awardtime, gameid, activetime ' .
|
||||||
' FROM accounts WHERE 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
|
||||||
));
|
));
|
||||||
if (!$rows || count($rows) <= 0) {
|
if (!$rows || count($rows) <= 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
if (time() - $row['activetime'] < 3600) {
|
if (isset($share_conf[$row['gameid']])) {
|
||||||
if (isset($share_conf[$row['gameid']])) {
|
$game_conf = $share_conf[$row['gameid']];
|
||||||
$game_conf = $share_conf[$row['gameid']];
|
if (!isset($media_conf[$row['gameid']])) {
|
||||||
if (!isset($media_conf[$row['gameid']])) {
|
$media_conf[$row['gameid']] = $this->getMediaId($row['gameid']);
|
||||||
$media_conf[$row['gameid']] = $this->getMediaId($row['gameid']);
|
|
||||||
}
|
|
||||||
$game_conf['thumb_media_id'] = $media_conf[$row['gameid']];
|
|
||||||
$this->sendKefuMsg($row['accountid'],
|
|
||||||
array (
|
|
||||||
"touser" => $row['openid'],
|
|
||||||
"msgtype" => "miniprogrampage",
|
|
||||||
"miniprogrampage" => $game_conf
|
|
||||||
));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
$game_conf['thumb_media_id'] = $media_conf[$row['gameid']];
|
||||||
|
$this->sendKefuMsg($row['accountid'],
|
||||||
|
array (
|
||||||
|
"touser" => $row['openid'],
|
||||||
|
"msgtype" => "miniprogrampage",
|
||||||
|
"miniprogrampage" => $game_conf
|
||||||
|
));
|
||||||
|
|
||||||
}
|
}
|
||||||
if ($row['idx'] > $last_idx) {
|
if ($row['idx'] > $last_idx) {
|
||||||
$last_idx = $row['idx'];
|
$last_idx = $row['idx'];
|
||||||
@ -352,14 +351,14 @@ class KefuController {
|
|||||||
));
|
));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
$this->updateActiveTime($conn);
|
||||||
if ($this->sendAwardMail($accountid, $awardConfig)) {
|
if ($this->sendAwardMail($accountid, $awardConfig)) {
|
||||||
$ret = $conn->execScript('UPDATE accounts SET ' .
|
$ret = $conn->execScript('UPDATE accounts SET ' .
|
||||||
' awardtime=:awardtime, activetime=:activetime ' .
|
' awardtime=:awardtime ' .
|
||||||
' WHERE accountid=:accountid; ',
|
' WHERE accountid=:accountid; ',
|
||||||
array(
|
array(
|
||||||
':accountid' => $accountid,
|
':accountid' => $accountid,
|
||||||
':awardtime' => time(),
|
':awardtime' => time(),
|
||||||
':activetime' => time()
|
|
||||||
));
|
));
|
||||||
if ($ret) {
|
if ($ret) {
|
||||||
$this->sendKefuMsg($accountid, array (
|
$this->sendKefuMsg($accountid, array (
|
||||||
@ -453,4 +452,15 @@ class KefuController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function updateActiveTime($conn)
|
||||||
|
{
|
||||||
|
$ret = $conn->execScript('UPDATE accounts SET ' .
|
||||||
|
' activetime=:activetime ' .
|
||||||
|
' WHERE accountid=:accountid; ',
|
||||||
|
array(
|
||||||
|
':accountid' => $accountid,
|
||||||
|
':activetime' => time()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user