cron tracks month

This commit is contained in:
Pringgosutono
2025-10-08 13:12:00 +07:00
parent ba54730f2f
commit a619733a08
6 changed files with 351 additions and 4 deletions

View File

@ -1,5 +1,6 @@
const db = require(`../config/dbMysqlConn`)
const MysqlHelpers = require(`../library/LibMysqlHelper`)
const moment = require(`moment`)
class GpsTracksModels {
static DEFAULT_COUNTRY_ID = 1
@ -186,6 +187,21 @@ class GpsTracksModels {
)
}
if (logs.action == "location") {
const date = logs.crt_d
const mm = moment.unix(date).format("MM")
const yy = moment.unix(date).format("YY")
logs.id = resLogs.insertId
await MysqlHelpers.queryTrx(
conn,
`
INSERT INTO tracks_${yy}${mm}
SET ?
`,
[logs]
)
}
await MysqlHelpers.commit(conn)
resolve({
type: "success",