Commit 3cecfa21 authored by shajiaiming's avatar shajiaiming

rollback

parent 95ac3bcb
...@@ -83,35 +83,14 @@ class GameBetController extends Controller ...@@ -83,35 +83,14 @@ class GameBetController extends Controller
echo date('Y-m-d H:i:s') . '无节点'.PHP_EOL; echo date('Y-m-d H:i:s') . '无节点'.PHP_EOL;
return 0; return 0;
} }
foreach ($nodes as $key => $node) { foreach ($nodes as $key => $node) {
$service = new Chain33Business(); $service = new Chain33Business();
$result = $service->getGameStatus($node); $result = $service->getLastHeader($node);
if (0 !== $result['code']) { $height = $result['result']['height'];
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], ['<', 'height', $height - 12],
['platform' => $key] ['platform' => $key]
])->all(); ])->all();
if(empty($models)){ if(empty($models)){
...@@ -154,4 +133,5 @@ class GameBetController extends Controller ...@@ -154,4 +133,5 @@ class GameBetController extends Controller
} }
return 0; return 0;
} }
} }
\ No newline at end of file
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