50], ['city','number'], ['menu','number'], ['sort','number','max'=>10000], ]; } public function attributeLabels() { return [ 'menu'=>'菜单', 'city'=>'城市', ]; } 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_category_city.city_name','pfg_pushm_menu.id','pfg_frontend.name','pfg_pushm_menu.city','pfg_pushm_menu.menu','pfg_pushm_menu.create_at']); $query->andWhere(['pfg_pushm_menu.del'=>$this->setDel]); $query->leftJoin('pfg_category_city','pfg_pushm_menu.city=pfg_category_city.id'); $query->leftJoin('pfg_frontend','pfg_pushm_menu.menu=pfg_frontend.id'); if(!empty($input['page'])) { $query->limit = $input['limit']; $query->offset = ($input['page']-1 )* $input['limit']; } return $query->orderBy(['pfg_pushm_menu.create_at'=>SORT_DESC])->asArray()->all(); } public function WhereColumn($query) { } public function Total() { $query = self::find(); $query->andWhere(['pfg_pushm_menu.del'=>$this->setDel]); $query->leftJoin('pfg_house','pfg_pushm_menu.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(); } public function SysmenuList($city,$limit,$select = []) { $query = self::find(); $query->select(['pfg_frontend.id','pfg_frontend.name','pfg_frontend.url','pfg_frontend.function','pfg_frontend.icon','pfg_pushm_menu.menu']); $query->andWhere(['pfg_pushm_menu.del'=>$this->setDel]); $query->andWhere(['pfg_pushm_menu.city'=>$city]); $query->innerJoin('pfg_frontend','pfg_pushm_menu.menu=pfg_frontend.id and pfg_frontend.status=1 and pfg_frontend.del =1'); $row = $query->one(); if($row) { $q = new Frontend(); $q->pid = $row['id']; return $q->SonList($limit,$select); } return false; // $query->limit = $limit; // return $query->orderBy(['pfg_frontend.sort'=>SORT_DESC])->asArray()->all(); } }