コード例 #1
0
ファイル: ruta.php プロジェクト: LluisAntoniFerrer/APIAllways
 public static function get($peticion)
 {
     $idRuta = $peticion['idRuta'];
     $idUsuRut = $peticion['idUsuRut'];
     $idCat = $peticion['idcat'];
     $principal = $peticion['principal'];
     $cabecera = $peticion['cabecera'];
     $idUsuario = usuario::autorizar();
     if (empty($idUsuario)) {
         throw new ExcepcionApi(self::ESTADO_URL_INCORRECTA, "Clave de api incorrecta");
     } else {
         if (!empty($idCat)) {
             return self::obtenerRutasCat($idCat);
         }
         if (!empty($idRuta)) {
             return self::recuperarRuta($idRuta);
         }
         if (!empty($idUsuRut)) {
             return self::obtenerMisRutas($idUsuRut);
         }
         if (!empty($principal)) {
             return self::recuperarPrincipal($idUsuario);
         }
         if (!empty($cabecera)) {
             return self::obtenerRutasDest($cabecera);
         }
     }
 }
コード例 #2
0
 public static function get()
 {
     $idUsuario = usuario::autorizar();
     if (empty($idUsuario)) {
         throw new ExcepcionApi(self::ESTADO_URL_INCORRECTA, "Clave de api incorrecta");
     } else {
         return self::obtenerTodosLosPuntos();
     }
 }
コード例 #3
0
 public static function delete()
 {
     $idUsuario = usuario::autorizar();
     $cabeceras = apache_request_headers();
     $idRuta = $cabeceras['idRuta'];
     self::eliminar($idUsuario, $idRuta);
     http_response_code(200);
     return ["estado" => self::ESTADO_EXITO, "mensaje" => "Ruta favorita eliminada correctamente"];
 }
コード例 #4
0
 public static function get($peticion)
 {
     $idSeg = $peticion['idSeg'];
     $idSig = $peticion['idSig'];
     $idUsuario = usuario::autorizar();
     if (empty($idUsuario)) {
         throw new ExcepcionApi(self::ESTADO_URL_INCORRECTA, "Clave de api incorrecta");
     } else {
         if (!empty($idSeg)) {
             return self::obtenerSeguidores($idSeg);
         }
         if (!empty($idSig)) {
             return self::obtenerSeguidos($idSig);
         }
     }
 }
コード例 #5
0
 private function actualizaNombre()
 {
     $idUsuario = usuario::autorizar();
     $cuerpo = file_get_contents('php://input');
     $datosUsuario = json_decode($cuerpo);
     $nombre = $datosUsuario->nombre;
     $pdo = ConexionBD::obtenerInstancia()->obtenerBD();
     $comando = "UPDATE " . self::NOMBRE_TABLA . " SET " . self::NOMBRE . " = ? WHERE " . self::ID_USUARIO . " = ?";
     $sentencia = $pdo->prepare($comando);
     $sentencia->bindParam(1, $nombre);
     $sentencia->bindParam(2, $idUsuario);
     $resultado = $sentencia->execute();
     return ["estado" => self::ESTADO_CREACION_EXITOSA, "mensaje" => "Has cambiado el nombre de usuario"];
 }