diff --git a/controllers/ListenController.js b/controllers/ListenController.js index f5cc3ae..c97c82d 100644 --- a/controllers/ListenController.js +++ b/controllers/ListenController.js @@ -338,7 +338,11 @@ async function commitMessage(now, logDevice) { // check speed limit, if speed > vhc.speed_limit, send sms if (Array.isArray(vhc) && vhc.length > 0 && vhc[0].speed_limit > 0 && logDevice.speed > vhc[0].speed_limit) { - const users = await db.query(`SELECT phone FROM t_users WHERE status_sms = 1`, []) + // const users = await db.query(`SELECT phone FROM t_users WHERE status_sms = 1`, []) + const users = await db.query( + `SELECT phone FROM t_users WHERE status_sms = 1 AND FIND_IN_SET(?, vhc) > 0`, + [vhc[0].id] + ) if (!users?.length) return const nopol = (vhc[0].nopol1 ?? "") + (vhc[0].nopol2 ?? "") + (vhc[0].nopol3 ?? "")