Commit 2a4156b6 authored by shajiaiming's avatar shajiaiming

fix

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