Commit b9e90dbd authored by shajiaiming's avatar shajiaiming

修复已知问题

parent 700cce58
...@@ -89,8 +89,9 @@ class IssueCoinController extends BaseController ...@@ -89,8 +89,9 @@ class IssueCoinController extends BaseController
$data = null; $data = null;
$header = Yii::$app->request->headers; $header = Yii::$app->request->headers;
$platform_id = $header['FZM-PLATFORM-ID'] ?? null; $platform_id = $header['FZM-PLATFORM-ID'] ?? null;
$address = Yii::$app->request->get('address', '');
if (empty($platform_id)) { if (empty($platform_id) || empty($address)) {
$msg = '缺少必要的参数'; $msg = '缺少必要的参数';
$code = -1; $code = -1;
goto doEnd; goto doEnd;
...@@ -101,7 +102,7 @@ class IssueCoinController extends BaseController ...@@ -101,7 +102,7 @@ class IssueCoinController extends BaseController
$query = CoinIssueCoin::find() $query = CoinIssueCoin::find()
->select('id, name, total, create_time, status, chain_id') ->select('id, name, total, create_time, status, chain_id')
->where(['platform_id' => $platform_id]) ->where(['owner' => $address])
->orderBy('create_time desc'); ->orderBy('create_time desc');
$countQuery = clone $query; $countQuery = clone $query;
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace console\controllers; namespace console\controllers;
use common\models\psources\Coin;
use common\models\psources\CoinIssueCoin; use common\models\psources\CoinIssueCoin;
use common\service\chain33\Chain33Service; use common\service\chain33\Chain33Service;
use Yii; use Yii;
...@@ -44,6 +45,9 @@ class IssueCoinController extends Controller ...@@ -44,6 +45,9 @@ class IssueCoinController extends Controller
$result = $chain_service->createRawTokenPreCreateTx($params); $result = $chain_service->createRawTokenPreCreateTx($params);
if (null == $result['error'] && false == $result['code']) { if (null == $result['error'] && false == $result['code']) {
$status = CoinIssueCoin::SUCCESS_ISSUE; $status = CoinIssueCoin::SUCCESS_ISSUE;
$params['platform'] = $issue_coin->chain->platform;
$this->syncCoin($params);
} else { } else {
$status = CoinIssueCoin::FAIL_ISSUE; $status = CoinIssueCoin::FAIL_ISSUE;
} }
...@@ -94,6 +98,8 @@ class IssueCoinController extends Controller ...@@ -94,6 +98,8 @@ class IssueCoinController extends Controller
$result = $chain_service->createRawTokenPreCreateTx($params); $result = $chain_service->createRawTokenPreCreateTx($params);
if (null == $result['error'] && false == $result['code']) { if (null == $result['error'] && false == $result['code']) {
$status = CoinIssueCoin::SUCCESS_ISSUE; $status = CoinIssueCoin::SUCCESS_ISSUE;
$params['platform'] = $issue_coin->chain->platform;
$this->syncCoin($params);
} else { } else {
$status = CoinIssueCoin::FAIL_ISSUE; $status = CoinIssueCoin::FAIL_ISSUE;
} }
...@@ -111,4 +117,19 @@ class IssueCoinController extends Controller ...@@ -111,4 +117,19 @@ class IssueCoinController extends Controller
echo date('Y-m-d H:i:s') . '发行成功' . PHP_EOL; echo date('Y-m-d H:i:s') . '发行成功' . PHP_EOL;
return 0; return 0;
} }
public function syncCoin($params = [])
{
$model_coin = Coin::find()->where(['name' => $params['name'], 'platform' => $params['platform']])->one();
if (false == $model_coin) {
$model = new Coin();
$model->name = $params['name'];
$model->sid = $params['symbol'];
$model->platform = $params['platform'];
$model->introduce['zh-CN'] = $params['introduction'];
$model->chain = 'BTY';
$model->treaty = 1;
$model->save();
}
}
} }
\ No newline at end of file
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