Ver código fonte

Fixed count of meetings passed in lobby.
Fixed passing meeting without lobby on client.
Added ajax start lobby call on client.

Kain_Stropov 5 anos atrás
pai
commit
4fbbc5d57f

+ 3 - 1
app/Http/Controllers/ClientController.php

@@ -52,7 +52,9 @@ class ClientController extends Controller
         // }
         $session = AppSession::where("session_key",$sessionKey)->first();
         $meeting = null;
-        if ($session->meetingParticipant && $session->meetingParticipant->meeting->lobby_id === $lobby->id && $session->meetingParticipant->meeting->is_active) {
+        if ($session->meetingParticipant 
+                && $session->meetingParticipant->meeting->is_active
+                && ($session->meetingParticipant->meeting->lobby_id === $lobby->id || $session->meetingParticipant->meeting->lobby_id == null) ) {
             $meeting = new MeetingModel($session->meetingParticipant->meeting);
         }
         return view('client/index',compact('lobbyModel','meeting','sessionKey'));

+ 2 - 1
app/HttpModels/LobbyModel.php

@@ -2,6 +2,7 @@
 namespace App\HttpModels;
 
 use App\Models\Lobby;
+use Carbon\Carbon;
 
 class LobbyModel extends ClientLobbyModel {
     public $isStrangerAccessible;
@@ -17,7 +18,7 @@ class LobbyModel extends ClientLobbyModel {
         $this->isClientAccessible = $lobby->is_client_accessible;
         $this->isActive = $lobby->is_active;
         $this->lobbyProAccessLevel = $lobby->lobby_pro_access_level;
-        foreach ($lobby->meetings()->where('meeting.is_active',true)->get() as $meeting) {
+        foreach ($lobby->meetings()->where('meeting.is_active',true)->where('created_at','>=',Carbon::today())->get() as $meeting) {
             $this->meetings[] = new MeetingModel($meeting);
         }
     }

+ 19 - 4
resources/js/components/pages/ClientEntrance.vue

@@ -187,7 +187,7 @@ export default {
         };
     },
     sockets: {
-        reconnect: function(){
+        reconnect: function() {
             this.$socket.emit("userData", {
                 user: {
                     uid: this.clientUid,
@@ -199,7 +199,7 @@ export default {
                     lobby_uid: this.lobbyProp.uid
                 },
                 lobbies_uid_list: [`${this.lobbyProp.uid}`]
-            })
+            });
 
             if (this.meetingUid) {
                 this.$socket.emit("meetingJoined", {
@@ -211,7 +211,7 @@ export default {
                         type: "STRANGER",
                         uid: this.clientUid
                     }
-                })
+                });
             }
         }
     },
@@ -367,6 +367,21 @@ export default {
                         uid: this.clientUid
                     }
                 });
+                $.ajax({
+                    url: "/post-to-api-ajax",
+                    method: "POST",
+                    headers: {
+                        "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content")
+                    },
+                    data: {
+                        _api: "/api/meeting/startLobbyCall",
+                        uid: this.meetingUid,
+                        lobbyUid: this.lobbyProp.uid
+                    },
+                    success: data => {
+                        if (!data.success) console.log(data.message);
+                    }
+                });
             });
         },
         /* Copied */
@@ -693,7 +708,7 @@ export default {
                     lobby_uid: this.lobbyProp.uid
                 },
                 lobbies_uid_list: [`${this.lobbyProp.uid}`]
-            })
+            });
         }
     },
     mounted() {