update api to temp
This commit is contained in:
parent
2ea676adae
commit
4231791250
@ -1,7 +1,6 @@
|
||||
<?php
|
||||
// Connessione al database
|
||||
include('../../Connections/repnew.php');
|
||||
|
||||
$conn = new mysqli($servername, $username, $password, $database);
|
||||
|
||||
// Verifica la connessione
|
||||
@ -25,6 +24,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
// ID del laboratorio dal quale proviene il JSON (puoi aggiungere autenticazione)
|
||||
$lab_id = isset($_POST['lab_id']) ? $_POST['lab_id'] : 'Unknown Lab'; // Modifica a seconda della tua logica
|
||||
|
||||
// Estrai alcune informazioni dal JSON
|
||||
$product_refnumber = $decoded_data['product']['products_refnumber']; // Numero prodotto
|
||||
$report_number = $decoded_data['product']['reports'][0]['reportsNumberLab']; // Numero report
|
||||
$saved_at = date("Y-m-d H:i:s"); // Data del salvataggio
|
||||
|
||||
// Query per inserire i dati nella tabella temp_json_queue
|
||||
$stmt = $conn->prepare("INSERT INTO temp_json_queue (uuid, lab_id, json_data) VALUES (?, ?, ?)");
|
||||
$stmt->bind_param("sss", $uuid, $lab_id, $json_data);
|
||||
@ -33,7 +37,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
echo json_encode([
|
||||
"status" => "success",
|
||||
"message" => "Data successfully saved.",
|
||||
"uuid" => $uuid
|
||||
"uuid" => $uuid,
|
||||
"product_refnumber" => $product_refnumber, // Numero del prodotto
|
||||
"report_number" => $report_number, // Numero del report
|
||||
"saved_at" => $saved_at // Data del salvataggio
|
||||
]);
|
||||
} else {
|
||||
echo json_encode([
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user