12345678910111213141516171819202122232425262728293031323334 |
- <?php
- /**
- * 游戏结果上报
- * @author solu
- */
- require_once realpath(dirname(__FILE__)) . '/../common.php';
- $index = (int) $argv[1];
- if (!singleProcess(getCurrentCommand(), ROOT_PATH . "/bin/run/reportGame.pid")) {
- exit("Sorry, this script file has already been running ...\n");
- }
- $objOffer = new Offer();
- $objGame = new Game;
- $agoTime = 120;
- $t = date('Y-m-d H:i:s', time() - 120);
- $gameIds = $objGame->objTable->getCol(['game_state' => Game::STATUS_FINISH], [
- '_field' => 'id',
- '_where' => "create_time>='{$t}'",
- ]);
- $offers = $objOffer->objTable->getAll(['game_id' => $gameIds, 'state' => [Offer::STATUS_CLOSE, Offer::STATUS_FINISH]], [
- '_field' => 'game_id, sum(offerall_int) offerall_int, sum(win_int) win_int',
- '_groupby' => 'game_id',
- ]);
- foreach ($offers as $v) {
- $ret = ThirdApi::reportGameResult($v['game_id'], $v['offerall_int'], $v['win_int']);
- }
- $c = count($offers);
- Eos::log("上报{$c}记录");
|