diff --git a/controllers/ListenController.js b/controllers/ListenController.js index 5f176f5..70f9b28 100644 --- a/controllers/ListenController.js +++ b/controllers/ListenController.js @@ -24,6 +24,7 @@ async function commitMessage(now, logDevice) { } const vhc = await VhcModels.getVhcByDeviceId(logDevice.device_id) + logDevice.vhc_id = vhc[0] ? vhc[0].vid : 0 // const lastTrack = await GpsTracksModels.get2LastLocByDeviceId(logDevice.device_id) let lastTrack if (vhc.length > 0) @@ -33,8 +34,8 @@ async function commitMessage(now, logDevice) { logDevice.device_id, ) - if (logDevice.device_id == "0353742374791143") - console.log("vhc", vhc, lastTrack) + // if (logDevice.device_id == "0353742372637637") + // console.log("vhc", vhc, lastTrack) if (["heartbeat", "alarm"].includes(logDevice.action)) { if (logDevice.ignition == GpsTracksModels.STTS_IGNITION_HIGH) { @@ -182,7 +183,7 @@ async function commitMessage(now, logDevice) { lastTrack[0].sum_milleage + logDevice.pre_milleage ).toFixed(8) if (vhc.length > 0) { - logDevice.vhc_id = vhc[0] ? vhc[0].vid : 0 + // logDevice.vhc_id = vhc[0] ? vhc[0].vid : 0 // if (lastTrack[0].vhc_id == logDevice.vhc_id) { // logDevice.vhc_milleage = (lastTrack[0].vhc_milleage + logDevice.pre_milleage).toFixed(8); // } else { @@ -295,8 +296,8 @@ async function commitMessage(now, logDevice) { } // LibMail.sendVhcSpawnZoneMail(`${(vhc[0]) ? vhc[0].nopol1 : 0 || ''}${(vhc[0]) ? vhc[0].nopol2 : 0 || ''}${(vhc[0]) ? vhc[0].nopol3 : 0 || ''} entering zone ${mailData.z_name}`, mailData.pic_mail, mailData); - if (logDevice.device_id === "0865784052395871") - console.log(1234567890) + // if (logDevice.device_id === "0865784052395871") + // console.log(1234567890) GpsTracksModels.create2SpawnZone({ device_id: logDevice.device_id, master_id: Number(currTrack.result.insertId), @@ -319,8 +320,8 @@ async function commitMessage(now, logDevice) { .unix(now) .format("YYYY-MM-DD HH:mm:ss"), }) - if (logDevice.device_id === "0865784052395871") - console.log("DISINI") + // if (logDevice.device_id === "0865784052395871") + // console.log("DISINI") } } } else {