'common\models\NewsRenovationcontent','on'=>['add'],'message'=>'该栏目已存在','filter'=>function($query){ $query->andWhere(['del'=>$this->setDel]); $query->andWhere(['label_id'=>$this->label_id]); $query->andWhere(['nid'=>$this->nid]); return $query; }], [['nid','content','label_id'],'required','message'=>'{attribute}不能为空'], ['sort','number'], ['is_show','in','range'=>[1,2]], ['del','in','range'=>[1,2]], ]; } public function attributeLabels() { return [ 'nid'=>'装修品鉴标题', 'label_id'=>'栏目', 'content'=>'内容', ]; } public function FindById($id) { return self::findOne($id); } public function Authenticator($input) { $this->load($input,''); if($this->validate()) return $this; return $this->errors; } public function getList($page) { $query = self::find(); $query->select(['pfg_category_label.name','pfg_news_renovationcontent.sort','pfg_news_renovationcontent.create_at','pfg_news_renovationcontent.is_show','pfg_news_renovationcontent.id']); $query->andWhere(['pfg_news_renovationcontent.del'=>$this->setDel]); $query->andWhere(['pfg_news_renovationcontent.nid'=>$this->nid]); if(!empty($page['page'])) { $query->offset = ($page['page'] - 1) * $page['limit']; $query->limit = $page['limit']; } $query->leftJoin('pfg_category_label','pfg_news_renovationcontent.label_id = pfg_category_label.id'); return $query->orderBy(['pfg_news_renovationcontent.sort'=>SORT_DESC])->asArray()->all(); } public function PcLabel() { $query = self::find(); $query->select(['pfg_news_renovationcontent.id','pfg_category_label.name','pfg_category_label.img','pfg_category_label.img1','pfg_news_renovationcontent']); $query->andWhere(['pfg_news_renovationcontent.del'=>1]); $query->andWhere(['pfg_news_renovationcontent.is_show'=>1]); $query->andWhere(['pfg_category_label.del'=>1]); $query->andWhere(['pfg_news_renovationcontent.nid'=>$this->nid]); $query->leftJoin('pfg_category_label','pfg_news_renovationcontent.label_id = pfg_category_label.id'); $query->orderBy(['pfg_category_label.sort'=>SORT_DESC]); return $query->asArray()->all(); } public function getListTotal() { $query = self::find(); $query->andWhere(['pfg_news_renovationcontent.del'=>$this->setDel]); $query->andWhere(['pfg_news_renovationcontent.nid'=>$this->nid]); return $query->count(); } public function MLabel() { $query = self::find(); $query->select(['pfg_news_renovationcontent.id','pfg_category_label.name','pfg_category_label.img','pfg_category_label.img1','pfg_news_renovationcontent.content']); $query->andWhere(['pfg_news_renovationcontent.del'=>1]); $query->andWhere(['pfg_news_renovationcontent.is_show'=>1]); $query->andWhere(['pfg_category_label.del'=>1]); $query->andWhere(['pfg_news_renovationcontent.nid'=>$this->nid]); $query->leftJoin('pfg_category_label','pfg_news_renovationcontent.label_id = pfg_category_label.id'); $query->orderBy(['pfg_category_label.sort'=>SORT_DESC]); return $query->asArray()->all(); } public function Total() { $query = self::find(); $query->andWhere(['nid'=>$this->nid]); $query->andWhere(['del'=>$this->setDel]); return $query->count(); } /** * */ public function RecordClick() { } }