'请输入正确的区域信息'], ['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_push_freshcity.img','pfg_push_freshcity.city_id','pfg_push_freshcity.id','pfg_category_city.city_name','pfg_push_freshcity.create_at','pfg_push_freshcity.is_show','pfg_push_freshcity.sort']); $query->andWhere(['pfg_push_freshcity.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_city.city_id'=>$input['city_id']]); } $query->leftJoin('pfg_category_city','pfg_push_freshcity.city_id=pfg_category_city.id'); if(!empty($input['page'])) { $query->limit = $input['limit']; $query->offset = ($input['page']-1 )* $input['limit']; } return $query->orderBy(['pfg_push_freshcity.create_at'=>SORT_DESC])->asArray()->all(); } public function WhereColumn($query) { } public function Total() { $query = self::find(); $query->andWhere(['pfg_push_freshcity.del'=>$this->setDel]); $query->leftJoin('pfg_category_city','pfg_push_freshcity.city_id=pfg_category_city.id'); return $query->count(); } public function Homegetlist() { $query = self::find(); $query->select(['pfg_category_city.id','pfg_category_city.city_name','pfg_push_freshcity.img']); $query->andWhere(['pfg_push_freshcity.del'=>$this->setDel]); $query->andWhere(['pfg_push_freshcity.is_show'=>1]); $query->leftJoin('pfg_category_city','pfg_push_freshcity.city_id=pfg_category_city.id'); $query->orderBy(['pfg_push_freshcity.sort'=>SORT_ASC]); $query->limit = 10; return $query->asArray()->all(); } }