/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = IdcardLog::find()->orderBy('id DESC'); $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 10]]); $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, 'uid' => $this->uid, 'status' => $this->status, 'create_at' => $this->create_at, 'update_at' => $this->update_at]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'idcard', $this->idcard])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'sex', $this->sex])->andFilterWhere(['like', 'birthday', $this->birthday])->andFilterWhere(['like', 'remark', $this->remark]); return $dataProvider; }
/** * 身份验证错误日志记录 * @param $uid * @param $name * @param $idcard * @param $status * @param $remark */ private static function idcardLog($uid, $name, $idcard, $status, $remark) { $cardLog = new IdcardLog(); $cardLog->uid = $uid; $cardLog->name = $name; $cardLog->idcard = $idcard; $cardLog->status = $status; $cardLog->remark = $remark; $cardLog->save(); }
/** * Finds the IdcardLog model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return IdcardLog the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = IdcardLog::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }