Commit 6209a96c authored by shajiaming's avatar shajiaming

Merge branch 'feature/optimize' into develop

parents 52925b6c 470c733c
...@@ -44,6 +44,7 @@ class OrderController extends BaseController ...@@ -44,6 +44,7 @@ class OrderController extends BaseController
$data['transfer_url'] = $val['url']; $data['transfer_url'] = $val['url'];
$data['step'] = $val['step']; $data['step'] = $val['step'];
$data['consensus'] = (false == $val['consensus']) ? 0 : 1; $data['consensus'] = (false == $val['consensus']) ? 0 : 1;
$data['consensus_platform'] = $val['consensus_platform'];
$model->load($data, ''); $model->load($data, '');
$model->save(); $model->save();
} }
......
...@@ -38,14 +38,23 @@ class CoinCTocTransfer extends BaseActiveRecord ...@@ -38,14 +38,23 @@ class CoinCTocTransfer extends BaseActiveRecord
{ {
return [ return [
[['is_sell', 'type', 'address', 'token_name', 'market_name', 'price', 'amount', 'step', 'txhex', 'transfer_url', 'transfer_number', 'consensus'], 'required'], [['is_sell', 'type', 'address', 'token_name', 'market_name', 'price', 'amount', 'step', 'txhex', 'transfer_url', 'transfer_number', 'consensus'], 'required'],
[['send_result', 'query_result', 'msg'], 'safe'] [['send_result', 'query_result', 'msg', 'consensus_platform'], 'safe'],
['consensus_platform', 'verfiyConsensusPlatform']
]; ];
} }
public function verfiyConsensusPlatform($attribute, $params)
{
if ($this->consensus == self::CONSENSUE_YES && empty($this->consensus_platform)){
$this->addError($attribute, '共识平台错误');
return false;
}
}
public function scenarios() public function scenarios()
{ {
$scenarios = [ $scenarios = [
self:: SCENARIOS_CREATE => ['is_sell', 'type', 'address', 'token_name', 'market_name', 'price', 'amount', 'step', 'txhex', 'transfer_url', 'transfer_number', 'consensus'], self:: SCENARIOS_CREATE => ['is_sell', 'type', 'address', 'token_name', 'market_name', 'price', 'amount', 'step', 'txhex', 'transfer_url', 'transfer_number', 'consensus', 'consensus_platform'],
]; ];
return array_merge(parent:: scenarios(), $scenarios); return array_merge(parent:: scenarios(), $scenarios);
} }
......
...@@ -354,10 +354,10 @@ class Chain33Service ...@@ -354,10 +354,10 @@ class Chain33Service
return $this->send($params, 'Chain33.SendTransaction'); return $this->send($params, 'Chain33.SendTransaction');
} }
public function getHeight($params = []) public function getHeight($consensus_platform = 'game')
{ {
$params = [ $params = [
"data" => 'user.p.game.', "data" => 'user.p.' . $consensus_platform . '.',
]; ];
return $this->send($params, 'paracross.GetHeight'); return $this->send($params, 'paracross.GetHeight');
} }
......
...@@ -90,7 +90,7 @@ class OrderController extends Controller ...@@ -90,7 +90,7 @@ class OrderController extends Controller
//正式环境查询共识高度 //正式环境查询共识高度
//3步交易情况下需要做高度判断,2步交易无须判断 //3步交易情况下需要做高度判断,2步交易无须判断
$node_params = [ $node = [
'scheme' => 'https', 'scheme' => 'https',
'host' => 'jiedian1.bityuan.com', 'host' => 'jiedian1.bityuan.com',
'port' => 8801 'port' => 8801
...@@ -161,8 +161,11 @@ class OrderController extends Controller ...@@ -161,8 +161,11 @@ class OrderController extends Controller
//3步交易情况下需要做高度判断,2步交易注释IF判断 //3步交易情况下需要做高度判断,2步交易注释IF判断
if (CoinCTocTransfer::CONSENSUE_YES == $val['consensus'] && true == $switch && isset($height)) { if (CoinCTocTransfer::CONSENSUE_YES == $val['consensus'] && true == $switch && isset($height)) {
$service = new Chain33Service($node_params); $service = new Chain33Service($node);
$result = $service->getHeight(); $result = $service->getHeight($val['consensus_platform']);
if (!isset($result['result'])) {
continue;
}
$consensHeight = $result['result']['consensHeight']; $consensHeight = $result['result']['consensHeight'];
if ($consensHeight < $height) { if ($consensHeight < $height) {
continue; continue;
......
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