/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params, $num, $page) { $query = UserBaseInfo::find()->limit($num, ($page - 1) * $num); $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pagesize' => $num]]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'card_type' => $this->card_type, 'gender' => $this->gender, 'city' => $this->city, 'last_login_time' => $this->last_login_time, 'create_time' => $this->create_time, 'update_time' => $this->update_time, 'status' => $this->status]); // ]) // ->andFilterWhere(['between', 'last_login_time', $this->start, $this->end]); $query->andFilterWhere(['like', 'username', $this->username])->andFilterWhere(['like', 'realname', $this->realname])->andFilterWhere(['like', 'password', $this->password])->andFilterWhere(['like', 'password_salt', $this->password_salt])->andFilterWhere(['like', 'mobile', $this->mobile])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'card_id', $this->card_id])->andFilterWhere(['like', 'avatar', $this->avatar])->andFilterWhere(['like', 'company', $this->company])->andFilterWhere(['like', 'position', $this->position])->andFilterWhere(['like', 'reg_ip', $this->reg_ip])->andFilterWhere(['like', 'reg_channel', $this->reg_channel])->andFilterWhere(['like', 'last_login_ip', $this->last_login_ip]); return $dataProvider; }