Commit ff7f50ad authored by ZhuChunYang's avatar ZhuChunYang

update

parent d5d352d1
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
namespace backend\controllers; namespace backend\controllers;
use common\business\Chain33Business; use common\business\Chain33Business;
use common\models\psources\CoinPublishRule;
use Yii; use Yii;
use backend\models\coin\CoinPublishForm; use backend\models\coin\CoinPublishForm;
use common\models\psources\CoinPublish; use common\models\psources\CoinPublish;
...@@ -99,6 +100,10 @@ class CoinPublishController extends BaseController ...@@ -99,6 +100,10 @@ class CoinPublishController extends BaseController
$id = Yii::$app->request->get('id', null); $id = Yii::$app->request->get('id', null);
if ($id) { if ($id) {
$model = CoinPublish::findOne(['id' => $id]); $model = CoinPublish::findOne(['id' => $id]);
$ruleCount = CoinPublishRule::getRuleCountByPid($id);
if($ruleCount > 0){
return ['code' => -1, 'msg' => '存在锁仓规则,无法删除币种监控'];
}
if ($model->delete()) { if ($model->delete()) {
return ['code' => 0, 'msg' => 'succeed']; return ['code' => 0, 'msg' => 'succeed'];
} }
......
...@@ -59,6 +59,8 @@ table.on('tool(table1)', function (obj) { ...@@ -59,6 +59,8 @@ table.on('tool(table1)', function (obj) {
if (rev.code == 0) { if (rev.code == 0) {
obj.del(); obj.del();
layer.close(index); layer.close(index);
}else{
layer.msg(rev.msg);
} }
}); });
}); });
......
...@@ -30,4 +30,5 @@ class CoinPublish extends BaseActiveRecord ...@@ -30,4 +30,5 @@ class CoinPublish extends BaseActiveRecord
{ {
return '{{%coin_publish}}'; return '{{%coin_publish}}';
} }
} }
...@@ -53,6 +53,12 @@ class CoinPublishRule extends BaseActiveRecord ...@@ -53,6 +53,12 @@ class CoinPublishRule extends BaseActiveRecord
return CoinReleaseMember::find()->where(['rule_id' => $this->id])->count(); return CoinReleaseMember::find()->where(['rule_id' => $this->id])->count();
} }
public static function getRuleCountByPid($pid)
{
return self::find()->where(['pid' => $pid])->count();
}
public function formName() public function formName()
{ {
return ''; return '';
......
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