Commit 8cb1008d authored by shajiaiming's avatar shajiaiming

fix

parent a736d41f
......@@ -54,10 +54,11 @@ class IssueCoinController extends BaseController
'chain_id' => $chain_id,
'charge_unit' => isset($result['charge_unit']) ? $result['charge_unit'] : '',
'charge' => $coin_platform->issue_charge,
'token_type' => isset($result['token_type']) ? $result['token_type'] : 0,
'nickname' => isset($result['nickname']) ? $result['nickname'] : ''
];
$model = new CoinIssueCoin();
if (35 == $platform_id) {
$result['token_type'] = isset($result['token_type']) ? $result['token_type'] : 0;
$model->setScenario(CoinIssueCoin::SCENARIOS_CREATE_MALL);
} else {
$model->setScenario(CoinIssueCoin::SCENARIOS_CREATE);
......@@ -121,11 +122,8 @@ class IssueCoinController extends BaseController
$code = -1;
goto doEnd;
}
foreach (Yii::$app->params['lang'] as $key => $val) {
$name[$val] = isset($result[$val]) ? $result[$val] : '';
}
$result = [
'name' => $name,
'name' => isset($result['name']) ? $result['name'] : '',
'symbol' => isset($result['symbol']) ? strtoupper($result['symbol']) : '',
'total' => isset($result['total']) ? $result['total'] : '',
'owner' => isset($result['owner']) ? $result['owner'] : '',
......@@ -135,11 +133,12 @@ class IssueCoinController extends BaseController
'platform_id' => $platform_id,
'chain_id' => $chain_id,
'charge_unit' => isset($result['charge_unit']) ? $result['charge_unit'] : '',
'charge' => (CoinIssueCoin::TYPE_NO == $result['type']) ? $coin_platform->issue_charge : 0,
'charge' => isset($result['type']) ? ((CoinIssueCoin::TYPE_NO == $result['type']) ? $coin_platform->issue_charge : 0) : 0,
'token_type' => isset($result['token_type']) ? $result['token_type'] : 0,
'nickname' => isset($result['nickname']) ? $result['nickname'] : ''
];
$model = new CoinIssueCoin();
if (35 == $platform_id) {
$result['token_type'] = isset($result['token_type']) ? $result['token_type'] : 0;
$model->setScenario(CoinIssueCoin::SCENARIOS_CREATE_MALL);
} else {
$model->setScenario(CoinIssueCoin::SCENARIOS_CREATE);
......@@ -204,7 +203,6 @@ class IssueCoinController extends BaseController
$models = $query->offset(($page - 1) * $size)->limit($size)->all();
$pages = new Pagination(['totalCount' => $countQuery->count(), 'pageSize' => $size]);
foreach ($models as &$val) {
$val->name = isset($val->name['en-US']) ? $val->name['en-US'] : '';
$val->chain_id = $val->chain->platform;
$val->total = (int)$val->total * 1e4;
}
......@@ -244,7 +242,6 @@ class IssueCoinController extends BaseController
$code = -1;
goto doEnd;
}
$data->name = $data->name['en-US'];
$data->total = (int)$data->total * 1e4;
$data->chain_name = $data->chain->platform;
$data->issue_charge = rtrim(sprintf('%.3f', floatval($data->charge)), '0');
......
......@@ -52,7 +52,8 @@ class CoinIssueCoin extends CommonActiveRecord
[['introduction', 'charge_unit'], 'string', 'length' => [1, 20]],
['symbol', 'string', 'length' => [1, 6]],
['name', 'string', 'length' => [1, 20]],
['token_type', 'safe'],
['nickname', 'string', 'length' => [0, 10]],
[['token_type', 'nickname'], 'safe'],
#['status', 'in', 'range' => [1, 2, 0]],
['name', 'verfiyName'],
['symbol', 'verfiySymbol'],
......@@ -63,8 +64,8 @@ class CoinIssueCoin extends CommonActiveRecord
public function scenarios()
{
$scenarios = [
self:: SCENARIOS_CREATE => ['name', 'symbol', 'total', 'owner', 'introduction', 'category', 'type', 'platform_id', 'chain_id', 'charge_unit', 'charge'],
self:: SCENARIOS_CREATE_MALL => ['name', 'symbol', 'total', 'owner', 'introduction', 'category', 'type', 'platform_id', 'chain_id', 'token_type'],
self:: SCENARIOS_CREATE => ['name', 'symbol', 'total', 'owner', 'introduction', 'category', 'type', 'platform_id', 'chain_id', 'charge_unit', 'charge', 'token_type', 'nickname'],
self:: SCENARIOS_CREATE_MALL => ['name', 'symbol', 'total', 'owner', 'introduction', 'category', 'type', 'platform_id', 'chain_id', 'token_type', 'nickname'],
self:: SCENARIOS_UPDATE => ['status'],
self:: SCENARIOS_CANCEL => ['status'],
];
......
......@@ -256,6 +256,7 @@ class IssueChainTransferController extends Controller
if (CoinIssueCoin::TYPE_YES == $val->coin->type) {
$params = [
'name' => $val->coin->name,
'nickname' => $val->nickname,
'symbol' => $val->coin->symbol,
'introduction' => $val->coin->introduction,
'total' => (int)$val->coin->total,
......@@ -277,6 +278,7 @@ class IssueChainTransferController extends Controller
if (CoinIssueCoin::TYPE_NO == $val->coin->type) {
$params = [
'name' => $val->coin->name,
'nickname' => $val->nickname,
'symbol' => $val->coin->symbol,
'introduction' => $val->coin->introduction,
'total' => (int)$val->coin->total,
......@@ -373,8 +375,8 @@ class IssueChainTransferController extends Controller
if (false == $model_coin) {
$model = new Coin();
$model->name = $params['symbol'];
$model->sid = isset($params['name']['en-US']) ? $params['name']['en-US'] : '';
$model->nickname = $params['name'];
$model->sid = $params['name'];
$model->nickname = ['ja' => '', 'en-US' => '', 'zh-CN' => $params['nickname']];
$model->platform = $params['platform'];
$model->publish_count = $params['total'] * 1e4;
$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