Commit dbc900ff authored by shajiaiming's avatar shajiaiming

Merge branch 'feature/issue_coin' into 'master'

Feature/issue coin See merge request !259
parents f6fa15ea 39960b09
......@@ -193,7 +193,7 @@ class IssueCoinController extends BaseController
$pages = new Pagination(['totalCount' => $countQuery->count(), 'pageSize' => $size]);
foreach ($models as &$val) {
$val->chain_id = $val->chain->platform;
$val->total = (int)$val->total * 1e8;
$val->total = (int)$val->total * 1e4;
}
$data = [
'list' => $models,
......@@ -231,7 +231,7 @@ class IssueCoinController extends BaseController
$code = -1;
goto doEnd;
}
$data->total = (int)$data->total * 1e8;
$data->total = (int)$data->total * 1e4;
$data->chain_name = $data->chain->platform;
$data->issue_charge = rtrim(sprintf('%.3f', floatval($data->charge)), '0');
$code = 0;
......
......@@ -129,14 +129,14 @@ class CoinIssueCoin extends CommonActiveRecord
public function verfiyAmount($attribute, $params)
{
if (CoinIssueCoin::TYPE_YES == $this->type) {
if ($this->$attribute > 10) {
if ($this->$attribute > (10 * 1e4)) {
$this->addError($attribute, '增发发行量不能超过10亿');
return false;
}
}
$issue_record = CoinIssueCoin::find()->where(['platform_id' => $this->platform_id, 'symbol' => $this->symbol, 'status' => CoinIssueCoin::STATUS_SUCCESS])->sum('total');
$issue_record = empty($issue_record) ? 0 : $issue_record;
if ($issue_record + $this->$attribute > 900) {
if ($issue_record + $this->$attribute > (900 * 1e4)) {
$this->addError($attribute, '最大发行量900亿,目前已发行' . $issue_record . '亿');
return false;
}
......@@ -163,18 +163,6 @@ class CoinIssueCoin extends CommonActiveRecord
return array_merge(parent::attributes(), ['issue_charge', 'url', 'chain_name']);
}
/**
* 获取状态数组
* @return array
*/
public static function getAgentStatus()
{
return [
self::STATUS_SUCCESS => '发行成功',
self::STATUS_FAIL => '发行失败',
];
}
public function getChain()
{
return $this->hasOne(CoinPlatformWithHold::className(), ['id' => 'chain_id']);
......
......@@ -369,12 +369,12 @@ class IssueChainTransferController extends Controller
$model->sid = $params['name'];
$model->nickname = ['ja' => '', 'en-US' => '', 'zh-CN' => ''];
$model->platform = $params['platform'];
$model->publish_count = $params['total'] * 1e8;
$model->publish_count = $params['total'] * 1e4;
$model->chain = 'BTY';
$model->treaty = 1;
$model->save();
} else {
$model_coin->publish_count = $model_coin->publish_count + $params['total'] * 1e8;
$model_coin->publish_count = $model_coin->publish_count + $params['total'] * 1e4;
$model_coin->save();
}
}
......
......@@ -61,7 +61,7 @@ class IssueCoinController extends BaseController
$platform = isset($val->chain->platform) ? $val->chain->platform : '';
$val->chain_name = $platform;
$val->url = Yii::$app->redis->hget('platform_brower_info', $platform);
$val->total = (int)$val->total * 1e8;
$val->total = (int)$val->total * 1e4;
}
$data = [
'list' => $models,
......@@ -95,7 +95,7 @@ class IssueCoinController extends BaseController
$data = CoinIssueCoin::find()->where(['id' => $id])->one();
$platform = isset($data->chain->platform) ? $data->chain->platform : '';
$data->total = (int)$data->total * 1e8;
$data->total = (int)$data->total * 1e4;
$data->issue_charge = rtrim(sprintf('%.3f', floatval($data->charge)), '0');
$data->url = Yii::$app->redis->hget('platform_brower_info', $platform);
$code = 0;
......
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