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 fileName = req.body.plate + "_" + currentTimestamp + ".png";
|
||||||
var plateSaved = currentYear + "/" + currentMonth + "/" + currentDate + "/" + req.body.type + "/plate/" + fileName;
|
var plateSaved = currentYear + "/" + currentMonth + "/" + currentDate + "/" + req.body.type + "/plate/" + fileName;
|
||||||
var frameSaved = currentYear + "/" + currentMonth + "/" + currentDate + "/" + req.body.type + "/frame/" + fileName;
|
var frameSaved = currentYear + "/" + currentMonth + "/" + currentDate + "/" + req.body.type + "/frame/" + fileName;
|
||||||
|
@ -212,8 +186,34 @@ 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, " ", 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 {
|
} else {
|
||||||
vehicleInfo = {"status": true};
|
res.send({"status": true});
|
||||||
}
|
}
|
||||||
res.send(vehicleInfo);
|
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user