Commit 2a4156b6 authored by shajiaiming's avatar shajiaiming

fix

parent eba58e9b
...@@ -71,39 +71,51 @@ class CoinIssueCoin extends CommonActiveRecord ...@@ -71,39 +71,51 @@ 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();
}
$model = CoinIssueCoin::find()
->where(['name' => $this->name, 'owner' => $this->owner, 'status' => CoinIssueCoin::STATUS_SUCCESS])
->orderBy('id desc')->one();
if (false == $model) { if (false == $model) {
return true; $this->addError($attribute, '该Token币种尚未发行');
return false;
} }
if (0 == $model->category) { if (0 == $model->category) {
$this->addError($attribute, '名称已存在'); $this->addError($attribute, '该Token币种不可增发');
return false; return false;
} }
} }
if (CoinIssueCoin::TYPE_NO == $this->type) {
$model = CoinIssueCoin::find()->where(['name' => $this->name, 'owner' => $this->owner, 'platform_id' => $this->platform_id, 'status' => CoinIssueCoin::STATUS_SUCCESS])->orderBy('id desc')->one();
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();
}
$model = CoinIssueCoin::find()->where(['symbol' => $this->symbol, 'owner' => $this->owner, 'status' => CoinIssueCoin::STATUS_SUCCESS])->orderBy('id desc')->one();
if (false == $model) { if (false == $model) {
return true; $this->addError($attribute, '该Token币种尚未发行');
return false;
} }
if (0 == $model->category) { if (0 == $model->category) {
$this->addError($attribute, '名称已存在'); $this->addError($attribute, '该Token币种不可增发');
return false;
}
}
if (CoinIssueCoin::TYPE_NO == $this->type) {
$model = CoinIssueCoin::find()->where(['symbol' => $this->symbol, 'owner' => $this->owner, 'platform_id' => $this->platform_id, 'status' => CoinIssueCoin::STATUS_SUCCESS])->orderBy('id desc')->one();
if ($model) {
$this->addError($attribute, 'Token名称已存在');
return false; return false;
} }
} }
}
public function verfiyAmount($attribute, $params) public function verfiyAmount($attribute, $params)
{ {
...@@ -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