Commit 048db0ae authored by rlgy's avatar rlgy

时时彩获取高度

parent 18ddc65b
...@@ -105,4 +105,14 @@ class LotteryBusiness ...@@ -105,4 +105,14 @@ class LotteryBusiness
} }
return ['code' => -1, 'msg' => $error]; return ['code' => -1, 'msg' => $error];
} }
/**
* 获取最新的区块
*/
public static function getLastHeader()
{
$service = new LotteryService();
$result = $service->getLastHeader();
return $result;
}
} }
...@@ -172,6 +172,12 @@ class LotteryService ...@@ -172,6 +172,12 @@ class LotteryService
return $this->send($params, 'Chain33.SendTransaction'); return $this->send($params, 'Chain33.SendTransaction');
} }
/**
* 获取最新的区块
*/
public function getLastHeader()
{
return $this->send([], 'Chain33.GetLastHeader');
}
} }
\ No newline at end of file
...@@ -40,7 +40,7 @@ class LotteryController extends Controller ...@@ -40,7 +40,7 @@ class LotteryController extends Controller
} }
$lottery_current_result = $lottery_current_info['result']; $lottery_current_result = $lottery_current_info['result'];
//获取最新的区块高度 //获取最新的区块高度
$last_header = Chain33Business::getLastHeader(); $last_header = LotteryBusiness::getLastHeader();
if ($last_header['code'] != 0) { if ($last_header['code'] != 0) {
echo '获取区块高度失败: ' . $last_header['msg'].PHP_EOL; echo '获取区块高度失败: ' . $last_header['msg'].PHP_EOL;
sleep(2); sleep(2);
......
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