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')) : '' } },]