点点券,添加推送开关,默认每天八点运行通知

This commit is contained in:
lxk0301
2021-03-14 16:22:43 +08:00
parent f17548f8d2
commit 4a3ca58f6c
2 changed files with 5 additions and 4 deletions

View File

@@ -32,6 +32,7 @@ const notify = $.isNode() ? require('./sendNotify') : '';
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
const openUrl = `openjd://virtual?params=%7B%20%22category%22:%20%22jump%22,%20%22des%22:%20%22m%22,%20%22url%22:%20%22https://h5.m.jd.com/babelDiy/Zeus/41Lkp7DumXYCFmPYtU3LTcnTTXTX/index.html%22%20%7D`
let message = '';
let nowTimes = new Date(new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000);
//IOS等用户直接用NobyDa的jd cookie
let cookiesArr = [], cookie = '';
if ($.isNode()) {
@@ -92,14 +93,13 @@ async function jd_necklace() {
}
function showMsg() {
return new Promise(async resolve => {
let nowTimes = new Date(new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000);
if (nowTimes.getHours() >= 20 && $.totalScore >= 10000) {
if (nowTimes.getHours() >= 20) {
$.msg($.name, '', `京东账号${$.index} ${$.nickName}\n当前${$.name}${$.totalScore}\n可兑换无门槛红包:${$.totalScore / 1000}\n点击弹窗即可去兑换(注:此红包具有时效性)`, { 'open-url': openUrl});
}
// 云端大于10元无门槛红包时进行通知推送
// if ($.isNode() && $.totalScore >= 20000 && nowTimes.getHours() >= 20) await notify.sendNotify(`${$.name} - 京东账号${$.index} - ${$.nickName}`, `京东账号${$.index} ${$.nickName}\n当前${$.name}${$.totalScore}个\n可兑换无门槛红包${$.totalScore / 1000}元\n点击链接即可去兑换(注:此红包具有时效性)\n↓↓↓ \n\n ${openUrl} \n\n ↑↑↑`, { url: openUrl })
if ($.isNode() && $.totalScore >= 20000 && nowTimes.getHours() >= 20) {
allMessage += `京东账号${$.index} ${$.nickName}\n当前${$.name}${$.totalScore}\n可兑换无门槛红包:${$.totalScore / 1000}\n点击链接即可去兑换(注:此红包具有时效性)${$.index !== cookiesArr.length ? '\n\n' : '\n↓↓↓ \n\n ${openUrl} \n\n ↑↑↑'}`
if ($.isNode() && nowTimes.getHours() >= 20 && process.env.DDQ_NOTIFY_CONTROL ? process.env.DDQ_NOTIFY_CONTROL === 'false' : !!1) {
allMessage += `京东账号${$.index} ${$.nickName}\n当前${$.name}${$.totalScore}\n可兑换无门槛红包:${$.totalScore / 1000}\n(京东APP->领券->左上角点点券.注:此红包具有时效性)${$.index !== cookiesArr.length ? '\n\n' : '\n↓↓↓ \n\n ${openUrl} \n\n ↑↑↑'}`
}
resolve()
})