This commit is contained in:
wisz2021
2021-05-11 14:45:59 +08:00
parent af61bde228
commit fa18faaa57

View File

@ -38,8 +38,7 @@ if ($.isNode()) {
Object.keys(jdCookieNode).forEach((item) => {
cookiesArr.push(jdCookieNode[item])
})
if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {
};
if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
if (JSON.stringify(process.env).indexOf('GITHUB') > -1) process.exit(0)
} else {
cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
@ -55,7 +54,7 @@ const JD_API_HOST = 'https://api.m.jd.com/api';
let nowTs = new Date().getTime()
if (!($.st <= nowTs && nowTs < $.ed)) {
$.log(`\n远程红包雨配置获取错误,从本地读取配置`)
$.log(`\n远程红包雨配置获取错误,尝试从本地读取配置`)
let hour = (new Date().getUTCHours() + 8) % 24
if (ids[hour]) {
$.activityId = ids[hour]
@ -128,8 +127,7 @@ function getRedRain() {
if (safeGet(data)) {
data = JSON.parse(data);
if (data.data && data.data.iconArea) {
console.log(data.data.iconArea.filter(vo=>vo['type']==='anchor_darw_lottery').length &&
data.data.iconArea.filter(vo=>vo['type']==='anchor_darw_lottery')[0].data.lotteryId)
// console.log(data.data.iconArea.filter(vo => vo['type'] === 'anchor_darw_lottery').length && data.data.iconArea.filter(vo => vo['type'] === 'anchor_darw_lottery')[0].data.lotteryId)
let act = data.data.iconArea.filter(vo => vo['type'] === "platform_red_packege_rain")[0]
if (act) {
let url = act.data.activityUrl
@ -141,10 +139,10 @@ function getRedRain() {
console.log(`下一场红包雨开始时间:${new Date($.st)}`)
console.log(`下一场红包雨结束时间:${new Date($.ed)}`)
} else {
console.log(`暂无红包雨`)
console.log(`\n暂无超级直播间红包雨`)
}
} else {
console.log(`暂无红包雨`)
console.log(`\n暂无超级直播间红包雨`)
}
}
}
@ -189,6 +187,7 @@ function receiveRedRain() {
})
})
}
function taskGetUrl(url, body) {
return {
url: url,