fix bug
This commit is contained in:
parent
1715d3173b
commit
6aefd96212
|
@ -113,34 +113,8 @@ exports.SaveLogs = async function (req, res) {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (req.body.type == "in") {
|
||||
var lists = [];
|
||||
for (var i = 0; i < currentIn.length; i++) {
|
||||
lists.push(currentIn[i].plate);
|
||||
}
|
||||
console.log("req: ", req.body.plate, " ", req.body.type, " ", lists, " ", canSaveLogs);
|
||||
}
|
||||
if (req.body.type == "out") {
|
||||
var lists = [];
|
||||
for (var i = 0; i < currentOut.length; i++) {
|
||||
lists.push(currentOut[i].plate);
|
||||
}
|
||||
console.log("req: ", req.body.plate, " ", req.body.type, " ", lists, " ", canSaveLogs);
|
||||
}
|
||||
if (canSaveLogs) {
|
||||
if (req.body.type === "in") {
|
||||
if (currentIn.length >= maxCompare) {
|
||||
currentIn.shift();
|
||||
}
|
||||
currentIn.push({"plate": req.body.plate, "time": currentTimestamp});
|
||||
}
|
||||
if (req.body.type === "out") {
|
||||
if (currentOut.length >= maxCompare) {
|
||||
currentOut.shift();
|
||||
}
|
||||
currentOut.push({"plate": req.body.plate, "time": currentTimestamp});
|
||||
}
|
||||
|
||||
if (canSaveLogs) {
|
||||
var fileName = req.body.plate + "_" + currentTimestamp + ".png";
|
||||
var plateSaved = currentYear + "/" + currentMonth + "/" + currentDate + "/" + req.body.type + "/plate/" + fileName;
|
||||
var frameSaved = currentYear + "/" + currentMonth + "/" + currentDate + "/" + req.body.type + "/frame/" + fileName;
|
||||
|
@ -212,8 +186,34 @@ exports.SaveLogs = async function (req, res) {
|
|||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
vehicleInfo = {"status": true};
|
||||
if (req.body.type === "in") {
|
||||
var lists = [];
|
||||
for (var i = 0; i < currentIn.length; i++) {
|
||||
lists.push(currentIn[i].plate);
|
||||
}
|
||||
console.log("req: ", req.body.plate, " ", req.body.type, " ", lists, " ", vehicleInfo.status);
|
||||
if (vehicleInfo.status) {
|
||||
if (currentIn.length >= maxCompare) {
|
||||
currentIn.shift();
|
||||
}
|
||||
currentIn.push({"plate": req.body.plate, "time": currentTimestamp});
|
||||
}
|
||||
}
|
||||
if (req.body.type === "out") {
|
||||
var lists = [];
|
||||
for (var i = 0; i < currentOut.length; i++) {
|
||||
lists.push(currentOut[i].plate);
|
||||
}
|
||||
console.log("req: ", req.body.plate, " ", req.body.type, " ", lists, " ", vehicleInfo.status);
|
||||
if (vehicleInfo.status) {
|
||||
if (currentOut.length >= maxCompare) {
|
||||
currentOut.shift();
|
||||
}
|
||||
currentOut.push({"plate": req.body.plate, "time": currentTimestamp});
|
||||
}
|
||||
}
|
||||
res.send(vehicleInfo);
|
||||
} else {
|
||||
res.send({"status": true});
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user