Commit f928ae53 authored by shajiaiming's avatar shajiaiming

fix

parent d75af376
...@@ -52,7 +52,7 @@ class IssueCoinController extends BaseController ...@@ -52,7 +52,7 @@ class IssueCoinController extends BaseController
'type' => isset($result['type']) ? $result['type'] : 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' => isset($result['charge_unit']) ? $result['charge_unit'] : '',
'charge' => $coin_platform->issue_charge, 'charge' => $coin_platform->issue_charge,
]; ];
$model = new CoinIssueCoin(); $model = new CoinIssueCoin();
...@@ -129,7 +129,7 @@ class IssueCoinController extends BaseController ...@@ -129,7 +129,7 @@ class IssueCoinController extends BaseController
'type' => isset($result['type']) ? $result['type'] : 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' => isset($result['charge_unit']) ? $result['charge_unit'] : '',
'charge' => $coin_platform->issue_charge, 'charge' => $coin_platform->issue_charge,
]; ];
$model->load($result, ''); $model->load($result, '');
...@@ -234,7 +234,6 @@ class IssueCoinController extends BaseController ...@@ -234,7 +234,6 @@ class IssueCoinController extends BaseController
$data->total = (int)$data->total * 1e8; $data->total = (int)$data->total * 1e8;
$data->chain_name = $data->chain->platform; $data->chain_name = $data->chain->platform;
$data->issue_charge = rtrim(sprintf('%.3f', floatval($data->charge)), '0'); $data->issue_charge = rtrim(sprintf('%.3f', floatval($data->charge)), '0');
$data->charge_unit = isset($data->platform->charge_unit) ? $data->platform->charge_unit : '';
$code = 0; $code = 0;
$msg = 'success'; $msg = 'success';
if (CoinIssueCoin::STATUS_FAILED == $data->status) { if (CoinIssueCoin::STATUS_FAILED == $data->status) {
......
...@@ -46,9 +46,9 @@ class CoinIssueCoin extends CommonActiveRecord ...@@ -46,9 +46,9 @@ class CoinIssueCoin extends CommonActiveRecord
public function rules() public function rules()
{ {
return [ return [
[['name', 'symbol', 'total', 'owner', 'introduction', 'category', 'type', 'platform_id', 'chain_id', 'charge_unit_id', 'charge'], 'required'], [['name', 'symbol', 'total', 'owner', 'introduction', 'category', 'type', 'platform_id', 'chain_id', 'charge_unit', 'charge'], 'required'],
[['total', 'category', 'type', 'platform_id', 'chain_id', 'charge_unit_id'], 'integer'], [['total', 'category', 'type', 'platform_id', 'chain_id'], 'integer'],
['introduction', 'string', 'length' => [1, 20]], [['introduction','charge_unit'], 'string', 'length' => [1, 20]],
['symbol', 'string', 'length' => [1, 6]], ['symbol', 'string', 'length' => [1, 6]],
['name', 'string', 'length' => [1, 20]], ['name', 'string', 'length' => [1, 20]],
#['status', 'in', 'range' => [1, 2, 0]], #['status', 'in', 'range' => [1, 2, 0]],
...@@ -61,7 +61,7 @@ class CoinIssueCoin extends CommonActiveRecord ...@@ -61,7 +61,7 @@ class CoinIssueCoin extends CommonActiveRecord
public function scenarios() public function scenarios()
{ {
$scenarios = [ $scenarios = [
self:: SCENARIOS_CREATE => ['name', 'symbol', 'total', 'owner', 'introduction', 'category', 'type', 'platform_id', 'chain_id', 'charge_unit_id', 'charge'], self:: SCENARIOS_CREATE => ['name', 'symbol', 'total', 'owner', 'introduction', 'category', 'type', 'platform_id', 'chain_id', 'charge_unit', 'charge'],
self:: SCENARIOS_UPDATE => ['status'], self:: SCENARIOS_UPDATE => ['status'],
self:: SCENARIOS_CANCEL => ['status'], self:: SCENARIOS_CANCEL => ['status'],
]; ];
...@@ -148,13 +148,13 @@ class CoinIssueCoin extends CommonActiveRecord ...@@ -148,13 +148,13 @@ class CoinIssueCoin extends CommonActiveRecord
'chain_id' => '平行链名称', 'chain_id' => '平行链名称',
'msg' => '失败原因', 'msg' => '失败原因',
'status' => '状态', 'status' => '状态',
'charge_unit_id' => '手续费', 'charge_unit' => '手续费',
]; ];
} }
public function attributes() public function attributes()
{ {
return array_merge(parent::attributes(), ['issue_charge', 'charge_unit', 'url', 'chain_name']); return array_merge(parent::attributes(), ['issue_charge', 'url', 'chain_name']);
} }
/** /**
......
...@@ -29,12 +29,12 @@ class IssueCoinController extends BaseController ...@@ -29,12 +29,12 @@ class IssueCoinController extends BaseController
$chain_id = \Yii::$app->request->get('chain_id', ''); $chain_id = \Yii::$app->request->get('chain_id', '');
if (1 == $platform_id) { if (1 == $platform_id) {
$query = CoinIssueCoin::find() $query = CoinIssueCoin::find()
->select('id, name, total, status, chain_id, charge_unit_id, charge, platform_id, owner, category, type, symbol, introduction, create_time') ->select('id, name, total, status, chain_id, charge_unit, charge, platform_id, owner, category, type, symbol, introduction, create_time')
->where(['in', 'status', [CoinIssueCoin::STATUS_CONFIRM, CoinIssueCoin::STATUS_ALLOW, CoinIssueCoin::STATUS_REFUSE, CoinIssueCoin::STATUS_SUCCESS, CoinIssueCoin::STATUS_FAILED]]) ->where(['in', 'status', [CoinIssueCoin::STATUS_CONFIRM, CoinIssueCoin::STATUS_ALLOW, CoinIssueCoin::STATUS_REFUSE, CoinIssueCoin::STATUS_SUCCESS, CoinIssueCoin::STATUS_FAILED]])
->orderBy('create_time desc'); ->orderBy('create_time desc');
} else { } else {
$query = CoinIssueCoin::find() $query = CoinIssueCoin::find()
->select('id, name, total, status, chain_id, charge_unit_id, charge, platform_id, owner, category, type, symbol, introduction, create_time') ->select('id, name, total, status, chain_id, charge_unit, charge, platform_id, owner, category, type, symbol, introduction, create_time')
->where(['platform_id' => $platform_id]) ->where(['platform_id' => $platform_id])
->andWhere(['in', 'status', [CoinIssueCoin::STATUS_CONFIRM, CoinIssueCoin::STATUS_ALLOW, CoinIssueCoin::STATUS_REFUSE, CoinIssueCoin::STATUS_SUCCESS, CoinIssueCoin::STATUS_FAILED]]) ->andWhere(['in', 'status', [CoinIssueCoin::STATUS_CONFIRM, CoinIssueCoin::STATUS_ALLOW, CoinIssueCoin::STATUS_REFUSE, CoinIssueCoin::STATUS_SUCCESS, CoinIssueCoin::STATUS_FAILED]])
->orderBy('create_time desc'); ->orderBy('create_time desc');
...@@ -60,7 +60,6 @@ class IssueCoinController extends BaseController ...@@ -60,7 +60,6 @@ class IssueCoinController extends BaseController
foreach ($models as &$val) { foreach ($models as &$val) {
$platform = isset($val->chain->platform) ? $val->chain->platform : ''; $platform = isset($val->chain->platform) ? $val->chain->platform : '';
$val->chain_name = $platform; $val->chain_name = $platform;
$val->charge_unit = isset($val->gas->coin_name) ? $val->gas->coin_name : '';
$val->url = Yii::$app->redis->hget('platform_brower_info', $platform); $val->url = Yii::$app->redis->hget('platform_brower_info', $platform);
$val->total = (int)$val->total * 1e8; $val->total = (int)$val->total * 1e8;
} }
...@@ -98,7 +97,6 @@ class IssueCoinController extends BaseController ...@@ -98,7 +97,6 @@ class IssueCoinController extends BaseController
$platform = isset($data->chain->platform) ? $data->chain->platform : ''; $platform = isset($data->chain->platform) ? $data->chain->platform : '';
$data->total = (int)$data->total * 1e8; $data->total = (int)$data->total * 1e8;
$data->issue_charge = rtrim(sprintf('%.3f', floatval($data->charge)), '0'); $data->issue_charge = rtrim(sprintf('%.3f', floatval($data->charge)), '0');
$data->charge_unit = isset($data->gas->coin_name) ? $data->gas->coin_name : '';
$data->url = Yii::$app->redis->hget('platform_brower_info', $platform); $data->url = Yii::$app->redis->hget('platform_brower_info', $platform);
$code = 0; $code = 0;
$msg = 'success'; $msg = 'success';
......
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