Commit dce20133 authored by shajiaiming's avatar shajiaiming

Merge branch 'feature/issue_coin' into 'master'

Feature/issue coin See merge request !207
parents 590f24ef fb5a0434
...@@ -241,6 +241,20 @@ class IssueChainTransferController extends Controller ...@@ -241,6 +241,20 @@ class IssueChainTransferController extends Controller
CoinIssueCoin::updateAll(['status' => $status], [ CoinIssueCoin::updateAll(['status' => $status], [
'id' => $val->coin->id, 'id' => $val->coin->id,
]); ]);
if (CoinIssueCoin::TYPE_YES == $val->coin->type) {
$params = [
'name' => $val->coin->name,
'symbol' => $val->coin->symbol,
'introduction' => $val->coin->introduction,
'total' => (int)$val->coin->total,
'price' => isset($val->coin->platform->issue_charge) ? (int)$val->coin->platform->issue_charge : 0,
'category' => (int)$val->coin->category,
'owner' => $val->coin->owner,
'platform_id' => $val->coin->platform_id,
'platform' => $val->coin->chain->platform
];
$this->syncCoin($params);
}
} }
//1.2查询后,交易成功 //1.2查询后,交易成功
...@@ -342,11 +356,12 @@ class IssueChainTransferController extends Controller ...@@ -342,11 +356,12 @@ class IssueChainTransferController extends Controller
public function syncCoin($params = []) public function syncCoin($params = [])
{ {
$model_coin = Coin::find()->where(['name' => $params['name'], 'platform' => $params['platform']])->one(); $model_coin = Coin::find()->where(['name' => $params['symbol'], 'platform' => $params['platform']])->one();
if (false == $model_coin) { if (false == $model_coin) {
$model = new Coin(); $model = new Coin();
$model->name = $params['symbol']; $model->name = $params['symbol'];
$model->sid = $params['name']; $model->sid = $params['name'];
$model->nickname = ['ja' => '', 'en-US' => '', 'zh-CN' => ''];
$model->platform = $params['platform']; $model->platform = $params['platform'];
$model->publish_count = $params['total'] * 1e8; $model->publish_count = $params['total'] * 1e8;
$model->chain = 'BTY'; $model->chain = 'BTY';
......
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