Commit d6bc3581 authored by ZhuChunYang's avatar ZhuChunYang

update

parent 09dede81
...@@ -81,13 +81,18 @@ class LotteryService ...@@ -81,13 +81,18 @@ class LotteryService
$config = Yii::$app->params['lottery']; $config = Yii::$app->params['lottery'];
$lotterId = $config['lotteryId']; $lotterId = $config['lotteryId'];
$params = [ $params = [
"execer" => "lottery",
"actionName" => "LotteryBuy",
"payload" => [
"lotteryId" => $lotterId, "lotteryId" => $lotterId,
"amount" => $amount, "amount" => $amount,
"number" => $number, "number" => $number,
"way" => $way, "way" => $way,
"fee" => $fee, "fee" => $fee,
]
]; ];
return $this->send($params, 'Chain33.CreateRawLotteryBuyTx'); return $this->send($params, 'Chain33.CreateTransaction');
} }
/** /**
...@@ -98,10 +103,14 @@ class LotteryService ...@@ -98,10 +103,14 @@ class LotteryService
$config = Yii::$app->params['lottery']; $config = Yii::$app->params['lottery'];
$lotterId = $config['lotteryId']; $lotterId = $config['lotteryId'];
$params = [ $params = [
"execer" => "lottery",
"actionName" => "LotteryDraw",
"payload" => [
"lotteryId" => $lotterId, "lotteryId" => $lotterId,
"fee" => $fee "fee" => $fee
]
]; ];
return $this->send($params, 'Chain33.CreateRawLotteryDrawTx'); return $this->send($params, 'Chain33.CreateTransaction');
} }
/** /**
......
...@@ -66,14 +66,13 @@ class LotteryController extends Controller ...@@ -66,14 +66,13 @@ class LotteryController extends Controller
}else{ }else{
echo date('Y-m-d H:i:s').': '.'开奖异常: '.$lottery_result['msg'].PHP_EOL; echo date('Y-m-d H:i:s').': '.'开奖异常: '.$lottery_result['msg'].PHP_EOL;
} }
sleep(10);
}else{ }else{
if($last->start_height != $start_height){ if($last->start_height != $start_height){
$last->start_height = $start_height; CoinLottery::addOneRecord($start_height,$last_lottery_height,$last->stage+1,$round,$start_date);
$last->round = $round; echo date('Y-m-d H:i:s').': '.'总期数:'.$round." 交易数据添加成功!".PHP_EOL;
$last->save();
echo date('Y-m-d H:i:s').': '.'总期数:'.$round." 交易数据更新成功!".PHP_EOL;
} }
sleep(2); sleep(10);
continue; continue;
} }
}else if($lottery_current_result['status'] == 3){ //已开奖 }else if($lottery_current_result['status'] == 3){ //已开奖
...@@ -88,7 +87,7 @@ class LotteryController extends Controller ...@@ -88,7 +87,7 @@ class LotteryController extends Controller
$trade_result = LotteryBusiness::trade(1,12345,5,0); $trade_result = LotteryBusiness::trade(1,12345,5,0);
if($trade_result['code'] == 0){ if($trade_result['code'] == 0){
echo date('Y-m-d H:i:s').': '.'交易成功 '.PHP_EOL; echo date('Y-m-d H:i:s').': '.'交易成功 '.PHP_EOL;
CoinLottery::addOneRecord($start_height,$last_lottery_height,$last->stage+1,$round,$start_date); //CoinLottery::addOneRecord($start_height,$last_lottery_height,$last->stage+1,$round,$start_date);
}else{ }else{
echo date('Y-m-d H:i:s').': '.'参与交易异常: '.$trade_result['msg'].PHP_EOL; echo date('Y-m-d H:i:s').': '.'参与交易异常: '.$trade_result['msg'].PHP_EOL;
} }
...@@ -107,6 +106,7 @@ class LotteryController extends Controller ...@@ -107,6 +106,7 @@ class LotteryController extends Controller
}else{ }else{
echo date('Y-m-d H:i:s').': '.'开奖异常: '.$lottery_result['msg'].PHP_EOL; echo date('Y-m-d H:i:s').': '.'开奖异常: '.$lottery_result['msg'].PHP_EOL;
} }
sleep(10);
} }
}else if($lottery_current_result['status'] == 3){ //开完奖状态,等待交易进入下一期 }else if($lottery_current_result['status'] == 3){ //开完奖状态,等待交易进入下一期
if($last_header['height'] > $last_lottery_height){ //当前区块高度大于上期开奖高度,可以进行交易进入下一期 if($last_header['height'] > $last_lottery_height){ //当前区块高度大于上期开奖高度,可以进行交易进入下一期
......
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