疯狂的joy添加互助码填写的环境变量 JDJOY_SHARECODES
This commit is contained in:
@@ -44,6 +44,7 @@
|
|||||||
| `DDFACTORY_SHARECODES` | 东东工厂互助码 | 非必须 | 填写规则请看 [jdFactoryShareCodes.js](https://github.com/lxk0301/jd_scripts/blob/master/jdFactoryShareCodes.js) 或见下方[互助码的填写规则](#互助码的填写规则) |
|
| `DDFACTORY_SHARECODES` | 东东工厂互助码 | 非必须 | 填写规则请看 [jdFactoryShareCodes.js](https://github.com/lxk0301/jd_scripts/blob/master/jdFactoryShareCodes.js) 或见下方[互助码的填写规则](#互助码的填写规则) |
|
||||||
| `DREAM_FACTORY_SHARE_CODES`| 京喜工厂互助码 | 非必须 | 填写规则请看 [jdDreamFactoryShareCodes.js](https://github.com/lxk0301/jd_scripts/blob/master/jdDreamFactoryShareCodes.js) 或见下方[互助码的填写规则](#互助码的填写规则) |
|
| `DREAM_FACTORY_SHARE_CODES`| 京喜工厂互助码 | 非必须 | 填写规则请看 [jdDreamFactoryShareCodes.js](https://github.com/lxk0301/jd_scripts/blob/master/jdDreamFactoryShareCodes.js) 或见下方[互助码的填写规则](#互助码的填写规则) |
|
||||||
| `JDZZ_SHARECODES` | 京东赚赚(jd_jdzz.js)脚本互助码 | 非必须 | 填写规则和上面类似,或见下方[互助码的填写规则](#互助码的填写规则) |
|
| `JDZZ_SHARECODES` | 京东赚赚(jd_jdzz.js)脚本互助码 | 非必须 | 填写规则和上面类似,或见下方[互助码的填写规则](#互助码的填写规则) |
|
||||||
|
| `JDJOY_SHARECODES` | 疯狂的joy(jd_crazy_joy.js)脚本互助码 | 非必须 | 填写规则和上面类似,或见下方[互助码的填写规则](#互助码的填写规则) |
|
||||||
|
|
||||||
##### 控制脚本功能环境变量
|
##### 控制脚本功能环境变量
|
||||||
|
|
||||||
|
@@ -29,13 +29,14 @@ const JD_API_HOST = 'https://api.m.jd.com/';
|
|||||||
|
|
||||||
const notify = $.isNode() ? require('./sendNotify') : '';
|
const notify = $.isNode() ? require('./sendNotify') : '';
|
||||||
let jdNotify = true;//是否关闭通知,false打开通知推送,true关闭通知推送
|
let jdNotify = true;//是否关闭通知,false打开通知推送,true关闭通知推送
|
||||||
let helpSelf = false // 循环助力
|
let helpSelf = false // 循环助力,默认关闭
|
||||||
let applyJdBean = 0
|
let applyJdBean = 0
|
||||||
let cookiesArr = [], cookie = '', message = '';
|
let cookiesArr = [], cookie = '', message = '';
|
||||||
const inviteCodes = [
|
const inviteCodes = [
|
||||||
'EdLPh8A6X5G1iWXu-uPYfA==@0gUO7F7N-4HVDh9mdQC2hg==@fUJTgR9z26fXdQgTvt_bgqt9zd5YaBeE',
|
'EdLPh8A6X5G1iWXu-uPYfA==@0gUO7F7N-4HVDh9mdQC2hg==@fUJTgR9z26fXdQgTvt_bgqt9zd5YaBeE@nCQQXQHKGjPCb7jkd8q2U-aCTjZMxL3s@2boGLV7TonMex8-nrT6EGat9zd5YaBeE',
|
||||||
'EdLPh8A6X5G1iWXu-uPYfA==@0gUO7F7N-4HVDh9mdQC2hg==@fUJTgR9z26fXdQgTvt_bgqt9zd5YaBeE'
|
'EdLPh8A6X5G1iWXu-uPYfA==@0gUO7F7N-4HVDh9mdQC2hg==@fUJTgR9z26fXdQgTvt_bgqt9zd5YaBeE@nCQQXQHKGjPCb7jkd8q2U-aCTjZMxL3s@2boGLV7TonMex8-nrT6EGat9zd5YaBeE'
|
||||||
];
|
];
|
||||||
|
const randomCount = 5;
|
||||||
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
|
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
|
||||||
if ($.isNode()) {
|
if ($.isNode()) {
|
||||||
Object.keys(jdCookieNode).forEach((item) => {
|
Object.keys(jdCookieNode).forEach((item) => {
|
||||||
@@ -575,7 +576,30 @@ function taskUrl(functionId, body = '') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function readShareCode() {
|
||||||
|
console.log(`开始`)
|
||||||
|
return new Promise(async resolve => {
|
||||||
|
$.get({url: `https://code.chiang.fun/api/v1/jd/jdcrazyjoy/read/${randomCount}/`}, (err, resp, data) => {
|
||||||
|
try {
|
||||||
|
if (err) {
|
||||||
|
console.log(`${JSON.stringify(err)}`)
|
||||||
|
console.log(`${$.name} API请求失败,请检查网路重试`)
|
||||||
|
} else {
|
||||||
|
if (data) {
|
||||||
|
console.log(`随机取${randomCount}个码放到您固定的互助码后面`)
|
||||||
|
data = JSON.parse(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
$.logErr(e, resp)
|
||||||
|
} finally {
|
||||||
|
resolve(data);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
await $.wait(10000);
|
||||||
|
resolve()
|
||||||
|
})
|
||||||
|
}
|
||||||
//格式化助力码
|
//格式化助力码
|
||||||
function shareCodesFormat() {
|
function shareCodesFormat() {
|
||||||
return new Promise(async resolve => {
|
return new Promise(async resolve => {
|
||||||
@@ -588,7 +612,7 @@ function shareCodesFormat() {
|
|||||||
const tempIndex = $.index > inviteCodes.length ? (inviteCodes.length - 1) : ($.index - 1);
|
const tempIndex = $.index > inviteCodes.length ? (inviteCodes.length - 1) : ($.index - 1);
|
||||||
$.newShareCodes = inviteCodes[tempIndex].split('@');
|
$.newShareCodes = inviteCodes[tempIndex].split('@');
|
||||||
}
|
}
|
||||||
const readShareCodeRes = null //await readShareCode();
|
const readShareCodeRes = await readShareCode();
|
||||||
if (readShareCodeRes && readShareCodeRes.code === 200) {
|
if (readShareCodeRes && readShareCodeRes.code === 200) {
|
||||||
$.newShareCodes = [...new Set([...$.newShareCodes, ...(readShareCodeRes.data || [])])];
|
$.newShareCodes = [...new Set([...$.newShareCodes, ...(readShareCodeRes.data || [])])];
|
||||||
}
|
}
|
||||||
@@ -605,16 +629,9 @@ function requireConfig() {
|
|||||||
if ($.isNode()) {
|
if ($.isNode()) {
|
||||||
if (process.env.JDJOY_SHARECODES) {
|
if (process.env.JDJOY_SHARECODES) {
|
||||||
if (process.env.JDJOY_SHARECODES.indexOf('\n') > -1) {
|
if (process.env.JDJOY_SHARECODES.indexOf('\n') > -1) {
|
||||||
console.log(`您的互助码选择的是用\n隔开\n`)
|
|
||||||
shareCodes = process.env.JDJOY_SHARECODES.split('\n');
|
shareCodes = process.env.JDJOY_SHARECODES.split('\n');
|
||||||
} else if (process.env.JDJOY_SHARECODES.indexOf('&') > -1) {
|
|
||||||
console.log(`您的互助码选择的是用&隔开\n`)
|
|
||||||
shareCodes = process.env.JDJOY_SHARECODES.split('&');
|
|
||||||
} else if (process.env.JDJOY_SHARECODES.indexOf('@') > -1) {
|
|
||||||
console.log(`您的互助码选择的是用@隔开\n`)
|
|
||||||
shareCodes = process.env.JDJOY_SHARECODES.split('@');
|
|
||||||
} else {
|
} else {
|
||||||
shareCodes = process.env.JDJOY_SHARECODES.split();
|
shareCodes = process.env.JDJOY_SHARECODES.split('&');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (process.env.JDJOY_HELPSELF) {
|
if (process.env.JDJOY_HELPSELF) {
|
||||||
|
@@ -701,21 +701,21 @@ function request(function_id, body = {}){
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
function taskUrl(function_id, body) {
|
function taskUrl(function_id, body) {
|
||||||
body["version"] = "9.0.0.1";
|
body["version"] = "9.2.4.0";
|
||||||
body["monitor_source"] = "plant_app_plant_index";
|
body["monitor_source"] = "plant_app_plant_index";
|
||||||
body["monitor_refer"] = "";
|
body["monitor_refer"] = "";
|
||||||
return {
|
return {
|
||||||
url: JD_API_HOST,
|
url: JD_API_HOST,
|
||||||
body: `functionId=${function_id}&body=${escape(JSON.stringify(body))}&appid=ld&client=apple&area=5_274_49707_49973&build=167283&clientVersion=9.1.0`,
|
body: `functionId=${function_id}&body=${escape(JSON.stringify(body))}&appid=ld&client=apple&area=19_1601_50258_51885&build=167490&clientVersion=9.3.2`,
|
||||||
headers: {
|
headers: {
|
||||||
'Cookie': cookie,
|
"Cookie": cookie,
|
||||||
'Host': 'api.m.jd.com',
|
"Host": "api.m.jd.com",
|
||||||
'Accept': '*/*',
|
"Accept": "*/*",
|
||||||
'Connection': 'keep-alive',
|
"Connection": "keep-alive",
|
||||||
'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0"),
|
"User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0"),
|
||||||
'Accept-Language': 'zh-Hans-CN;q=1,en-CN;q=0.9',
|
"Accept-Language": "zh-Hans-CN;q=1,en-CN;q=0.9",
|
||||||
'Accept-Encoding': 'gzip, deflate, br',
|
"Accept-Encoding": "gzip, deflate, br",
|
||||||
'Content-Type': "application/x-www-form-urlencoded"
|
"Content-Type": "application/x-www-form-urlencoded"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user