/** * 分数型心里测试 问题 */ public function actionStep4_2_question($id) { $this->layout = false; $model = Survey::findOne($id); // 没有找到 if (!$model || $model->uid != ZCommonSessionFun::get_user_id()) { $model = new Survey(); if (!$model) { return $this->redirect(['my']); } } $page = Yii::$app->request->get('page', 1); $error = ''; $posts = Yii::$app->request->post(); // ZCommonFun::print_r_debug($_POST); // exit; // post提交 $model_SurveyResulte = new SurveyOperation(); $url = $model_SurveyResulte->step4_2_questionSave($posts, $id, $page); if ($url || isset($_POST['save']) && $questionData['count'] > -1) { // ZCommonFun::print_r_debug($url); // ZCommonFun::print_r_debug($posts); // ZCommonFun::print_r_debug($model); // exit; $model->is_publish = 0; $model->save(); switch ($model->tax) { // 分数型心里测试 case 2: if (isset($posts['save-next'])) { return $this->redirect($url); } else { return $this->redirect(['step4_3', 'id' => $model->id]); } break; // 跳转型心里测试 // 跳转型心里测试 case 3: if (isset($posts['save-next'])) { return $this->redirect($url); } else { return $this->redirect(['step4_2', 'id' => $model->id]); } break; default: break; } } // 查找问题 $questionData = $model->findOneQuestion($model->id, 1, $page - 1); if (count($questionData['question']) < 1) { if (!$model_SurveyResulte->save_question) { // $page = $page - 1; } } return $this->render('step4_2_question', ['tax' => $model->tax, 'model' => $model, 'page' => $page, 'questionData' => $questionData]); }