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]); } }