Commit 37ee074c authored by shajiaiming's avatar shajiaiming

f

parent 11f9ce15
......@@ -51,7 +51,8 @@ class IssueCoinController extends BaseController
}
$pre_create_tx = isset($result['pre_create_tx']) ? $result['pre_create_tx'] : '';
if (false == $pre_create_tx) {
$pre_send_transaction = isset($result['pre_send_transaction']) ? $result['pre_send_transaction'] : '';
if (false == $pre_create_tx || false == $pre_send_transaction) {
$msg = '预签名错误';
$code = -1;
goto doEnd;
......@@ -81,7 +82,11 @@ class IssueCoinController extends BaseController
$params = [
'pre_create_tx' => $pre_create_tx,
'finish_tx' => '0',
'pre_send_transaction' => $pre_send_transaction,
'pre_query_transaction' => 'standby',
'finish_tx' => 'standby',
'finish_send_transaction' => 'standby',
'finish_query_transaction' => 'standby',
'issue_coin_id' => $data,
];
$transfer_model = new CoinIssueChainRecord();
......
......@@ -31,7 +31,7 @@ class CoinIssueChainRecord extends CommonActiveRecord
public function scenarios()
{
$scenarios = [
self:: SCENARIOS_PRE_CREATE => ['pre_create_tx', 'issue_coin_id', 'finish_tx'],
self:: SCENARIOS_PRE_CREATE => ['pre_create_tx', 'pre_send_transaction', 'pre_query_transaction', 'finish_tx', 'finish_send_transaction', 'finish_query_transaction', 'issue_coin_id'],
];
return array_merge(parent:: scenarios(), $scenarios);
}
......
......@@ -207,36 +207,5 @@ class CrossChainController extends Controller
$this->queryTransaction($node_params, $result['result']['tx']['next']);
}
return $result;
// if (isset($result['result']['actionName']) && 'unknown' == $result['result']['actionName']) {
// if (isset($result['result']['tx']['next'])) {
// $this->queryTransaction($node_params, $result['result']['tx']['next']);
// }
// }
//
// if (isset($result['result']['receipt']['ty']) && 2 == $result['result']['receipt']['ty']){
// if (isset($result['result']['tx']['next'])) {
// $this->queryTransaction($node_params, $result['result']['tx']['next']);
// }
// }
//
// return $result;
// if (isset($result['result']['receipt']) && is_array($result['result']['receipt']['logs'])){
// foreach ($result['result']['receipt']['logs'] as $log) {
// if (isset($log['tyName']) && 'logerr' == strtolower($log['tyName'])){
// return $result;
// }
// }
// }
// static $result = [];
// $service = new Chain33Service($node_params);
// $result = $service->QueryTransaction($send_result);
// echo json_encode($result) . PHP_EOL;
// if (isset($result['result']['tx']['next'])) {
// $this->queryTransaction($node_params, $result['result']['tx']['next']);
// }
// return $result;
}
}
......@@ -14,8 +14,8 @@ class IssueChainTransferController extends Controller
if (1 == $step) {
$columns = ['id', 'pre_create_tx', 'issue_coin_id'];
$condition = [
'pre_send_transaction' => '0',
'pre_query_transaction' => '0'
'pre_send_transaction' => 'standby',
'pre_query_transaction' => 'standby'
];
}
......@@ -23,8 +23,8 @@ class IssueChainTransferController extends Controller
$columns = ['id', 'finish_tx', 'issue_coin_id'];
$condition = [
'pre_query_transaction' => 'success',
'finish_send_transaction' => '0',
'finish_query_transaction' => '0'
'finish_send_transaction' => 'standby',
'finish_query_transaction' => 'standby'
];
}
......@@ -62,11 +62,11 @@ class IssueChainTransferController extends Controller
public function actionQueryTransaction($step)
{
if (1 == $step) {
$model = CoinIssueChainRecord::find()->where(['<>' , 'pre_send_transaction', '0'])->all();
$model = CoinIssueChainRecord::find()->where(['<>' , 'pre_send_transaction', 'standby'])->all();
}
if (2 == $step) {
$model = CoinIssueChainRecord::find()->where(['<>' , 'pre_send_transaction', '0'])->andWhere(['<>', 'finish_send_transaction', '0'])->all();
$model = CoinIssueChainRecord::find()->where(['<>' , 'pre_send_transaction', 'standby'])->andWhere(['<>', 'finish_send_transaction', 'standby'])->all();
}
if (false == $model) {
......@@ -74,7 +74,39 @@ class IssueChainTransferController extends Controller
return 0;
}
$node = \Yii::$app->params['chain_parallel']['primary'];
$service = new Chain33Service($node);
foreach ($model as $val) {
if (1 == $step) {
$result = $service->QueryTransaction($val->pre_send_transaction);
}
if (2 == $step) {
$result = $service->QueryTransaction($val->finish_send_transaction);
}
if (isset($result['result']['actionName']) && 'unknown' == $result['result']['actionName']) {
$query_result = 'success';
$msg = 'success';
goto doEnd;
} else if (isset($result['result']['receipt']['ty']) && 2 == $result['result']['receipt']['ty']) {
$query_result = 'success';
$msg = 'success';
goto doEnd;
} else {
if (isset($result['result']['receipt']['logs'])) {
foreach ($result['result']['receipt']['logs'] as $log) {
if (isset($log['tyName']) && 'LogErr' == $log['tyName']) {
$msg = $log['tyName'];
break;
}
}
} else {
$msg = $result['msg'];
}
$query_result = $result['code'];
goto doEnd;
}
doEnd :
}
}
......
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