From afe384b9a470838032ce6305747dba0bcf0409c3 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Tue, 14 Feb 2023 16:09:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AD=E6=96=AD=E9=82=AE=E4=BB=B6=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E6=A0=BC=E5=BC=8F=E6=8C=89XX=E5=A4=A9XX=E6=97=B6XX?= =?UTF-8?q?=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/schedule/alarms_push.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/api/app/lib/schedule/alarms_push.js b/api/app/lib/schedule/alarms_push.js index 6c4d851..c1a5e13 100644 --- a/api/app/lib/schedule/alarms_push.js +++ b/api/app/lib/schedule/alarms_push.js @@ -64,6 +64,17 @@ module.exports = function (app, opts) { ).toPromise() : [] + const calcMinute2DHM = (minute) => { + if (!minute && minute != 0) { + return minute + } + let dm = 24 * 60 + let d = Math.floor(minute / dm) + let h = Math.floor(minute % dm / 60) + let m = (minute % dm) % 60 + return `${d}天${h}时${m}分` + } + for (let { dataValues: c } of configListRes) { if (c.tacticsParams && c.tactics) { if (proDebug) { @@ -526,7 +537,7 @@ module.exports = function (app, opts) { k: '', f: (d) => { return d.StartTime ? - '超过' + moment().diff(moment(d.StartTime), 'minutes') + '分钟' : '' + '超过' + calcMinute2DHM(moment().diff(moment(d.StartTime), 'minutes')) : '' } },] @@ -572,7 +583,7 @@ module.exports = function (app, opts) { k: '', f: (d) => { return d.createTime ? - '超过' + moment().diff(moment(d.createTime), 'minutes') + '分钟' : '' + '超过' + calcMinute2DHM(moment().diff(moment(d.createTime), 'minutes')) : '' } },] @@ -612,7 +623,7 @@ module.exports = function (app, opts) { k: '', f: (d) => { return d.createTime ? - '超过' + moment().diff(moment(d.createTime), 'minutes') + '分钟' : '' + '超过' + calcMinute2DHM(moment().diff(moment(d.createTime), 'minutes')) : '' } },]