/** * 练习模式下一题点击后操作 * @throws Exception */ public function actionNext() { $request = Yii::$app->request; if ($request->isAjax) { $session = Yii::$app->session; $testLibraryId = $request->post('testLibraryId'); $type = $request->post('type'); $testTypeId = $session->get('testTypeId'); $user = $session->get('user'); if ($testTypeId == -1 || $testTypeId == 1 || $testTypeId == 2 || $testTypeId == 3 || $testTypeId == 4) { //只有这五种练习方式记录当前练习到哪一题 CurrentTestLibrary::saveOrUpdate($user['userId'], $testTypeId, $testLibraryId); } if ($type == 0) { ErrorQuestion::saveOrUpdate($user['userId'], $testLibraryId); } } else { throw new Exception("非法提交"); } }