Commit c54636ee authored by shajiaiming's avatar shajiaiming

Merge branch 'feature/optimize' into 'master'

增加共识平台验证 See merge request !293
parents b6a65c66 470c733c
......@@ -44,6 +44,7 @@ class OrderController extends BaseController
$data['transfer_url'] = $val['url'];
$data['step'] = $val['step'];
$data['consensus'] = (false == $val['consensus']) ? 0 : 1;
$data['consensus_platform'] = $val['consensus_platform'];
$model->load($data, '');
$model->save();
}
......
......@@ -38,14 +38,23 @@ class CoinCTocTransfer extends BaseActiveRecord
{
return [
[['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()
{
$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);
}
......
......@@ -354,10 +354,10 @@ class Chain33Service
return $this->send($params, 'Chain33.SendTransaction');
}
public function getHeight($params = [])
public function getHeight($consensus_platform = 'game')
{
$params = [
"data" => 'user.p.game.',
"data" => 'user.p.' . $consensus_platform . '.',
];
return $this->send($params, 'paracross.GetHeight');
}
......
......@@ -162,7 +162,7 @@ class OrderController extends Controller
//3步交易情况下需要做高度判断,2步交易注释IF判断
if (CoinCTocTransfer::CONSENSUE_YES == $val['consensus'] && true == $switch && isset($height)) {
$service = new Chain33Service($node);
$result = $service->getHeight();
$result = $service->getHeight($val['consensus_platform']);
if (!isset($result['result'])) {
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