fix console.log
This commit is contained in:
parent
54f9313a8b
commit
ded7fb097f
|
@ -220,6 +220,7 @@ exports.SaveLogs = async function (req, res) {
|
||||||
image: plateSaved,
|
image: plateSaved,
|
||||||
time: currentTimestamp
|
time: currentTimestamp
|
||||||
});
|
});
|
||||||
|
consoleLogPlate(req.body.type, req.body.plate, currentPlate, currentTimestamp, "absolute");
|
||||||
}
|
}
|
||||||
if (req.body.type == "out" && isSavePlate(req.body.type, currentTimestamp, currentPlate)) {
|
if (req.body.type == "out" && isSavePlate(req.body.type, currentTimestamp, currentPlate)) {
|
||||||
var checkIn = await db.query("SELECT * FROM logs WHERE vehicle_id=" + query_plate_raw[0].id + " AND time_out=0 ORDER BY time_in DESC LIMIT 0,1");
|
var checkIn = await db.query("SELECT * FROM logs WHERE vehicle_id=" + query_plate_raw[0].id + " AND time_out=0 ORDER BY time_in DESC LIMIT 0,1");
|
||||||
|
@ -244,8 +245,8 @@ exports.SaveLogs = async function (req, res) {
|
||||||
logs: false
|
logs: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
consoleLogPlate(req.body.type, req.body.plate, currentPlate, currentTimestamp, "absolute");
|
||||||
}
|
}
|
||||||
consoleLogPlate(req.body.type, req.body.plate, currentPlate, currentTimestamp, "absolute");
|
|
||||||
} else {
|
} else {
|
||||||
var query_plate_levenshtein = await db.query("SELECT * FROM `vehicle` WHERE LENGTH(`plate`)=" + req.body.plate.length + " AND levenshtein('" + req.body.plate + "', `plate`) BETWEEN 0 AND 1 LIMIT 0,1");
|
var query_plate_levenshtein = await db.query("SELECT * FROM `vehicle` WHERE LENGTH(`plate`)=" + req.body.plate.length + " AND levenshtein('" + req.body.plate + "', `plate`) BETWEEN 0 AND 1 LIMIT 0,1");
|
||||||
if (query_plate_levenshtein.length > 0) {
|
if (query_plate_levenshtein.length > 0) {
|
||||||
|
@ -260,6 +261,7 @@ exports.SaveLogs = async function (req, res) {
|
||||||
image: plateSaved,
|
image: plateSaved,
|
||||||
time: currentTimestamp
|
time: currentTimestamp
|
||||||
});
|
});
|
||||||
|
consoleLogPlate(req.body.type, req.body.plate, currentPlate, currentTimestamp, "levenshtein");
|
||||||
}
|
}
|
||||||
if (req.body.type == "out" && isSavePlate(req.body.type, currentTimestamp, currentPlate)) {
|
if (req.body.type == "out" && isSavePlate(req.body.type, currentTimestamp, currentPlate)) {
|
||||||
var checkIn = await db.query("SELECT * FROM logs WHERE vehicle_id=" + query_plate_levenshtein[0].id + " AND time_out=0 ORDER BY time_in DESC LIMIT 0,1");
|
var checkIn = await db.query("SELECT * FROM logs WHERE vehicle_id=" + query_plate_levenshtein[0].id + " AND time_out=0 ORDER BY time_in DESC LIMIT 0,1");
|
||||||
|
@ -284,8 +286,9 @@ exports.SaveLogs = async function (req, res) {
|
||||||
logs: false
|
logs: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
consoleLogPlate(req.body.type, req.body.plate, currentPlate, currentTimestamp, "levenshtein");
|
||||||
}
|
}
|
||||||
consoleLogPlate(req.body.type, req.body.plate, currentPlate, currentTimestamp, "levenshtein");
|
|
||||||
} else {
|
} else {
|
||||||
currentPlate = req.body.plate;
|
currentPlate = req.body.plate;
|
||||||
if (req.body.type == "in" && isSavePlateOther(req.body.type, currentTimestamp, currentPlate)) {
|
if (req.body.type == "in" && isSavePlateOther(req.body.type, currentTimestamp, currentPlate)) {
|
||||||
|
@ -297,6 +300,7 @@ exports.SaveLogs = async function (req, res) {
|
||||||
falseIn = 0;
|
falseIn = 0;
|
||||||
vehicleInfo = {"status": true};
|
vehicleInfo = {"status": true};
|
||||||
await db.query("INSERT INTO logs_unknow(`plate`,`plate_image_in`,`frame_image_in`,`time_in`) VALUES ('" + req.body.plate + "','" + plateSaved + "','" + frameSaved + "'," + currentTimestamp + ")");
|
await db.query("INSERT INTO logs_unknow(`plate`,`plate_image_in`,`frame_image_in`,`time_in`) VALUES ('" + req.body.plate + "','" + plateSaved + "','" + frameSaved + "'," + currentTimestamp + ")");
|
||||||
|
consoleLogPlateOther(req.body.type, req.body.plate, currentPlate, currentTimestamp, "other");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (req.body.type == "out" && isSavePlateOther(req.body.type, currentTimestamp, currentPlate)) {
|
if (req.body.type == "out" && isSavePlateOther(req.body.type, currentTimestamp, currentPlate)) {
|
||||||
|
@ -318,9 +322,10 @@ exports.SaveLogs = async function (req, res) {
|
||||||
await db.query("INSERT INTO logs_unknow(`plate`,`plate_image_out`,`frame_image_out`,`time_out`) VALUES ('" + req.body.plate + "','" + plateSaved + "','" + frameSaved + "'," + currentTimestamp + ")");
|
await db.query("INSERT INTO logs_unknow(`plate`,`plate_image_out`,`frame_image_out`,`time_out`) VALUES ('" + req.body.plate + "','" + plateSaved + "','" + frameSaved + "'," + currentTimestamp + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
consoleLogPlateOther(req.body.type, req.body.plate, currentPlate, currentTimestamp, "other");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
consoleLogPlateOther(req.body.type, req.body.plate, currentPlate, currentTimestamp, "other");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
res.send(vehicleInfo);
|
res.send(vehicleInfo);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user