|
@@ -40,8 +40,8 @@ class GameController extends Controller
|
|
|
}else{
|
|
|
$questions = [];
|
|
|
}
|
|
|
- if(isset($questions[$cur_question])){
|
|
|
- $response['info'] = $questions[$cur_question];
|
|
|
+ if(isset($questions[$cur_question -1 ])){
|
|
|
+ $response['info'] = $questions[$cur_question - 1];
|
|
|
}else{
|
|
|
$questions_id = array_column($questions, 'question_id');
|
|
|
$question = Question::inRandomOrder()->select('question_id','title')->where("is_released",1)->whereNotIn("question_id", $questions_id)->first();
|
|
@@ -49,7 +49,7 @@ class GameController extends Controller
|
|
|
$info['question'] = $question;
|
|
|
$info['options'] = $options;
|
|
|
$info['questions_count'] = count($questions) + 1;
|
|
|
- array_push($questions, $info);
|
|
|
+ array_merge($questions, $info);
|
|
|
Redis::set($room_id . '_questions', json_encode($questions));
|
|
|
$response['info'] = $info;
|
|
|
}
|