Commit d50da49e authored by shajiaiming's avatar shajiaiming

fix

parent 8ffb3f27
......@@ -70,13 +70,7 @@ class IssueCoinController extends BaseController
goto doEnd;
}
$pre_create_tx = isset($result['pre_create_tx']) ? $result['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;
}
$result = [
'name' => isset($result['name']) ? $result['name'] : '',
......@@ -101,20 +95,6 @@ class IssueCoinController extends BaseController
$code = 0;
$data = $model->getPrimaryKey();
$params = [
'pre_create_tx' => $pre_create_tx,
'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();
$transfer_model->setScenario(CoinIssueChainRecord::SCENARIOS_PRE_CREATE);
$transfer_model->load($params, '');
$transfer_model->save();
doEnd :
return ['code' => $code, 'msg' => $msg, 'data' => $data];
}
......@@ -220,6 +200,7 @@ class IssueCoinController extends BaseController
$id = isset($params['id']) ? (int)$params['id'] : 0;
$pre_create_tx = isset($params['pre_create_tx']) ? $params['pre_create_tx'] : '';
$pre_send_transaction = isset($params['pre_send_transaction']) ? $params['pre_send_transaction'] : '';
if (false == $id || false == $pre_create_tx || false == $pre_send_transaction) {
$msg = '缺少必要的参数';
$code = -1;
......
......@@ -47,7 +47,6 @@ class CoinIssueCoin extends CommonActiveRecord
[['total', 'category', 'type', 'platform_id', 'chain_id', 'charge_unit_id'], 'integer'],
['introduction', 'string', 'length' => [1, 20]],
['symbol', 'string', 'length' => [1, 6]],
['msg', 'string', 'length' => [1, 10]],
['name', 'string', 'length' => [1, 20]],
#['status', 'in', 'range' => [1, 2, 0]],
['name', 'verfiyName'],
......@@ -60,7 +59,7 @@ class CoinIssueCoin extends CommonActiveRecord
{
$scenarios = [
self:: SCENARIOS_CREATE => ['name', 'symbol', 'total', 'owner', 'introduction', 'category', 'type', 'platform_id', 'chain_id', 'charge_unit_id', 'charge'],
self:: SCENARIOS_UPDATE => ['status', 'msg'],
self:: SCENARIOS_UPDATE => ['status'],
self:: SCENARIOS_CANCEL => ['status'],
];
return array_merge(parent:: scenarios(), $scenarios);
......
......@@ -156,11 +156,13 @@ class IssueChainTransferController extends Controller
$column => 'success'
];
if (1 == $step) {
$status = CoinIssueCoin::STATUS_PEDDING;
if (CoinIssueCoin::TYPE_YES) {
if (CoinIssueCoin::TYPE_YES == $val->coin->type) {
$data['finish_tx'] = 'success';
$data['finish_send_transaction'] = 'success';
$data['finish_query_transaction'] = 'success';
$status = CoinIssueCoin::STATUS_SUCCESS;
} else {
$status = CoinIssueCoin::STATUS_PEDDING;
}
} else {
$status = CoinIssueCoin::STATUS_SUCCESS;
......@@ -171,11 +173,13 @@ class IssueChainTransferController extends Controller
$column => 'success'
];
if (1 == $step) {
$status = CoinIssueCoin::STATUS_PEDDING;
if (CoinIssueCoin::TYPE_YES) {
if (CoinIssueCoin::TYPE_YES == $val->coin->type) {
$data['finish_tx'] = 'success';
$data['finish_send_transaction'] = 'success';
$data['finish_query_transaction'] = 'success';
$status = CoinIssueCoin::STATUS_SUCCESS;
} else {
$status = CoinIssueCoin::STATUS_PEDDING;
}
} else {
$status = CoinIssueCoin::STATUS_SUCCESS;
......@@ -197,15 +201,16 @@ class IssueChainTransferController extends Controller
$column => $result['msg']
];
}
if (CoinIssueCoin::TYPE_YES) {
if (CoinIssueCoin::TYPE_YES == $val->coin->type) {
$data['finish_tx'] = 'failed';
$data['finish_send_transaction'] = 'failed';
$data['finish_query_transaction'] = 'failed';
}
goto doEnd;
}
doEnd :
#echo json_encode($data).PHP_EOL;
#echo $status.PHP_EOL;exit;
CoinIssueChainRecord::updateAll($data, [
'id' => $val->id,
]);
......@@ -218,7 +223,7 @@ class IssueChainTransferController extends Controller
}
//1.1查询后,交易成功
if (1 == $step && $status == CoinIssueCoin::STATUS_PEDDING) {
if (1 == $step) {
CoinIssueCoin::updateAll(['status' => $status], [
'id' => $val->coin->id,
]);
......
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