Add sincronizacion de jugadores en partida
This commit is contained in:
+35
-19
@@ -132,27 +132,43 @@ class Partida
|
||||
}
|
||||
|
||||
|
||||
public function iniciarPartida(){
|
||||
$conexion = conexionBD();
|
||||
if (is_array($conexion)){
|
||||
return $conexion;
|
||||
}
|
||||
try {
|
||||
$consulta = $conexion->prepare("UPDATE partida SET fechaInicio=NOW() WHERE idPartida=:idPartida AND fechaInicio IS NULL");
|
||||
$consulta->bindParam(":idPartida", $this->idPartida);
|
||||
$consulta->execute();
|
||||
return [
|
||||
"exito" => "La partida ha comenzado.",
|
||||
"exito_tecnico" => $this->idPartida
|
||||
];
|
||||
} catch (PDOException $error) {
|
||||
return [
|
||||
"error" => "Ocurrió un error al iniciar la partida.",
|
||||
'error_tecnico' => $error->getMessage()
|
||||
];
|
||||
}
|
||||
public function iniciarPartida()
|
||||
{
|
||||
$conexion = conexionBD();
|
||||
|
||||
if (is_array($conexion)) {
|
||||
return $conexion;
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
$consulta = $conexion->prepare("
|
||||
UPDATE partida
|
||||
SET fechaInicio = NOW()
|
||||
WHERE idPartida = :idPartida
|
||||
AND fechaInicio IS NULL
|
||||
");
|
||||
|
||||
$consulta->bindParam(
|
||||
":idPartida",
|
||||
$this->idPartida
|
||||
);
|
||||
|
||||
$consulta->execute();
|
||||
|
||||
return [
|
||||
"exito" => "La partida ha comenzado.",
|
||||
"exito_tecnico" => $this->idPartida
|
||||
];
|
||||
|
||||
} catch (PDOException $error) {
|
||||
|
||||
return [
|
||||
"error" => "ERROR REAL: " . $error->getMessage()
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function finalizar(){
|
||||
$conexion = conexionBD();
|
||||
|
||||
Reference in New Issue
Block a user