对于已过期活动的脚本,添加通知提醒

This commit is contained in:
lxk0301
2021-01-01 16:30:51 +08:00
parent 94c218201e
commit ea1ee097df
7 changed files with 46 additions and 24 deletions

View File

@@ -83,8 +83,14 @@ const JD_API_HOST = 'https://api.m.jd.com/api';
})
function showMsg() {
return new Promise(resolve => {
$.msg($.name, '', `【京东账号${$.index}${$.nickName}\n${message}`);
return new Promise(async resolve => {
let nowTime = new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000;
if (nowTime > new Date('2020/12/31 23:59:59+08:00').getTime()) {
$.msg($.name, '活动已结束', `咱江湖再见\nhttps://github.com/lxk0301/jd_scripts`, {"open-url": "https://github.com/lxk0301/jd_scripts"});
if ($.isNode()) await notify.sendNotify($.name + '活动已结束', `咱江湖再见\n https://github.com/lxk0301/jd_scripts`)
} else {
$.msg($.name, '', `京东账号${$.index} ${$.nickName}\n${message}`);
}
resolve()
})
}