Commit b3a998ad authored by shajiaiming's avatar shajiaiming

申请规则调整

parent 3357b8de
......@@ -45,7 +45,6 @@ class IssueCoinController extends BaseController
'symbol' => isset($result['symbol']) ? strtoupper($result['symbol']) : '',
'total' => isset($result['total']) ? $result['total'] : '',
'owner' => isset($result['owner']) ? $result['owner'] : '',
'url' => isset($result['url']) ? $result['url'] : '',
'introduction' => isset($result['introduction']) ? $result['introduction'] : '',
'category' => isset($result['category']) ? $result['category'] : 0,
'platform_id' => $platform_id,
......@@ -54,7 +53,7 @@ class IssueCoinController extends BaseController
];
$model->load($result, '');
if (!$model->save()) {
$msg = current($model->firstErrors);
$msg = $model->errors;
$code = -1;
goto doEnd;
}
......
......@@ -35,7 +35,7 @@ class CoinIssueCoin extends CommonActiveRecord
public function rules()
{
return [
[['name', 'symbol', 'total', 'owner', 'url', 'introduction', 'category', 'platform_id', 'chain_id', 'charge_unit_id'], 'required'],
[['name', 'symbol', 'total', 'owner', 'introduction', 'category', 'platform_id', 'chain_id', 'charge_unit_id'], 'required'],
[['total', 'category', 'platform_id', 'chain_id', 'charge_unit_id'], 'integer'],
['introduction', 'string', 'length' => [1, 20]],
['symbol', 'string', 'length' => [1, 20]],
......@@ -43,7 +43,6 @@ class CoinIssueCoin extends CommonActiveRecord
['name', 'string', 'length' => [1, 6]],
#['status', 'in', 'range' => [1, 2, 0]],
['symbol', 'unique'],
['url', 'url'],
['total', 'verfiyAmount']
];
}
......@@ -53,14 +52,15 @@ class CoinIssueCoin extends CommonActiveRecord
$issue_record = CoinIssueRecord::find()->where(['platform_id' => $this->platform_id])->sum('total');
$issue_record = empty($issue_record) ? 0 : $issue_record;
if ($issue_record + $this->$attribute >= 900) {
$this->addError($this->$attribute, '最大发行量900亿,目前已发行'. $issue_record. '亿');
$this->addError($attribute, '最大发行量900亿,目前已发行'. $issue_record. '亿');
return false;
}
}
public function scenarios()
{
$scenarios = [
self:: SCENARIOS_CREATE => ['name', 'symbol', 'total', 'owner', 'introduction', 'category', 'platform_id', 'chain_id', 'url', 'charge_unit_id'],
self:: SCENARIOS_CREATE => ['name', 'symbol', 'total', 'owner', 'introduction', 'category', 'platform_id', 'chain_id', 'charge_unit_id'],
self:: SCENARIOS_UPDATE => ['status', 'msg'],
self:: SCENARIOS_CANCEL => ['status'],
];
......@@ -80,13 +80,12 @@ class CoinIssueCoin extends CommonActiveRecord
'msg' => '失败原因',
'status' => '状态',
'charge_unit_id' => '手续费',
'url' => '浏览器地址'
];
}
public function attributes()
{
return array_merge(parent::attributes(), ['charge', 'charge_unit']);
return array_merge(parent::attributes(), ['charge', 'charge_unit', 'url']);
}
/**
......
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