Commit 1f47c4b6 authored by shajiaiming's avatar shajiaiming

fix

parent 80f2bde6
...@@ -85,12 +85,32 @@ class GameBetController extends Controller ...@@ -85,12 +85,32 @@ class GameBetController extends Controller
} }
foreach ($nodes as $key => $node) { foreach ($nodes as $key => $node) {
$service = new Chain33Business(); $service = new Chain33Business();
$result = $service->getLastHeader($node); $result = $service->getGameStatus($node);
$height = $result['result']['height']; if (0 !== $result['code']) {
echo $key.':'.date('Y-m-d H:i:s') . $result['msg'].PHP_EOL;
continue;
}
$queryResultItems = $result['result'] ?? [];
if (empty($queryResultItems)) {
echo $key.':'.date('Y-m-d H:i:s') . 'error'.PHP_EOL;
continue;
}
$resultJSON = json_decode($queryResultItems['queryResultItems'][0]['resultJSON'], true);
$current_height = $resultJSON['height'];
$cache_current_height = Yii::$app->redis->get('chain33_game_bet_status_height_'.$key);
if(($cache_current_height + 12) < $current_height) {
echo $key.':'.date('Y-m-d H:i:s') . '区块高度小于12'.PHP_EOL;
continue;
}
//$height = $cache_current_height - 12;
$models = CoinGameBet::find()->select('round')->where([ $models = CoinGameBet::find()->select('round')->where([
'and', 'and',
['valid' => CoinGameBet::VAILD_FALSE], ['valid' => CoinGameBet::VAILD_FALSE],
['<', 'height', $height - 12], ['<', 'height', $cache_current_height],
['platform' => $key] ['platform' => $key]
])->all(); ])->all();
if(empty($models)){ if(empty($models)){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment