update max false
This commit is contained in:
parent
7a402301c8
commit
1715d3173b
|
@ -62,6 +62,9 @@ const db = makeDb(config);
|
|||
var currentIn = [];
|
||||
var currentOut = [];
|
||||
var maxCompare = 5;
|
||||
var maxFalse = 3;
|
||||
var falseIn = 0;
|
||||
var falseOut = 0;
|
||||
|
||||
exports.SaveLogs = async function (req, res) {
|
||||
|
||||
|
@ -175,11 +178,25 @@ exports.SaveLogs = async function (req, res) {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
vehicleInfo = {"status": true};
|
||||
if (req.body.type == "in") {
|
||||
if (falseIn < maxFalse) {
|
||||
vehicleInfo = {"status": false};
|
||||
falseIn++;
|
||||
console.log("status: results in not found");
|
||||
} else {
|
||||
falseIn = 0;
|
||||
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 + ")");
|
||||
}
|
||||
}
|
||||
if (req.body.type == "out") {
|
||||
if (falseOut < maxFalse) {
|
||||
vehicleInfo = {"status": false};
|
||||
falseOut++;
|
||||
console.log("status: results out not found");
|
||||
} else {
|
||||
falseIn = 0;
|
||||
vehicleInfo = {"status": true};
|
||||
var checkIn_raw = await db.query("SELECT * FROM logs_unknow WHERE plate='" + req.body.plate + "' AND time_out=0 ORDER BY time_in DESC LIMIT 0,1");
|
||||
if (checkIn_raw.length > 0) {
|
||||
await db.query("UPDATE logs_unknow SET `plate_image_out`='" + plateSaved + "',`frame_image_out`='" + frameSaved + "',`time_out`=" + currentTimestamp + " WHERE id=" + checkIn_raw[0].id);
|
||||
|
@ -195,5 +212,8 @@ exports.SaveLogs = async function (req, res) {
|
|||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
vehicleInfo = {"status": true};
|
||||
}
|
||||
res.send(vehicleInfo);
|
||||
};
|
Loading…
Reference in New Issue
Block a user