Commit 3eee34b1 authored by shajiaiming's avatar shajiaiming

fix

parent a519f355
......@@ -19,6 +19,8 @@ class Notice extends BaseActiveRecord
const TYPE_ROLL = 1; //滚动
const TYPE_POP = 0; //弹窗
const TOP_TRUE = 1; //置顶公告
//定义场景
const SCENARIOS_CREATE = 'create';
const SCENARIOS_UPDATE = 'update';
......@@ -41,7 +43,7 @@ class Notice extends BaseActiveRecord
public function verfiyIsTop($attribute, $params)
{
$count = self::find()->where(['platform_id' => $this->platform_id, 'is_top' => $this->is_top])->count();
$count = self::find()->where(['platform_id' => $this->platform_id, 'is_top' => Notice::TOP_TRUE])->count();
if ($count >= 1) {
$this->addError($attribute, '置顶公告只能1条');
return false;
......
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