'{attribute}不能为空'], ['url', 'url', 'defaultScheme' => 'http','message'=>'请输入正确的地址'], ['title','string','max'=>50], ['city','number'], ['developers','number'], ['hid','number','message'=>'请选择楼盘'], ['sort','number','message'=>'排序只能是数字'], ['sort','number','max'=>10000], ]; } public function attributeLabels() { return [ 'hid'=>'楼盘名称', 'url'=>'地址', 'title'=>'标题', ]; } public function Authenticator($input) { $this->load($input,''); if(!$this->validate()) return $this->errors; return $this; } public function FindById($id) { return self::findOne($id); } public function getList($input) { $query = self::find(); $query->select(['pfg_house.name','pfg_pushm_villa.id','pfg_pushm_villa.hid','pfg_pushm_villa.img','pfg_pushm_villa.url','pfg_pushm_villa.title','pfg_pushm_villa.create_at','pfg_pushm_villa.is_show']); $query->andWhere(['pfg_pushm_villa.del'=>$this->setDel]); $query->leftJoin('pfg_house','pfg_pushm_villa.hid=pfg_house.id'); if(!empty($input['page'])) { $query->limit = $input['limit']; $query->offset = ($input['page']-1 )* $input['limit']; } return $query->orderBy(['pfg_pushm_villa.create_at'=>SORT_DESC])->asArray()->all(); } public function WhereColumn($query) { } public function Total() { $query = self::find(); $query->andWhere(['pfg_pushm_villa.del'=>$this->setDel]); $query->leftJoin('pfg_house','pfg_pushm_villa.hid=pfg_house.id'); return $query->count(); } public function HomeGetList($limit = 10) { $query = self::find(); $query->select(['img','url','title']); $query->andWhere(['del'=>$this->setDel]); $query->andFilterWhere(['city'=>$this->city]); $query->andWhere(['is_show'=>1]); $query->orderBy(['sort'=>SORT_ASC]); $query->limit = $limit; return $query->all(); } /**不分地区读取全部*/ public function GetAllList() { $query = self::find(); $query->select(['img','url','title']); $query->andWhere(['del'=>$this->setDel]); $query->andWhere(['is_show'=>1]); $query->orderBy(['sort'=>SORT_ASC]); $query->limit = 5; return $query->all(); } }