Commit 2a4156b6 authored by shajiaiming's avatar shajiaiming

fix

parent eba58e9b
...@@ -71,37 +71,49 @@ class CoinIssueCoin extends CommonActiveRecord ...@@ -71,37 +71,49 @@ class CoinIssueCoin extends CommonActiveRecord
public function verfiyName($attribute, $params) public function verfiyName($attribute, $params)
{ {
if (CoinIssueCoin::TYPE_YES == $this->type) { if (CoinIssueCoin::TYPE_YES == $this->type) {
return true; $model = CoinIssueCoin::find()->where(['name' => $this->name, 'owner' => $this->owner, 'platform_id' => $this->platform_id, 'status' => CoinIssueCoin::STATUS_SUCCESS])->orderBy('id desc')->one();
} if (false == $model) {
$model = CoinIssueCoin::find() $this->addError($attribute, '该Token币种尚未发行');
->where(['name' => $this->name, 'owner' => $this->owner, 'status' => CoinIssueCoin::STATUS_SUCCESS]) return false;
->orderBy('id desc')->one(); }
if (false == $model) { if (0 == $model->category) {
return true; $this->addError($attribute, '该Token币种不可增发');
return false;
}
} }
if (0 == $model->category) { if (CoinIssueCoin::TYPE_NO == $this->type) {
$this->addError($attribute, '名称已存在'); $model = CoinIssueCoin::find()->where(['name' => $this->name, 'owner' => $this->owner, 'platform_id' => $this->platform_id, 'status' => CoinIssueCoin::STATUS_SUCCESS])->orderBy('id desc')->one();
return false; if ($model) {
$this->addError($attribute, 'Token名称已存在');
return false;
}
} }
} }
public function verfiySymbol($attribute, $params) public function verfiySymbol($attribute, $params)
{ {
if (!preg_match('/^[A-Z]+$/', $this->symbol)) { if (!preg_match('/^[A-Z]+$/', $this->symbol)) {
$this->addError($attribute, '称必须大写'); $this->addError($attribute, 'Token简称必须大写');
return false; return false;
} }
if (CoinIssueCoin::TYPE_YES == $this->type) { if (CoinIssueCoin::TYPE_YES == $this->type) {
return true; $model = CoinIssueCoin::find()->where(['symbol' => $this->symbol, 'owner' => $this->owner, 'platform_id' => $this->platform_id, 'status' => CoinIssueCoin::STATUS_SUCCESS])->orderBy('id desc')->one();
} if (false == $model) {
$model = CoinIssueCoin::find()->where(['symbol' => $this->symbol, 'owner' => $this->owner, 'status' => CoinIssueCoin::STATUS_SUCCESS])->orderBy('id desc')->one(); $this->addError($attribute, '该Token币种尚未发行');
if (false == $model) { return false;
return true; }
if (0 == $model->category) {
$this->addError($attribute, '该Token币种不可增发');
return false;
}
} }
if (0 == $model->category) { if (CoinIssueCoin::TYPE_NO == $this->type) {
$this->addError($attribute, '名称已存在'); $model = CoinIssueCoin::find()->where(['symbol' => $this->symbol, 'owner' => $this->owner, 'platform_id' => $this->platform_id, 'status' => CoinIssueCoin::STATUS_SUCCESS])->orderBy('id desc')->one();
return false; if ($model) {
$this->addError($attribute, 'Token名称已存在');
return false;
}
} }
} }
...@@ -173,6 +185,7 @@ class CoinIssueCoin extends CommonActiveRecord ...@@ -173,6 +185,7 @@ class CoinIssueCoin extends CommonActiveRecord
{ {
return $this->hasOne(CoinIssueChainRecord::className(), ['issue_coin_id' => 'id']); return $this->hasOne(CoinIssueChainRecord::className(), ['issue_coin_id' => 'id']);
} }
public function getRevoke() public function getRevoke()
{ {
return $this->hasOne(CoinIssueRevokeRecord::className(), ['issue_coin_id' => 'id']); return $this->hasOne(CoinIssueRevokeRecord::className(), ['issue_coin_id' => 'id']);
......
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