更新于 07-15 21:06

This commit is contained in:
root
2021-07-15 21:06:38 -04:00
parent 926ce43891
commit 15d76f5010

View File

@@ -1,22 +1,24 @@
/*
口袋书店
更新时间2021-06-26
加了一个码,修复需要手动打开的问题
活动入口京东app首页-京东图书-右侧口袋书店
已支持IOS双京东账号,Node.js支持N个京东账号
脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
============Quantumultx===============
[task_local]
#口袋书店
1 8,12,18 * * * https://gitee.com/lxk0301/jd_scripts/raw/master/jd_bookshop.js, tag=口袋书店, img-url=https://raw.githubusercontent.com/Orz-3/mini/master/Color/jd.png, enabled=true
1 8,12,18 * * * https://raw.githubusercontent.com/Wenmoux/scripts/wen/jd/chinnkarahoi_jd_bookshop.js, tag=口袋书店, img-url=https://raw.githubusercontent.com/Orz-3/mini/master/Color/jd.png, enabled=true
================Loon==============
[Script]
cron "1 8,12,18 * * *" script-path=https://gitee.com/lxk0301/jd_scripts/raw/master/jd_bookshop.js,tag=口袋书店
cron "1 8,12,18 * * *" script-path= https://raw.githubusercontent.com/Wenmoux/scripts/wen/jd/chinnkarahoi_jd_bookshop.js,tag=口袋书店
===============Surge=================
口袋书店 = type=cron,cronexp="1 8,12,18 * * *",wake-system=1,timeout=3600,script-path=https://gitee.com/lxk0301/jd_scripts/raw/master/jd_bookshop.js
口袋书店 = type=cron,cronexp="1 8,12,18 * * *",wake-system=1,timeout=3600,script-path= https://raw.githubusercontent.com/Wenmoux/scripts/wen/jd/chinnkarahoi_jd_bookshop.js
============小火箭=========
口袋书店 = type=cron,script-path=https://gitee.com/lxk0301/jd_scripts/raw/master/jd_bookshop.js, cronexpr="1 8,12,18* * *", timeout=3600, enable=true
口袋书店 = type=cron,script-path= https://raw.githubusercontent.com/Wenmoux/scripts/wen/jd/chinnkarahoi_jd_bookshop.js, cronexpr="1 8,12,18* * *", timeout=3600, enable=true
*/
const $ = new Env('口袋书店');
const notify = $.isNode() ? require('./sendNotify') : '';
@@ -30,6 +32,8 @@ ADD_CART = $.isNode() ? (process.env.PURCHASE_SHOPS ? process.env.PURCHASE_SHOPS
// 加入购物车开关,与东东小窝共享
let inviteCodes = [
//'4dd98623868f4292b5432822389fe3e9@daf75e50044144c68b2aff47de57fe49@e341962809ae42c5b8d2d61995bbb5a4@77f08ad1aea04b73acd4542f7fd1dac6@fe5536751f89403d87bad635a87bd956',
//'4dd98623868f4292b5432822389fe3e9@daf75e50044144c68b2aff47de57fe49@e341962809ae42c5b8d2d61995bbb5a4@77f08ad1aea04b73acd4542f7fd1dac6@fe5536751f89403d87bad635a87bd956'
]
if ($.isNode()) {
@@ -86,6 +90,7 @@ async function jdBeauty() {
await getActCk()
await getActInfo()
await getToken()
await accessLogWithAD()
await getUserInfo()
await getActContent(false, shareUuid)
if ($.exit) return
@@ -103,7 +108,7 @@ async function jdBeauty() {
}
if($.userInfo.storeGold) await chargeGold()
await helpFriends()
await showMsg();
// await showMsg();
}
async function helpFriends() {
@@ -262,7 +267,35 @@ function getUserInfo() {
})
})
}
// 获得用户信息
function accessLogWithAD() {
return new Promise(resolve => {
let body = `venderId=${ $.shopId}&code=99&pin=${encodeURIComponent($.token)}&activityId=${ACT_ID}&pageUrl=https%3A%2F%2Flzdz-isv.isvjcloud.com%2Fdingzhi%2Fbook%2Fdevelop%2Factivity%3FactivityId%3Ddz2010100034444201%26lng%3D107.146945%26lat%3D33.255267%26sid%3Dcad74d1c843bd47422ae20cadf6fe5aw%26un_area%3D27_2442_2444_31912&subType=app&adSource=`
$.post(taskPostUrl('common/accessLogWithAD', body), async (err, resp, data) => {
try {
if (err) {
console.log(`${$.name} API请求失败请检查网路重试`)
} else {
// if (safeGet(data)) {
if($.isNode())
for (let ck of resp['headers']['set-cookie']) {
cookie = `${cookie}; ${ck.split(";")[0]};`
}
else{
for (let ck of resp['headers']['Set-Cookie'].split(',')) {
cookie = `${cookie}; ${ck.split(";")[0]};`
}
}
// }
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve(data);
}
})
})
}
// 获得游戏信息
function getActContent(info = false, shareUuid = '') {
return new Promise(resolve => {
@@ -272,6 +305,7 @@ function getActContent(info = false, shareUuid = '') {
if (err) {
console.log(`${$.name} API请求失败请检查网路重试`)
} else {
// console.log(data)
if (data && safeGet(data)) {
data = JSON.parse(data);
if (data.data) {
@@ -666,12 +700,10 @@ function shareCodesFormat() {
const tempIndex = $.index > inviteCodes.length ? (inviteCodes.length - 1) : ($.index - 1);
$.newShareCodes = inviteCodes[tempIndex].split('@');
}
/*
const readShareCodeRes = null //await readShareCode();
if (readShareCodeRes && readShareCodeRes.code === 200) {
$.newShareCodes = [...new Set([...$.newShareCodes, ...(readShareCodeRes.data || [])])];
}
*/
// const readShareCodeRes = await readShareCode();
// if (readShareCodeRes && readShareCodeRes.code === 200) {
// $.newShareCodes = [...new Set([...$.newShareCodes, ...(readShareCodeRes.data || [])])];
// }
console.log(`${$.index}个京东账号将要助力的好友${JSON.stringify($.newShareCodes)}`)
resolve();
})