Commit 6c46805e authored by shajiaiming's avatar shajiaiming

修复已知问题

parent 09cfc426
...@@ -27,7 +27,8 @@ class IssueCoinController extends BaseController ...@@ -27,7 +27,8 @@ class IssueCoinController extends BaseController
// ]; // ];
$chain_service = new Chain33Service($node); $chain_service = new Chain33Service($node);
$result = $chain_service->query(); $result = $chain_service->query();
echo json_encode($result);exit; echo json_encode($result);
exit;
} }
/** /**
...@@ -69,6 +70,14 @@ class IssueCoinController extends BaseController ...@@ -69,6 +70,14 @@ class IssueCoinController extends BaseController
goto doEnd; 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 = [ $result = [
'name' => isset($result['name']) ? $result['name'] : '', 'name' => isset($result['name']) ? $result['name'] : '',
'symbol' => isset($result['symbol']) ? strtoupper($result['symbol']) : '', 'symbol' => isset($result['symbol']) ? strtoupper($result['symbol']) : '',
...@@ -76,6 +85,7 @@ class IssueCoinController extends BaseController ...@@ -76,6 +85,7 @@ class IssueCoinController extends BaseController
'owner' => isset($result['owner']) ? $result['owner'] : '', 'owner' => isset($result['owner']) ? $result['owner'] : '',
'introduction' => isset($result['introduction']) ? $result['introduction'] : '', 'introduction' => isset($result['introduction']) ? $result['introduction'] : '',
'category' => isset($result['category']) ? $result['category'] : 0, 'category' => isset($result['category']) ? $result['category'] : 0,
'type' => isset($result['type']) ? $result['type'] : 0,
'platform_id' => $platform_id, 'platform_id' => $platform_id,
'chain_id' => $chain_id, 'chain_id' => $chain_id,
'charge_unit_id' => isset($result['charge_unit_id']) ? $result['charge_unit_id'] : '', 'charge_unit_id' => isset($result['charge_unit_id']) ? $result['charge_unit_id'] : '',
...@@ -91,6 +101,20 @@ class IssueCoinController extends BaseController ...@@ -91,6 +101,20 @@ class IssueCoinController extends BaseController
$code = 0; $code = 0;
$data = $model->getPrimaryKey(); $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 : doEnd :
return ['code' => $code, 'msg' => $msg, 'data' => $data]; return ['code' => $code, 'msg' => $msg, 'data' => $data];
} }
...@@ -118,8 +142,9 @@ class IssueCoinController extends BaseController ...@@ -118,8 +142,9 @@ class IssueCoinController extends BaseController
$size = \Yii::$app->request->get('size', 5); $size = \Yii::$app->request->get('size', 5);
$query = CoinIssueCoin::find() $query = CoinIssueCoin::find()
->select('id, name, symbol, total, create_time, status, chain_id') ->select('id, name, symbol, type, total, create_time, status, chain_id')
->where(['owner' => $address]) ->where(['owner' => $address])
->andWhere(['in', 'status', [CoinIssueCoin::STATUS_PEDDING, CoinIssueCoin::STATUS_CANCEL_SUCCESS, CoinIssueCoin::STATUS_CANCEL_FAILED, CoinIssueCoin::STATUS_ALLOW, CoinIssueCoin::STATUS_REFUSE, CoinIssueCoin::STATUS_SUCCESS, CoinIssueCoin::STATUS_FAILED]])
->orderBy('create_time desc'); ->orderBy('create_time desc');
$countQuery = clone $query; $countQuery = clone $query;
...@@ -211,7 +236,7 @@ class IssueCoinController extends BaseController ...@@ -211,7 +236,7 @@ class IssueCoinController extends BaseController
$params = [ $params = [
'pre_create_tx' => $pre_create_tx, 'pre_create_tx' => $pre_create_tx,
'pre_send_transaction' => $pre_send_transaction, 'pre_send_transaction' => $pre_send_transaction,
'pre_query_transaction' => 'success', 'pre_query_transaction' => 'standby',
'finish_tx' => 'standby', 'finish_tx' => 'standby',
'finish_send_transaction' => 'standby', 'finish_send_transaction' => 'standby',
'finish_query_transaction' => 'standby', 'finish_query_transaction' => 'standby',
...@@ -260,6 +285,12 @@ class IssueCoinController extends BaseController ...@@ -260,6 +285,12 @@ class IssueCoinController extends BaseController
goto doEnd; goto doEnd;
} }
if (!in_array($status, [CoinIssueCoin::STATUS_CANCEL, CoinIssueCoin::STATUS_CONFIRM])) {
$msg = '错误的状态值';
$code = -1;
goto doEnd;
}
$model = CoinIssueCoin::findOne($id); $model = CoinIssueCoin::findOne($id);
if (false == $model) { if (false == $model) {
$msg = '不存在的记录'; $msg = '不存在的记录';
...@@ -267,6 +298,22 @@ class IssueCoinController extends BaseController ...@@ -267,6 +298,22 @@ class IssueCoinController extends BaseController
goto doEnd; goto doEnd;
} }
if (CoinIssueCoin::STATUS_CONFIRM == $status) {
if (CoinIssueCoin::STATUS_PEDDING != $model->status) {
$msg = '该状态下禁止发行';
$code = -1;
goto doEnd;
}
}
if (CoinIssueCoin::STATUS_CANCEL == $status) {
if ('success' != $model->transfer->pre_query_transaction) {
$msg = '该状态下禁止撤消';
$code = -1;
goto doEnd;
}
}
$record_model = CoinIssueChainRecord::find()->where(['issue_coin_id' => $id])->one(); $record_model = CoinIssueChainRecord::find()->where(['issue_coin_id' => $id])->one();
if (false == $record_model) { if (false == $record_model) {
$msg = '交易记录不存在'; $msg = '交易记录不存在';
...@@ -274,12 +321,6 @@ class IssueCoinController extends BaseController ...@@ -274,12 +321,6 @@ class IssueCoinController extends BaseController
goto doEnd; goto doEnd;
} }
if ($model->status > CoinIssueCoin::UN_AUDIT) {
$msg = '不允许取消的发行';
$code = -1;
goto doEnd;
}
$data = [ $data = [
'status' => $status, 'status' => $status,
]; ];
...@@ -291,7 +332,7 @@ class IssueCoinController extends BaseController ...@@ -291,7 +332,7 @@ class IssueCoinController extends BaseController
goto doEnd; goto doEnd;
} }
if ($status == CoinIssueCoin::ALLOWED_ISSUE) { if ($status == CoinIssueCoin::STATUS_CONFIRM) {
$record_model->pre_query_transaction = 'success'; $record_model->pre_query_transaction = 'success';
$record_model->update(); $record_model->update();
} }
...@@ -302,106 +343,4 @@ class IssueCoinController extends BaseController ...@@ -302,106 +343,4 @@ class IssueCoinController extends BaseController
doEnd : doEnd :
return ['code' => $code, 'msg' => $msg]; return ['code' => $code, 'msg' => $msg];
} }
/**
* 手续费划转
* @return
*/
public function actionPayCharge()
{
$issue_coin_model = CoinIssueCoin::find()
->select('id')->where(['charge_pay' => CoinIssueCoin::ALLOW_PAY])->asArray()->all();
if (false == $issue_coin_model) {
echo date('Y-m-d H:i:s') . '暂无手续费划转任务' . PHP_EOL;
return 0;
}
$issue_transfer = CoinIssueTransfer::find()
->where(['unissue' => 1])
->andWhere(['in', 'issue_coin_id', ArrayHelper::getColumn($issue_coin_model, 'id')])
->asArray()
->all();
if (false == $issue_transfer) {
echo date('Y-m-d H:i:s') . '暂无手续费划转任务' . PHP_EOL;
return 0;
}
$node = Yii::$app->params['chain_nodes']['STO'];
$service = new Chain33Service($node);
foreach ($issue_transfer as $val) {
$result = $service->sendTransaction($val['txhex']);
if (0 == $result['code']) {
$send_result = $result['result'];
$currentModel = CoinIssueTransfer::findOne($val['id']);
$currentModel->send_result = $send_result;
$currentModel->msg = 0;
$currentModel->save();
} else {
$currentModel = CoinIssueTransfer::findOne($val['id']);
$currentModel->msg = $result['msg'];
$currentModel->save();
}
}
echo date('Y-m-d H:i:s') . '手续费划转任务完成' . PHP_EOL;
return 0;
}
/**
* 手续费划转状态确认
* @return
*/
public function actionPayChargeStatus()
{
$unissue = -1;
$model = CoinIssueTransfer::find()->where(['<>', 'send_result', '0'])->andWhere(['msg' => '0'])->asArray()->all();
if (empty($model)) {
echo date('Y-m-d H:i:s') . '暂无需要确认的手续费划转状态' . PHP_EOL;
return 0;
}
$node = \Yii::$app->params['chain_parallel']['primary'];
$service = new Chain33Service($node);
foreach ($model as $val) {
$send_result = $val['send_result'];
$result = $service->QueryTransaction($send_result);
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 :
if ('success' == $msg) {
$unissue = 0;
$coin_issue_coin = CoinIssueCoin::find()->where(['id' => $val['issue_coin_id']])->one();
$coin_issue_coin->charge_pay = CoinIssueCoin::SUCCESS_PAY;
$coin_issue_coin->save();
}
$currentModel = CoinIssueTransfer::findOne($val['id']);
$currentModel->query_result = $query_result;
if ($unissue > -1) {
$currentModel->unissue = $unissue;
}
$currentModel->msg = $msg;
$currentModel->save();
}
}
} }
\ No newline at end of file
...@@ -9,28 +9,21 @@ class CoinIssueCoin extends CommonActiveRecord ...@@ -9,28 +9,21 @@ class CoinIssueCoin extends CommonActiveRecord
{ {
const UN_PAY = 0; const UN_PAY = 0;
const ALLOW_PAY = 1; const ALLOW_PAY = 1;
const SUCCESS_PAY =2; const SUCCESS_PAY = 2;
const STATUS_PEDDING = 0; //待用户确认 const STATUS_ADVANCE = 0; //预发行,待确认
const STATUS_CANCEL = 1; //用户点击撤消后的状态 const STATUS_PEDDING = 1; //预发行成功,待用户确认
const STATUS_CANCEL_SUCCESS = 2; //撤消成功 const STATUS_CANCEL = 2; //用户点击撤消后的状态
const STATUS_CANCEL_FAILED = 3; //撤消失败 const STATUS_CANCEL_SUCCESS = 3; //撤消成功
const STATUS_CONFIRM = 4; //用户点击确认后的状态 const STATUS_CANCEL_FAILED = 4; //撤消失败
const STATUS_ALLOW = 5; //开启人工审核,管理员后台点击通过后的状态 (未开启人工审核,跳过该状态) const STATUS_CONFIRM = 5; //用户点击确认后的状态
const STATUS_REFUSE = 6; //开启人工审核,管理员后台点击拒绝后的状态 (未开启人工审核,跳过该状态) const STATUS_ALLOW = 6; //开启人工审核,管理员后台点击通过后的状态 (未开启人工审核,跳过该状态)
const STATUS_SUCCESS = 7; //发行成功 const STATUS_REFUSE = 7; //开启人工审核,管理员后台点击拒绝后的状态 (未开启人工审核,跳过该状态)
const STATUS_FAILED = 8; //发行失败 const STATUS_SUCCESS = 8; //发行成功
const STATUS_FAILED = 9; //(预)发行失败
const UN_AUDIT = 0; //允许发行(管理员) const TYPE_NO = 0; //不是增发
const ALLOW_ISSUE = 1; //允许发行(管理员) const TYPE_YES = 1; //是增发
const REFUSE_ISSUE = 2; //拒绝发行
const SUCCESS_ISSUE = 3; //发行成功
const FAIL_ISSUE = 4; //发行失败
const CANCEL_ISSUE = 5; //已撤消
const ALLOWED_ISSUE = 6; //允许发行(申请者)
const CANCEL_SUCCESS = 7; //撤消成功
const CANCEL_FAIL = 8; //撤消失败
//定义场景 //定义场景
const SCENARIOS_CREATE = 'create'; const SCENARIOS_CREATE = 'create';
...@@ -50,19 +43,29 @@ class CoinIssueCoin extends CommonActiveRecord ...@@ -50,19 +43,29 @@ class CoinIssueCoin extends CommonActiveRecord
public function rules() public function rules()
{ {
return [ return [
[['name', 'symbol', 'total', 'owner', 'introduction', 'category', 'platform_id', 'chain_id', 'charge_unit_id', 'charge'], 'required'], [['name', 'symbol', 'total', 'owner', 'introduction', 'category', 'type', 'platform_id', 'chain_id', 'charge_unit_id', 'charge'], 'required'],
[['total', 'category', 'platform_id', 'chain_id', 'charge_unit_id'], 'integer'], [['total', 'category', 'type', 'platform_id', 'chain_id', 'charge_unit_id'], 'integer'],
['introduction', 'string', 'length' => [1, 20]], ['introduction', 'string', 'length' => [1, 20]],
['symbol', 'string', 'length' => [1, 6]], ['symbol', 'string', 'length' => [1, 6]],
['msg', 'string', 'length' => [1, 10]], ['msg', 'string', 'length' => [1, 10]],
['name', 'string', 'length' => [1, 20]], ['name', 'string', 'length' => [1, 20]],
#['status', 'in', 'range' => [1, 2, 0]], #['status', 'in', 'range' => [1, 2, 0]],
['name', 'verfiyName'], #['name', 'verfiyName'],
['symbol', 'verfiySymbol'], #['symbol', 'verfiySymbol'],
['total', 'verfiyAmount'] ['total', 'verfiyAmount']
]; ];
} }
public function scenarios()
{
$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_CANCEL => ['status'],
];
return array_merge(parent:: scenarios(), $scenarios);
}
public function verfiyName($attribute, $params) public function verfiyName($attribute, $params)
{ {
$model = CoinIssueCoin::find()->where(['name' => $this->name, 'platform_id' => $this->platform_id])->orderBy('id desc')->one(); $model = CoinIssueCoin::find()->where(['name' => $this->name, 'platform_id' => $this->platform_id])->orderBy('id desc')->one();
...@@ -92,21 +95,11 @@ class CoinIssueCoin extends CommonActiveRecord ...@@ -92,21 +95,11 @@ class CoinIssueCoin extends CommonActiveRecord
$issue_record = CoinIssueRecord::find()->where(['platform_id' => $this->platform_id])->sum('total'); $issue_record = CoinIssueRecord::find()->where(['platform_id' => $this->platform_id])->sum('total');
$issue_record = empty($issue_record) ? 0 : $issue_record; $issue_record = empty($issue_record) ? 0 : $issue_record;
if ($issue_record + $this->$attribute >= 900) { if ($issue_record + $this->$attribute >= 900) {
$this->addError($attribute, '最大发行量900亿,目前已发行'. $issue_record. '亿'); $this->addError($attribute, '最大发行量900亿,目前已发行' . $issue_record . '亿');
return false; return false;
} }
} }
public function scenarios()
{
$scenarios = [
self:: SCENARIOS_CREATE => ['name', 'symbol', 'total', 'owner', 'introduction', 'category', 'platform_id', 'chain_id', 'charge_unit_id', 'charge'],
self:: SCENARIOS_UPDATE => ['status', 'msg'],
self:: SCENARIOS_CANCEL => ['status'],
];
return array_merge(parent:: scenarios(), $scenarios);
}
public function attributeLabels() public function attributeLabels()
{ {
return [ return [
......
...@@ -24,7 +24,7 @@ class IssueChainTransferController extends Controller ...@@ -24,7 +24,7 @@ class IssueChainTransferController extends Controller
public function actionSendTransaction($step, $type) public function actionSendTransaction($step, $type)
{ {
if (0 == $type) { if (0 == $type) {
$status = CoinIssueCoin::ALLOWED_ISSUE; $status = CoinIssueCoin::STATUS_CONFIRM;
$manual_review = Yii::$app->redis->get('issue_chain_manual_review'); $manual_review = Yii::$app->redis->get('issue_chain_manual_review');
if ('close' == $manual_review) { if ('close' == $manual_review) {
return 0; return 0;
...@@ -32,7 +32,7 @@ class IssueChainTransferController extends Controller ...@@ -32,7 +32,7 @@ class IssueChainTransferController extends Controller
} }
if (1 == $type) { if (1 == $type) {
$status = CoinIssueCoin::ALLOW_ISSUE; $status = CoinIssueCoin::STATUS_ALLOW;
} }
$issue_coin_model = CoinIssueCoin::find()->select('id')->where(['status' => $status])->asArray()->all(); $issue_coin_model = CoinIssueCoin::find()->select('id')->where(['status' => $status])->asArray()->all();
...@@ -145,36 +145,46 @@ class IssueChainTransferController extends Controller ...@@ -145,36 +145,46 @@ class IssueChainTransferController extends Controller
foreach ($model as $val) { foreach ($model as $val) {
if (1 == $step) { if (1 == $step) {
$result = $service->QueryTransaction($val->pre_send_transaction); $result = $service->QueryTransaction($val->pre_send_transaction);
$column = 'pre_query_transaction';
} }
if (2 == $step) { if (2 == $step) {
$result = $service->QueryTransaction($val->finish_send_transaction); $result = $service->QueryTransaction($val->finish_send_transaction);
$column = 'finish_query_transaction';
} }
if (isset($result['result']['actionName']) && 'unknown' == $result['result']['actionName']) { if (isset($result['result']['actionName']) && 'unknown' == $result['result']['actionName']) {
$status = CoinIssueCoin::SUCCESS_ISSUE; if (1 == $step) {
$status = CoinIssueCoin::STATUS_PEDDING;
} else {
$status = CoinIssueCoin::STATUS_SUCCESS;
}
$data = [ $data = [
'finish_query_transaction' => 'success' $column => 'success'
]; ];
goto doEnd; goto doEnd;
} else if (isset($result['result']['receipt']['ty']) && 2 == $result['result']['receipt']['ty']) { } else if (isset($result['result']['receipt']['ty']) && 2 == $result['result']['receipt']['ty']) {
$status = CoinIssueCoin::SUCCESS_ISSUE; if (1 == $step) {
$status = CoinIssueCoin::STATUS_PEDDING;
} else {
$status = CoinIssueCoin::STATUS_SUCCESS;
}
$data = [ $data = [
'finish_query_transaction' => 'success' $column => 'success'
]; ];
goto doEnd; goto doEnd;
} else { } else {
$status = CoinIssueCoin::FAIL_ISSUE; $status = CoinIssueCoin::STATUS_FAILED;
if (isset($result['result']['receipt']['logs'])) { if (isset($result['result']['receipt']['logs'])) {
foreach ($result['result']['receipt']['logs'] as $log) { foreach ($result['result']['receipt']['logs'] as $log) {
if (isset($log['tyName']) && 'LogErr' == $log['tyName']) { if (isset($log['tyName']) && 'LogErr' == $log['tyName']) {
$data = [ $data = [
'finish_query_transaction' => $log['log'] $column => $log['log']
]; ];
break; break;
} }
} }
} else { } else {
$data = [ $data = [
'finish_query_transaction' => $result['msg'] $column => $result['msg']
]; ];
} }
goto doEnd; goto doEnd;
...@@ -186,29 +196,38 @@ class IssueChainTransferController extends Controller ...@@ -186,29 +196,38 @@ class IssueChainTransferController extends Controller
]); ]);
//查询后,交易失败 //查询后,交易失败
if ($status == CoinIssueCoin::FAIL_ISSUE) { if ($status == CoinIssueCoin::STATUS_FAILED) {
CoinIssueCoin::updateAll(['status' => $status], [ CoinIssueCoin::updateAll(['status' => $status], [
'id' => $val->coin->id, 'id' => $val->coin->id,
]); ]);
} }
//查询后,交易成功
if ($status == CoinIssueCoin::SUCCESS_ISSUE) { //1.1查询后,交易成功
if (1 == $step && $status == CoinIssueCoin::STATUS_PEDDING) {
CoinIssueCoin::updateAll(['status' => $status], [
'id' => $val->coin->id,
]);
}
//1.2查询后,交易成功
if (2 == $step && $status == CoinIssueCoin::STATUS_SUCCESS) {
CoinIssueCoin::updateAll(['status' => $status, 'charge_pay' => CoinIssueCoin::SUCCESS_PAY], [ CoinIssueCoin::updateAll(['status' => $status, 'charge_pay' => CoinIssueCoin::SUCCESS_PAY], [
'id' => $val->coin->id, 'id' => $val->coin->id,
]); ]);
$params = [ if (CoinIssueCoin::TYPE_NO == $val->coin->type) {
'name' => $val->coin->name, $params = [
'symbol' => $val->coin->symbol, 'name' => $val->coin->name,
'introduction' => $val->coin->introduction, 'symbol' => $val->coin->symbol,
'total' => (int)$val->coin->total, 'introduction' => $val->coin->introduction,
'price' => isset($val->coin->platform->issue_charge) ? (int)$val->coin->platform->issue_charge : 0, 'total' => (int)$val->coin->total,
'category' => (int)$val->coin->category, 'price' => isset($val->coin->platform->issue_charge) ? (int)$val->coin->platform->issue_charge : 0,
'owner' => $val->coin->owner, 'category' => (int)$val->coin->category,
'platform_id' => $val->coin->platform_id, 'owner' => $val->coin->owner,
'platform' => $val->coin->chain->platform 'platform_id' => $val->coin->platform_id,
]; 'platform' => $val->coin->chain->platform
$this->syncRecord($params); ];
$this->syncCoin($params); $this->syncCoin($params);
}
} }
} }
echo date('Y-m-d H:i:s') . '查询完成,同步完成' . PHP_EOL; echo date('Y-m-d H:i:s') . '查询完成,同步完成' . PHP_EOL;
...@@ -217,7 +236,7 @@ class IssueChainTransferController extends Controller ...@@ -217,7 +236,7 @@ class IssueChainTransferController extends Controller
public function actionCancel() public function actionCancel()
{ {
$issue_coin_model = CoinIssueCoin::find()->where(['status' => CoinIssueCoin::CANCEL_ISSUE])->all(); $issue_coin_model = CoinIssueCoin::find()->where(['status' => CoinIssueCoin::STATUS_CANCEL])->all();
if (false == $issue_coin_model) { if (false == $issue_coin_model) {
echo date('Y-m-d H:i:s') . '暂无需要撤消的发行' . PHP_EOL; echo date('Y-m-d H:i:s') . '暂无需要撤消的发行' . PHP_EOL;
return 0; return 0;
...@@ -229,7 +248,7 @@ class IssueChainTransferController extends Controller ...@@ -229,7 +248,7 @@ class IssueChainTransferController extends Controller
//执行1.3构造 //执行1.3构造
$result = $chain_service->CreateRawTokenRevokeTx($val->symbol, $val->owner); $result = $chain_service->CreateRawTokenRevokeTx($val->symbol, $val->owner);
if (null != $result['error']) { if (null != $result['error']) {
$status = CoinIssueCoin::CANCEL_FAIL; $status = CoinIssueCoin::STATUS_CANCEL_FAILED;
$data = [ $data = [
'pre_query_transaction' => 'fail' 'pre_query_transaction' => 'fail'
]; ];
...@@ -242,7 +261,7 @@ class IssueChainTransferController extends Controller ...@@ -242,7 +261,7 @@ class IssueChainTransferController extends Controller
//执行1.3签名 //执行1.3签名
$signRawTx = $chain_service->signRawTx($privkey, $txHex, $expire); $signRawTx = $chain_service->signRawTx($privkey, $txHex, $expire);
if (0 != $signRawTx['code']) { if (0 != $signRawTx['code']) {
$status = CoinIssueCoin::CANCEL_FAIL; $status = CoinIssueCoin::STATUS_CANCEL_FAILED;
$data = [ $data = [
'pre_query_transaction' => 'fail' 'pre_query_transaction' => 'fail'
]; ];
...@@ -251,13 +270,13 @@ class IssueChainTransferController extends Controller ...@@ -251,13 +270,13 @@ class IssueChainTransferController extends Controller
//执行1.3交易 //执行1.3交易
$result = $chain_service->sendTransaction($signRawTx['result']); $result = $chain_service->sendTransaction($signRawTx['result']);
if (0 != $result['code']) { if (0 != $result['code']) {
$status = CoinIssueCoin::CANCEL_FAIL; $status = CoinIssueCoin::STATUS_CANCEL_FAILED;
$data = [ $data = [
'pre_query_transaction' => 'fail' 'pre_query_transaction' => 'fail'
]; ];
goto doEnd; goto doEnd;
} }
$status = CoinIssueCoin::CANCEL_SUCCESS; $status = CoinIssueCoin::STATUS_CANCEL_SUCCESS;
$data = [ $data = [
'pre_query_transaction' => $result['result'] 'pre_query_transaction' => $result['result']
]; ];
......
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