protected function findModel($id) { if (($model = Xman::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('您要访问的页面不存在!'); } }
public function actionUpdate($id) { $model = Rel_read::find()->where("id = {$id}")->one(); // 查询阅读关联文章,纪录片,主人公 if ($post = Yii::$app->request->post()) { $model->set_read_rel($post); // 查询阅读关联文章,纪录片,主人公 $xman = Xman::getOneById($model->xman_id); $film = Film::getOneById($model->film_id); $article = Article::getOneById($model->article_id); if ($model->save(false)) { return $this->render('update', ['msg' => '更新相关阅读成功!', 'model' => $model, 'xman' => $xman, 'film' => $film, 'article' => $article]); } else { return $this->render('update', ['msg' => '更新相关阅读失败,请刷新重试!', 'model' => $model, 'xman' => $xman, 'film' => $film, 'article' => $article]); } } else { $xman = Xman::getOneById($model->xman_id); $film = Film::getOneById($model->film_id); $article = Article::getOneById($model->article_id); return $this->render('update', ['model' => $model, 'xman' => $xman, 'film' => $film, 'article' => $article]); } }
public function actionView($xman_id) { $xman = Xman::find()->where(['id' => $xman_id])->one(); $films = Xman::getFilms($xman_id); return $this->render('view', ['xman' => $xman, 'films' => $films]); }
public function actionView($id) { $this->view_data['xman'] = Xman::find()->where("id = {$id}")->asArray()->one(); $this->view_data['films'] = Xman::getFilms($id); return $this->render('view', $this->view_data); }