public function search($params, $upunitcode) { $query = Helpmenu::find()->andFilterWhere(['upunitcode' => $upunitcode]); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'upunitcode' => $this->upunitcode, 'corpflag' => $this->corpflag, 'do_date' => $this->do_date, 'answerdate' => $this->answerdate, 'is_private' => $this->is_private, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]); $query->andFilterWhere(['like', 'unitcode', $this->unitcode])->andFilterWhere(['like', 'unitname', $this->unitname])->andFilterWhere(['like', 'upunitname', $this->upunitname])->andFilterWhere(['like', 'content', $this->content])->andFilterWhere(['like', 'introduce', $this->introduce])->andFilterWhere(['like', 'do_man', $this->do_man])->andFilterWhere(['like', 'do_man_unit', $this->do_man_unit])->andFilterWhere(['like', 'advise', $this->advise])->andFilterWhere(['like', 'answer', $this->answer])->andFilterWhere(['like', 'answercontent', $this->answercontent]); return $dataProvider; }
public function actionDetail() { $unitcode = Yii::$app->request->post('unitcode', '%'); $unitname = Yii::$app->request->post('unitname', '系统使用帮助'); $helpmenu = new Helpmenu(); if ($helpmenu->isParent($unitcode)) { $searchModel = new HelpmenuSearch(); $dataProvider = $searchModel->search(Yii::$app->request->getQueryParams(), $unitcode); return $this->renderAjax('_detail-help-children', ['dataProvider' => $dataProvider, 'searchModel' => $searchModel, 'unitname' => $unitname]); } else { $model = Helpmenu::findOne(['unitcode' => $unitcode]); return $this->renderAjax('_detail-help-info', ['model' => $model]); } }