|
@@ -94,17 +94,24 @@ class GameController extends Controller
|
|
|
$response['msg'] = '请先登录';
|
|
|
return response()->json($response);
|
|
|
}
|
|
|
- $room_id = $request->input('room_id');
|
|
|
+
|
|
|
+ $message['is_end'] = 0; //是否结束答题标志
|
|
|
+ $question_id = $request->input('question_id');
|
|
|
+ $option_id = $request->input('option_id');
|
|
|
+ $user_id = $request->session()->get('user_id');
|
|
|
+
|
|
|
+ //检测用户断线
|
|
|
+ Gateway::$registerAddress = '127.0.0.1:1238';
|
|
|
+ //获取当前用户session
|
|
|
+ $gateway_user = Gateway::getSession($user_id);
|
|
|
+ $room_id = $gateway_user['room_id'];
|
|
|
+
|
|
|
if(!$room_id){
|
|
|
$response['code'] = 400;
|
|
|
$response['msg'] = '缺少房间参数';
|
|
|
return response()->json($response);
|
|
|
}
|
|
|
|
|
|
- $message['is_end'] = 0; //是否结束答题标志
|
|
|
- $question_id = $request->input('question_id');
|
|
|
- $option_id = $request->input('option_id');
|
|
|
- $user_id = $request->session()->get('user_id');
|
|
|
|
|
|
//获取当前房间问题条数
|
|
|
$questions = Redis::get($room_id . '_questions');
|
|
@@ -114,8 +121,6 @@ class GameController extends Controller
|
|
|
}else{
|
|
|
$questions_count = 0;
|
|
|
}
|
|
|
- //检测用户断线
|
|
|
- Gateway::$registerAddress = '127.0.0.1:1238';
|
|
|
//获取当前组存活用户
|
|
|
$clients = Gateway::getUidListByGroup($room_id);
|
|
|
if(count($clients) < 2){
|