'请输入正确的区域信息'], ['hid','number','message'=>'请输入正确的楼盘信息'], ['sort','number','message'=>'排序只能是数字'], ['sort','number','max'=>10000], ]; } public function attributeLabels() { return [ 'city_id'=>'区域', ]; } 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_push_freshcityhouse.is_show','pfg_push_freshcityhouse.create_at','pfg_push_freshcityhouse.sort','pfg_push_freshcityhouse.id']); $query->andWhere(['pfg_push_freshcityhouse.del'=>$this->setDel]); // if(!empty($input['city_name'])) // { // $query->andWhere(['like','pfg_category_city.city_name',$input['city_name']]); // } if(!empty($input['city_id'])) { $query->andWhere(['pfg_push_freshcityhouse.city_id'=>$input['city_id']]); } $query->leftJoin('pfg_house','pfg_push_freshcityhouse.hid=pfg_house.id'); if(!empty($input['page'])) { $query->limit = $input['limit']; $query->offset = ($input['page']-1 )* $input['limit']; } return $query->orderBy(['pfg_push_freshcityhouse.create_at'=>SORT_DESC])->asArray()->all(); } public function WhereColumn($query) { } public function Total() { $query = self::find(); $query->andWhere(['pfg_push_freshcityhouse.del'=>$this->setDel]); $query->andWhere(['pfg_push_freshcityhouse.city_id'=>$this->city_id]); $query->leftJoin('pfg_house','pfg_push_freshcityhouse.hid=pfg_house.id'); return $query->count(); } public function Homegetlist() { $query = self::find(); $query->select(['pfg_house.id','pfg_category_city.id as cid','pfg_house.name','pfg_category_city.city_name','pfg_house.sale_price','pfg_house_detail.price_unit','pfg_house.thumb']); $query->andWhere(['pfg_push_freshcityhouse.del'=>$this->setDel]); $query->andWhere(['pfg_push_freshcityhouse.city_id'=>$this->city_id]); $query->andWhere(['pfg_push_freshcityhouse.is_show'=>1]); $query->leftJoin('pfg_house','pfg_push_freshcityhouse.hid=pfg_house.id'); $query->leftJoin('pfg_category_city','pfg_push_freshcityhouse.city_id=pfg_category_city.id'); $query->leftJoin('pfg_house_detail','pfg_house.id=pfg_house_detail.hid'); $query->orderBy(['pfg_push_freshcityhouse.sort'=>SORT_ASC]); $query->limit = 3; return $query->asArray()->all(); } }