terminados servicios extra

This commit is contained in:
jaimejimenezortega
2025-03-04 19:01:30 +01:00
parent e5e53c026a
commit 2587a6b4ac
5 changed files with 171 additions and 83 deletions

View File

@ -57,10 +57,10 @@ class ImprimelibrosApi extends ResourceController
'precios' => $response['precio_u']
]
];
} else {
}else{
$response = [
'status' => 400,
'error' => $response
'error' => $response
];
}
@ -75,42 +75,23 @@ class ImprimelibrosApi extends ResourceController
// Access the entire POST data
$post_data = $this->request->getJSON(true);
//return $this->respond(var_dump($post_data));
// Instancia de presupuesto cliente
$presupuestocliente = new Presupuestocliente();
try {
$response = $presupuestocliente->guardar($post_data);
$response = $presupuestocliente->guardar($post_data);
// DEBUG LINE
//return $this->respond($response);
return $this->respond($response);
if (!isset($response['sk_id'])) {
return $this->respond([
'status' => 400,
'error' => 'Missing sk_id',
'message' => 'El identificador sk_id es requerido pero no se recibió.'
], 400);
}
$response = [
'status' => 200,
'error' => null,
'data' => [
'sk_id' => $response['sk_id'],
'sk_url' => $response['sk_url'] ?? null
]
];
return $this->respond($response);
} catch (\Exception $e) {
return $this->respond([
'status' => 500,
'error' => 'Server error',
'message' => 'Error inesperado durante el procesado'
]);
}
$response = [
'status' => 200,
'error' => null,
'data' => [
'tiradas' => $response['tiradas'],
'precios' => $response['precio_u']
]
];
return $this->respond($response);
}