Repuestas las modificaciones que se han sobrescrito

This commit is contained in:
imnavajas
2025-03-09 20:25:47 +01:00
parent 76208d9720
commit 9ada8d0ba0
2 changed files with 34 additions and 116 deletions

View File

@ -57,10 +57,10 @@ class ImprimelibrosApi extends ResourceController
'precios' => $response['precio_u']
]
];
}else{
} else {
$response = [
'status' => 400,
'error' => $response
'error' => $response
];
}
@ -79,19 +79,40 @@ class ImprimelibrosApi extends ResourceController
// Instancia de presupuesto cliente
$presupuestocliente = new Presupuestocliente();
$response = $presupuestocliente->guardar($post_data);
try {
$response = $presupuestocliente->guardar($post_data);
return $this->respond($response);
// DEBUG LINE
//return $this->respond($response);
$response = [
'status' => 200,
'error' => null,
'data' => [
'tiradas' => $response['tiradas'],
'precios' => $response['precio_u']
]
];
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'
]);
}
}