mirror of
https://github.com/shufflewzc/faker3.git
synced 2026-04-03 16:34:07 +08:00
1
This commit is contained in:
338
jd_cash.js
338
jd_cash.js
@@ -3,24 +3,25 @@
|
||||
可互助,助力码每日不变,只变日期
|
||||
活动入口:京东APP搜索领现金进入
|
||||
更新时间:2021-06-07
|
||||
PandaToken 请前往 https://t.me/pang_da_bot 获取Token
|
||||
已支持IOS双京东账号,Node.js支持N个京东账号
|
||||
脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
|
||||
============Quantumultx===============
|
||||
[task_local]
|
||||
#签到领现金
|
||||
2 0-23/4 * * * jd_cash.js, tag=签到领现金, img-url=https://raw.githubusercontent.com/Orz-3/mini/master/Color/jd.png, enabled=true
|
||||
11 1,20 * * * jd_cash.js, tag=签到领现金, img-url=https://raw.githubusercontent.com/Orz-3/mini/master/Color/jd.png, enabled=true
|
||||
|
||||
================Loon==============
|
||||
[Script]
|
||||
cron "2 0-23/4 * * *" script-path=jd_cash.js,tag=签到领现金
|
||||
cron "11 1,20 * * *" script-path=jd_cash.js,tag=签到领现金
|
||||
|
||||
===============Surge=================
|
||||
签到领现金 = type=cron,cronexp="2 0-23/4 * * *",wake-system=1,timeout=3600,script-path=jd_cash.js
|
||||
签到领现金 = type=cron,cronexp="11 1,20 * * *",wake-system=1,timeout=3600,script-path=jd_cash.js
|
||||
|
||||
============小火箭=========
|
||||
签到领现金 = type=cron,script-path=jd_cash.js, cronexpr="2 0-23/4 * * *", timeout=3600, enable=true
|
||||
签到领现金 = type=cron,script-path=jd_cash.js, cronexpr="11 1,20 * * *", timeout=3600, enable=true
|
||||
*/
|
||||
const $ = new Env('签到领现金');
|
||||
const $ = new Env('签到领现金_Panda');
|
||||
const notify = $.isNode() ? require('./sendNotify') : '';
|
||||
//Node.js用户请在jdCookie.js处填写京东ck;
|
||||
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
|
||||
@@ -30,10 +31,7 @@ let cookiesArr = [], cookie = '', message;
|
||||
let helpAuthor = true;
|
||||
const randomCount = $.isNode() ? 5 : 5;
|
||||
let cash_exchange = false;//是否消耗2元红包兑换200京豆,默认否
|
||||
const inviteCodes = [
|
||||
`eU9Yau3kZ_4g-DiByHEQ0A@ZnQya-i1Y_UmpGzUnnEX@fkFwauq3ZA@f0JyJuW7bvQ@IhM0bu-0b_kv8W6E@eU9YKpnxOLhYtQSygTJQ@-oaWtXEHOrT_bNMMVso@eU9YG7XaD4lXsR2krgpG@KxMzZOW7YvQ@eU9Ya7jnZP5w822BmntC0g@eU9YPa34F5lnpBWRjyp3@eU9YarnmYfRwpTzUziAV1Q`,
|
||||
`eU9Yau3kZ_4g-DiByHEQ0A@ZnQya-i1Y_UmpGzUnnEX@fkFwauq3ZA@f0JyJuW7bvQ@IhM0bu-0b_kv8W6E@eU9YKpnxOLhYtQSygTJQ@-oaWtXEHOrT_bNMMVso@eU9YG7XaD4lXsR2krgpG@KxMzZOW7YvQ@eU9Ya7jnZP5w822BmntC0g@eU9YPa34F5lnpBWRjyp3@eU9YarnmYfRwpTzUziAV1Q`,
|
||||
]
|
||||
const inviteCodes = []
|
||||
if ($.isNode()) {
|
||||
Object.keys(jdCookieNode).forEach((item) => {
|
||||
cookiesArr.push(jdCookieNode[item])
|
||||
@@ -44,18 +42,20 @@ if ($.isNode()) {
|
||||
}
|
||||
const JD_API_HOST = 'https://api.m.jd.com/client.action';
|
||||
let allMessage = '';
|
||||
let jdPandaToken = '';
|
||||
jdPandaToken = $.isNode() ? (process.env.PandaToken ? process.env.PandaToken : `${jdPandaToken}`) : ($.getdata('PandaToken') ? $.getdata('PandaToken') : `${jdPandaToken}`);
|
||||
if (!jdPandaToken) {
|
||||
console.log('请填写Panda获取的Token,变量是PandaToken');
|
||||
return;
|
||||
}
|
||||
|
||||
!(async () => {
|
||||
if (!cookiesArr[0]) {
|
||||
$.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
|
||||
return;
|
||||
}
|
||||
await requireConfig()
|
||||
$.authorCode = await getAuthorShareCode('https://raw.githubusercontent.com/Aaron-lv/updateTeam/master/shareCodes/jd_updateCash.json')
|
||||
if (!$.authorCode) {
|
||||
$.http.get({url: 'https://purge.jsdelivr.net/gh/Aaron-lv/updateTeam@master/shareCodes/jd_updateCash.json'}).then((resp) => {}).catch((e) => $.log('刷新CDN异常', e));
|
||||
await $.wait(1000)
|
||||
$.authorCode = await getAuthorShareCode('https://cdn.jsdelivr.net/gh/Aaron-lv/updateTeam@master/shareCodes/jd_updateCash.json') || []
|
||||
}
|
||||
// await requireConfig()
|
||||
|
||||
for (let i = 0; i < cookiesArr.length; i++) {
|
||||
if (cookiesArr[i]) {
|
||||
cookie = cookiesArr[i];
|
||||
@@ -94,48 +94,21 @@ async function jdCash() {
|
||||
await appindex()
|
||||
await index()
|
||||
|
||||
await shareCodesFormat()
|
||||
// await helpFriends()
|
||||
// await getReward()
|
||||
// await getReward('2');
|
||||
$.exchangeBeanNum = 0;
|
||||
cash_exchange = $.isNode() ? (process.env.CASH_EXCHANGE ? process.env.CASH_EXCHANGE : `${cash_exchange}`) : ($.getdata('cash_exchange') ? $.getdata('cash_exchange') : `${cash_exchange}`);
|
||||
// if (cash_exchange === 'true') {
|
||||
// if(Number($.signMoney) >= 2){
|
||||
// console.log(`\n\n开始花费2元红包兑换200京豆,一周可换五次`)
|
||||
// for (let item of ["-1", "0", "1", "2", "3"]) {
|
||||
// $.canLoop = true;
|
||||
// if ($.canLoop) {
|
||||
// for (let i = 0; i < 5; i++) {
|
||||
// await exchange2(item);//兑换200京豆(2元红包换200京豆,一周5次。)
|
||||
// }
|
||||
// if (!$.canLoop) {
|
||||
// console.log(`已找到符合的兑换条件,跳出\n`);
|
||||
// break
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if ($.exchangeBeanNum) {
|
||||
// message += `兑换京豆成功,获得${$.exchangeBeanNum * 100}京豆\n`;
|
||||
// }
|
||||
// }else{
|
||||
// console.log(`\n\n现金不够2元,不进行兑换200京豆,`)
|
||||
// }
|
||||
// }
|
||||
|
||||
await appindex(true)
|
||||
// await showMsg()
|
||||
}
|
||||
|
||||
async function appindex(info=false) {
|
||||
let functionId = "cash_homePage"
|
||||
let body = {}
|
||||
let sign = await getSign(functionId, body)
|
||||
let sign = `body=%7B%7D&build=167968&client=apple&clientVersion=10.4.0&d_brand=apple&d_model=iPhone13%2C3&ef=1&eid=eidI25488122a6s9Uqq6qodtQx6rgQhFlHkaE1KqvCRbzRnPZgP/93P%2BzfeY8nyrCw1FMzlQ1pE4X9JdmFEYKWdd1VxutadX0iJ6xedL%2BVBrSHCeDGV1&ep=%7B%22ciphertype%22%3A5%2C%22cipher%22%3A%7B%22screen%22%3A%22CJO3CMeyDJCy%22%2C%22osVersion%22%3A%22CJUkDK%3D%3D%22%2C%22openudid%22%3A%22CJSmCWU0DNYnYtS0DtGmCJY0YJcmDwCmYJC0DNHwZNc5ZQU2DJc3Zq%3D%3D%22%2C%22area%22%3A%22CJZpCJCmC180ENcnCv80ENc1EK%3D%3D%22%2C%22uuid%22%3A%22aQf1ZRdxb2r4ovZ1EJZhcxYlVNZSZz09%22%7D%2C%22ts%22%3A1648428189%2C%22hdid%22%3A%22JM9F1ywUPwflvMIpYPok0tt5k9kW4ArJEU3lfLhxBqw%3D%22%2C%22version%22%3A%221.0.3%22%2C%22appname%22%3A%22com.360buy.jdmobile%22%2C%22ridx%22%3A-1%7D&ext=%7B%22prstate%22%3A%220%22%2C%22pvcStu%22%3A%221%22%7D&isBackground=N&joycious=104&lang=zh_CN&networkType=3g&networklibtype=JDNetworkBaseAF&partner=apple&rfs=0000&scope=11&sign=98c0ea91318ef1313786d86d832f1d4d&st=1648428208392&sv=101&uemps=0-0&uts=0f31TVRjBSv7E8yLFU2g86XnPdLdKKyuazYDek9RnAdkKCbH50GbhlCSab3I2jwM04d75h5qDPiLMTl0I3dvlb3OFGnqX9NrfHUwDOpTEaxACTwWl6n//EOFSpqtKDhg%2BvlR1wAh0RSZ3J87iAf36Ce6nonmQvQAva7GoJM9Nbtdah0dgzXboUL2m5YqrJ1hWoxhCecLcrUWWbHTyAY3Rw%3D%3D`
|
||||
return new Promise((resolve) => {
|
||||
$.post(apptaskUrl(functionId, sign), async (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
console.log(`${JSON.stringify(err)}`)
|
||||
console.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
console.log(`appindex API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
data = JSON.parse(data);
|
||||
@@ -150,7 +123,7 @@ async function appindex(info=false) {
|
||||
}
|
||||
$.signMoney = data.data.result.totalMoney;
|
||||
// console.log(`您的助力码为${data.data.result.invitedCode}`)
|
||||
console.log(`\n【京东账号${$.index}(${$.UserName})的${$.name}好友互助码】${data.data.result.invitedCode}\n`);
|
||||
console.log(`\n【京东账号${$.index}(${$.UserName})的好友互助码】${data.data.result.invitedCode}\n`);
|
||||
let helpInfo = {
|
||||
'inviteCode': data.data.result.invitedCode,
|
||||
'shareDate': data.data.result.shareDate
|
||||
@@ -202,7 +175,7 @@ function index() {
|
||||
try {
|
||||
if (err) {
|
||||
console.log(`${JSON.stringify(err)}`)
|
||||
console.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
console.log(`index API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
data = JSON.parse(data);
|
||||
@@ -245,63 +218,18 @@ function index() {
|
||||
})
|
||||
})
|
||||
}
|
||||
async function helpFriends() {
|
||||
$.canHelp = true
|
||||
for (let code of $.newShareCodes) {
|
||||
console.log(`去帮助好友${code['inviteCode']}`)
|
||||
await helpFriend(code)
|
||||
if(!$.canHelp) break
|
||||
await $.wait(1000)
|
||||
}
|
||||
// if (helpAuthor && $.authorCode) {
|
||||
// for(let helpInfo of $.authorCode){
|
||||
// console.log(`去帮助好友${helpInfo['inviteCode']}`)
|
||||
// await helpFriend(helpInfo)
|
||||
// if(!$.canHelp) break
|
||||
// await $.wait(1000)
|
||||
// }
|
||||
// }
|
||||
}
|
||||
function helpFriend(helpInfo) {
|
||||
return new Promise((resolve) => {
|
||||
$.get(taskUrl("cash_mob_assist", {...helpInfo,"source":1}), (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
console.log(`${JSON.stringify(err)}`)
|
||||
console.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
data = JSON.parse(data);
|
||||
if( data.code === 0 && data.data.bizCode === 0){
|
||||
console.log(`助力成功,获得${data.data.result.cashStr}`)
|
||||
// console.log(data.data.result.taskInfos)
|
||||
} else if (data.data.bizCode===207){
|
||||
console.log(data.data.bizMsg)
|
||||
$.canHelp = false
|
||||
} else{
|
||||
console.log(data.data.bizMsg)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve(data);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
async function appdoTask(type,taskInfo) {
|
||||
let functionId = 'cash_doTask'
|
||||
let body = {"type":type,"taskInfo":taskInfo}
|
||||
let sign = await getSign(functionId, body)
|
||||
let sign = await getSignfromPanda(functionId, body)
|
||||
|
||||
return new Promise((resolve) => {
|
||||
$.post(apptaskUrl(functionId, sign), (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
console.log(`${JSON.stringify(err)}`)
|
||||
console.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
console.log(`appdoTask API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
data = JSON.parse(data);
|
||||
@@ -327,7 +255,7 @@ function doTask(type,taskInfo) {
|
||||
try {
|
||||
if (err) {
|
||||
console.log(`${JSON.stringify(err)}`)
|
||||
console.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
console.log(`doTask API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
data = JSON.parse(data);
|
||||
@@ -347,127 +275,52 @@ function doTask(type,taskInfo) {
|
||||
})
|
||||
})
|
||||
}
|
||||
function getReward(source = 1) {
|
||||
return new Promise((resolve) => {
|
||||
$.get(taskUrl("cash_mob_reward",{"source": Number(source),"rewardNode":""}), (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
console.log(`${JSON.stringify(err)}`)
|
||||
console.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
data = JSON.parse(data);
|
||||
if (data.code === 0 && data.data.bizCode === 0) {
|
||||
console.log(`领奖成功,${data.data.result.shareRewardTip}【${data.data.result.shareRewardAmount}】`)
|
||||
message += `领奖成功,${data.data.result.shareRewardTip}【${data.data.result.shareRewardAmount}元】\n`;
|
||||
// console.log(data.data.result.taskInfos)
|
||||
} else {
|
||||
// console.log(`领奖失败,${data.data.bizMsg}`)
|
||||
}
|
||||
}
|
||||
function getSignfromPanda(functionId, body) {
|
||||
var strsign = '';
|
||||
let data = {
|
||||
"fn":functionId,
|
||||
"body": body
|
||||
}
|
||||
return new Promise((resolve) => {
|
||||
let url = {
|
||||
url: "https://api.zhezhe.cf/jd/sign",
|
||||
body: JSON.stringify(data),
|
||||
followRedirect: false,
|
||||
headers: {
|
||||
'Accept': '*/*',
|
||||
"accept-encoding": "gzip, deflate, br",
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'Bearer ' + jdPandaToken
|
||||
},
|
||||
timeout: 30000
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve(data);
|
||||
}
|
||||
$.post(url, async(err, resp, data) => {
|
||||
try {
|
||||
data = JSON.parse(data);
|
||||
|
||||
if (data && data.code == 200) {
|
||||
lnrequesttimes = data.request_times;
|
||||
console.log("连接Panda服务成功,当前Token使用次数为" + lnrequesttimes);
|
||||
if (data.data.sign)
|
||||
strsign = data.data.sign || '';
|
||||
if (strsign != '')
|
||||
resolve(strsign);
|
||||
else
|
||||
console.log("签名获取失败,可能Token使用次数上限或被封.");
|
||||
} else {
|
||||
console.log("签名获取失败.");
|
||||
}
|
||||
|
||||
}catch (e) {
|
||||
$.logErr(e, resp);
|
||||
}finally {
|
||||
resolve(strsign);
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
function exchange2(node) {
|
||||
let body = '';
|
||||
const data = {node,"configVersion":"1.0"}
|
||||
if (data['node'] === '-1') {
|
||||
body = `body=${encodeURIComponent(JSON.stringify(data))}&uuid=8888888&client=apple&clientVersion=9.4.1&st=1619595890027&sign=92a8abba7b6846f274ac9803aa5a283d&sv=102`;
|
||||
} else if (data['node'] === '0') {
|
||||
body = `body=${encodeURIComponent(JSON.stringify(data))}&uuid=8888888&client=apple&clientVersion=9.4.1&st=1619597882090&sign=e00bd6c3af2a53820825b94f7a648551&sv=100`;
|
||||
} else if (data['node'] === '1') {
|
||||
body = `body=${encodeURIComponent(JSON.stringify(data))}&uuid=8888888&client=apple&clientVersion=9.4.1&st=1619595655007&sign=2e72bbd21e5f5775fe920eac129f89a2&sv=111`;
|
||||
} else if (data['node'] === '2') {
|
||||
body = `body=${encodeURIComponent(JSON.stringify(data))}&uuid=8888888&client=apple&clientVersion=9.4.1&st=1619597924095&sign=c04c70370ff68d71890de08a18cac981&sv=112`;
|
||||
} else if (data['node'] === '3') {
|
||||
body = `body=${encodeURIComponent(JSON.stringify(data))}&uuid=8888888&client=apple&clientVersion=9.4.1&st=1619597953001&sign=4c36b3d816d4f0646b5c34e7596502f8&sv=122`;
|
||||
}
|
||||
return new Promise((resolve) => {
|
||||
const options = {
|
||||
url: `${JD_API_HOST}?functionId=cash_exchangeBeans&t=${Date.now()}&${body}`,
|
||||
body: `body=${escape(JSON.stringify(data))}`,
|
||||
headers: {
|
||||
'Cookie': cookie,
|
||||
'Host': 'api.m.jd.com',
|
||||
'Connection': 'keep-alive',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.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-cn',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
}
|
||||
}
|
||||
$.post(options, async (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
console.log(`${JSON.stringify(err)}`)
|
||||
console.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
data = JSON.parse(data);
|
||||
if (data['code'] === 0) {
|
||||
if (data.data.bizCode === 0) {
|
||||
console.log(`花费${data.data.result.needMoney}元红包兑换成功!获得${data.data.result.beanName}\n`)
|
||||
$.exchangeBeanNum += parseInt(data.data.result.needMoney);
|
||||
$.canLoop = false;
|
||||
} else {
|
||||
console.log('花费2元红包兑换200京豆失败:' + data.data.bizMsg)
|
||||
if (data.data.bizCode === 504) $.canLoop = true;
|
||||
if (data.data.bizCode === 120) $.canLoop = false;
|
||||
}
|
||||
} else {
|
||||
console.log(`兑换京豆失败:${JSON.stringify(data)}\n`);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve(data);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
function getSign(functionId, body) {
|
||||
return new Promise(async resolve => {
|
||||
let data = {
|
||||
functionId,
|
||||
body: JSON.stringify(body),
|
||||
"client":"apple",
|
||||
"clientVersion":"10.3.0"
|
||||
}
|
||||
let HostArr = ['jdsign.cf', 'signer.nz.lu']
|
||||
let Host = HostArr[Math.floor((Math.random() * HostArr.length))]
|
||||
let options = {
|
||||
url: `https://cdn.nz.lu/ddo`,
|
||||
body: JSON.stringify(data),
|
||||
headers: {
|
||||
Host,
|
||||
"User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1 Edg/87.0.4280.88"
|
||||
},
|
||||
timeout: 30 * 1000
|
||||
}
|
||||
$.post(options, (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
console.log(JSON.stringify(err))
|
||||
console.log(`${$.name} getSign API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
} finally {
|
||||
resolve(data);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function randomString(e) {
|
||||
e = e || 32;
|
||||
let t = "abcdefghijklmnopqrstuvwxyz0123456789", a = t.length, n = "";
|
||||
@@ -509,30 +362,6 @@ function readShareCode() {
|
||||
resolve()
|
||||
})
|
||||
}
|
||||
//格式化助力码
|
||||
function shareCodesFormat() {
|
||||
return new Promise(async resolve => {
|
||||
// console.log(`第${$.index}个京东账号的助力码:::${$.shareCodesArr[$.index - 1]}`)
|
||||
$.newShareCodes = [];
|
||||
if ($.shareCodesArr[$.index - 1]) {
|
||||
$.newShareCodes = $.shareCodesArr[$.index - 1].split('@');
|
||||
} else {
|
||||
console.log(`由于您第${$.index}个京东账号未提供shareCode,将采纳本脚本自带的助力码\n`)
|
||||
const tempIndex = $.index > inviteCodes.length ? (inviteCodes.length - 1) : ($.index - 1);
|
||||
$.newShareCodes = inviteCodes[tempIndex].split('@');
|
||||
let authorCode = deepCopy($.authorCode)
|
||||
$.newShareCodes = [...(authorCode.map((item, index) => authorCode[index] = item['inviteCode'])), ...$.newShareCodes];
|
||||
}
|
||||
// const readShareCodeRes = await readShareCode();
|
||||
// if (readShareCodeRes && readShareCodeRes.code === 200) {
|
||||
// $.newShareCodes = [...new Set([...$.newShareCodes, ...(readShareCodeRes.data || [])])];
|
||||
// }
|
||||
$.newShareCodes.map((item, index) => $.newShareCodes[index] = { "inviteCode": item, "shareDate": $.shareDate })
|
||||
console.log(`第${$.index}个京东账号将要助力的好友${JSON.stringify($.newShareCodes)}`)
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
|
||||
function requireConfig() {
|
||||
return new Promise(resolve => {
|
||||
console.log(`开始获取${$.name}配置文件\n`);
|
||||
@@ -612,39 +441,6 @@ function taskUrl(functionId, body = {}) {
|
||||
}
|
||||
}
|
||||
|
||||
function getAuthorShareCode(url) {
|
||||
return new Promise(resolve => {
|
||||
const options = {
|
||||
url: `${url}?${new Date()}`, "timeout": 30000, headers: {
|
||||
"User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1 Edg/87.0.4280.88"
|
||||
}
|
||||
};
|
||||
if ($.isNode() && process.env.TG_PROXY_HOST && process.env.TG_PROXY_PORT) {
|
||||
const tunnel = require("tunnel");
|
||||
const agent = {
|
||||
https: tunnel.httpsOverHttp({
|
||||
proxy: {
|
||||
host: process.env.TG_PROXY_HOST,
|
||||
port: process.env.TG_PROXY_PORT * 1
|
||||
}
|
||||
})
|
||||
}
|
||||
Object.assign(options, { agent })
|
||||
}
|
||||
$.get(options, async (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
} else {
|
||||
if (data) data = JSON.parse(data)
|
||||
}
|
||||
} catch (e) {
|
||||
// $.logErr(e, resp)
|
||||
} finally {
|
||||
resolve(data);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
function TotalBean() {
|
||||
return new Promise(async resolve => {
|
||||
const options = {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,186 +1,199 @@
|
||||
/**
|
||||
* const $ = new Env('京东-锦鲤红包');
|
||||
* 做任务、助力、开红包
|
||||
* cron: 1 0,18 * * *
|
||||
* 修改自HW大佬,自用,仅助力前7账号,纯内部互助
|
||||
* 京东-锦鲤红包
|
||||
* 6点后做全部CK
|
||||
* cron: 2 0,1,6 * * *
|
||||
* CK1 HW.ts -> 内部
|
||||
* CK2~n 内部 -> HW.ts
|
||||
*/
|
||||
|
||||
import axios from 'axios';
|
||||
import {logs} from './function/jinli_log';
|
||||
import {getRandomNumberByRange, getshareCodeHW, o2s, randomString, requireConfig, wait} from "./function/TS_USER_AGENTS";
|
||||
import axios from 'axios'
|
||||
import {sendNotify} from './sendNotify'
|
||||
import {get, getshareCodeHW, o2s, requireConfig, wait} from "./TS_USER_AGENTS"
|
||||
|
||||
let cookie: string = '', res: any = '', UserName: string, UA: string = ''
|
||||
let shareCodesSelf: string[] = [], shareCodes: string[] = [], fullCode: string[] = []
|
||||
let min: number[] = [0.02, 0.12, 0.3, 0.6, 0.7, 0.8, 1, 2], log: string = '', logIndex: number = 10
|
||||
let cookie: string, cookiesArr: string[] = [], res: any, UserName: string
|
||||
let shareCodesSelf: string[] = [], shareCodes: string[] = [], shareCodesHW: string[] = [], fullCode: string[] = []
|
||||
let min: number[] = [0.02, 0.12, 0.3, 0.4, 0.6, 0.7, 0.8, 1, 1.2, 2, 3.6], log: string
|
||||
|
||||
!(async () => {
|
||||
let cookiesArr: string[] = await requireConfig(false);
|
||||
for (let [index, value] of cookiesArr.entries()) {
|
||||
if(index < 7){
|
||||
try {
|
||||
cookie = value;
|
||||
UserName = decodeURIComponent(cookie.match(/pt_pin=([^;]*)/)![1])
|
||||
console.log(`\n开始【京东账号${index + 1}】${UserName}\n`);
|
||||
UA = `jdltapp;iPhone;3.1.0;${Math.ceil(Math.random() * 4 + 10)}.${Math.ceil(Math.random() * 4)};${randomString(40)}`
|
||||
log = logs[getRandomNumberByRange(0, logs.length - 1)]
|
||||
let random = log.match(/"random":"(\d+)"/)[1], log1 = log.match(/"log":"(.*)"/)[1]
|
||||
res = await api('h5launch', {"followShop": 0, "random": random, "log": log1, "sceneid": "JLHBhPageh5"})
|
||||
console.log('活动初始化:', res.data.result.statusDesc)
|
||||
await wait(1000)
|
||||
cookiesArr = await requireConfig()
|
||||
cookiesArr = cookiesArr.slice(0, 1)
|
||||
await join()
|
||||
await help()
|
||||
|
||||
res = await api('h5activityIndex', {"isjdapp": 1})
|
||||
console.log('红包ID:', res.data.result.redpacketInfo.id)
|
||||
shareCodesSelf.push(res.data.result.redpacketInfo.id)
|
||||
await wait(1000)
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
cookiesArr = await requireConfig()
|
||||
cookiesArr = cookiesArr.slice(0, 9)
|
||||
if (new Date().getHours() === 0)
|
||||
await join()
|
||||
await getShareCodeSelf()
|
||||
await help()
|
||||
await open(0)
|
||||
})()
|
||||
|
||||
await wait(2000)
|
||||
|
||||
console.log('内部助力:', shareCodesSelf)
|
||||
async function join() {
|
||||
for (let [index, value] of cookiesArr.entries()) {
|
||||
try {
|
||||
cookie = value;
|
||||
cookie = value
|
||||
UserName = decodeURIComponent(cookie.match(/pt_pin=([^;]*)/)![1])
|
||||
shareCodes = Array.from(new Set([...shareCodesSelf]))
|
||||
for (let code of shareCodes) {
|
||||
if (!fullCode.includes(code)) {
|
||||
UA = `jdltapp;iPhone;3.1.0;${Math.ceil(Math.random() * 4 + 10)}.${Math.ceil(Math.random() * 4)};${randomString(40)}`
|
||||
log = logs[getRandomNumberByRange(0, logs.length - 1)]
|
||||
let random = log.match(/"random":"(\d+)"/)[1], log1 = log.match(/"log":"(.*)"/)[1]
|
||||
console.log(`账号${index + 1} ${UserName} 去助力 ${code} ${shareCodesSelf.includes(code) ? '*内部*' : ''}`)
|
||||
|
||||
res = await api('jinli_h5assist', {"redPacketId": code, "followShop": 0, "random": random, "log": log1, "sceneid": "JLHBhPageh5"})
|
||||
o2s(res, 'jinli_h5assist')
|
||||
|
||||
if (res.data.result.status === 0) {
|
||||
console.log('助力成功:', parseFloat(res.data.result.assistReward.discount))
|
||||
await wait(1000)
|
||||
console.log(`\n开始【京东账号${index + 1}】${UserName}\n`)
|
||||
for (let i = 0; i < 5; i++) {
|
||||
try {
|
||||
log = await getLog()
|
||||
res = await api('h5launch', {followShop: 0, random: log.match(/"random":"(\d+)"/)[1], log: log.match(/"log":"(.*)"/)[1], sceneid: 'JLHBhPageh5'})
|
||||
console.log('活动初始化:', res.data.result.statusDesc)
|
||||
if (res.rtn_code !== 403) {
|
||||
break
|
||||
} else if (res.data.result.status === 3) {
|
||||
console.log('今日助力次数已满')
|
||||
break
|
||||
} else {
|
||||
console.log('助力结果:', res.data.result.statusDesc)
|
||||
if (res.data.result.statusDesc === '啊偶,TA的助力已满,开启自己的红包活动吧~') {
|
||||
fullCode.push(code)
|
||||
}
|
||||
}
|
||||
await wait(1000)
|
||||
} else {
|
||||
console.log(`Code ${code} 已被助满`)
|
||||
} catch (e) {
|
||||
console.log('log error', e)
|
||||
await wait(3000)
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
await wait(1000)
|
||||
}
|
||||
}
|
||||
|
||||
async function getShareCodeSelf(one: boolean = false) {
|
||||
if (one) {
|
||||
res = await api('h5activityIndex', {"isjdapp": 1})
|
||||
return res?.data?.result?.redpacketInfo?.id
|
||||
} else {
|
||||
for (let [index, value] of cookiesArr.entries()) {
|
||||
try {
|
||||
cookie = value
|
||||
UserName = decodeURIComponent(cookie.match(/pt_pin=([^;]*)/)![1])
|
||||
console.log(`\n开始【京东账号${index + 1}】${UserName}\n`)
|
||||
res = await api('h5activityIndex', {"isjdapp": 1})
|
||||
console.log('ID:', res.data.result.redpacketInfo.id)
|
||||
shareCodesSelf.push(res.data.result.redpacketInfo.id)
|
||||
} catch (e) {
|
||||
console.log('getShareCodeSelf error', e)
|
||||
}
|
||||
await wait(1000)
|
||||
}
|
||||
o2s(shareCodesSelf)
|
||||
}
|
||||
}
|
||||
|
||||
async function open(autoOpen: number) {
|
||||
for (let [index, value] of cookiesArr.entries()) {
|
||||
if(index < 7){
|
||||
try {
|
||||
try {
|
||||
cookie = value
|
||||
UserName = decodeURIComponent(cookie.match(/pt_pin=([^;]*)/)![1])
|
||||
console.log(`\n开始【京东账号${index + 1}】${UserName}\n`);
|
||||
UA = `jdltapp;iPhone;3.1.0;${Math.ceil(Math.random() * 4 + 10)}.${Math.ceil(Math.random() * 4)};${randomString(40)}`
|
||||
log = logs[getRandomNumberByRange(0, logs.length - 1)]
|
||||
let random = log.match(/"random":"(\d+)"/)[1], log1 = log.match(/"log":"(.*)"/)[1]
|
||||
// 做任务
|
||||
/*
|
||||
res = await api('taskHomePage', {})
|
||||
await wait(1000)
|
||||
for (let t of res.data.result.taskInfos) {
|
||||
if (!t.alreadyReceivedCount || t.alreadyReceivedCount < t.requireCount) {
|
||||
if ([2, 3, 4, 5, 8].includes(t.taskType)) {
|
||||
res = await api('startTask', {"taskType": t.taskType, "random": getRandomNumberByRange(36135846, 74613584), "log": `${Date.now()}~1orj8k3`, "sceneid": "JLHBhPageh5"})
|
||||
console.log(t.title, res.data.biz_msg)
|
||||
await wait(1000)
|
||||
res = await api('getTaskDetailForColor', {taskType: t.taskType})
|
||||
await wait(1000)
|
||||
for (let tp of res.data.result.advertDetails) {
|
||||
if (tp.status === 0) {
|
||||
res = await api('taskReportForColor', {"taskType": t.taskType, "detailId": tp.id})
|
||||
console.log(t.title, tp.name, res.data.biz_msg)
|
||||
await wait(1000)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (t.innerStatus === 3) {
|
||||
res = await api('h5receiveRedpacketAll', {"taskType": t.taskType, "random": getRandomNumberByRange(36135846, 74613584), "log": `${Date.now()}~138q6w6`, "sceneid": "JLHBhPageh5"})
|
||||
console.log(`${t.title} 打开成功,获得`, parseFloat(res.data.result.discount))
|
||||
if (!min.includes(parseFloat(res.data.result.discount)))
|
||||
await sendNotify(`锦鲤红包`, `账号${index + 1} ${UserName}\n${res.data.result.discount}`)
|
||||
await wait(1000)
|
||||
}
|
||||
}
|
||||
await wait(1000)
|
||||
|
||||
|
||||
// 打开任务红包
|
||||
res = await api('taskHomePage', {})
|
||||
await wait(1000)
|
||||
for (let t of res.data.result.taskInfos) {
|
||||
if (t.innerStatus === 3) {
|
||||
res = await api('h5receiveRedpacketAll', {"taskType": t.taskType, "random": getRandomNumberByRange(36135846, 74613584), "log": `${Date.now()}~138q6w6`, "sceneid": "JLHBhPageh5"})
|
||||
console.log(`${t.title} 打开成功,获得`, parseFloat(res.data.result.discount))
|
||||
if (!min.includes(parseFloat(res.data.result.discount)))
|
||||
await sendNotify(`锦鲤红包`, `账号${index + 1} ${UserName}\n${res.data.result.discount}`)
|
||||
await wait(1000)
|
||||
}
|
||||
}
|
||||
await wait(2000)
|
||||
*/
|
||||
|
||||
// 打开助力红包
|
||||
console.log(`\n开始【京东账号${index + 1}】${UserName}\n`)
|
||||
let j: number = 1
|
||||
res = await api('h5activityIndex', {"isjdapp": 1})
|
||||
for (let t of res.data.result.redpacketConfigFillRewardInfo) {
|
||||
if (t.packetStatus === 2) {
|
||||
console.log(`红包${j}已拆过,获得`, t.packetAmount)
|
||||
} else if (t.packetStatus === 1) {
|
||||
console.log(`红包${j}可拆`)
|
||||
res = await api('h5receiveRedpacketAll', {"random": random, "log": log1, "sceneid": "JLHBhPageh5"})
|
||||
console.log(res.data.biz_msg, parseFloat(res.data.result.discount))
|
||||
await wait(1000)
|
||||
} else {
|
||||
if (t.packetStatus === 1) {
|
||||
console.log(`${j} 可拆`)
|
||||
} else if (t.packetStatus === 2) {
|
||||
console.log(`${j} 已拆`)
|
||||
}
|
||||
j++
|
||||
}
|
||||
console.log('')
|
||||
|
||||
j = 1
|
||||
for (let t of res.data.result.redpacketConfigFillRewardInfo) {
|
||||
if (t.packetStatus === 1) {
|
||||
if (autoOpen) {
|
||||
log = await getLog()
|
||||
res = await api('h5receiveRedpacketAll', {random: log.match(/"random":"(\d+)"/)[1], log: log.match(/"log":"(.*)"/)[1], sceneid: 'JLHBhPageh5'})
|
||||
console.log('打开成功', parseFloat(res.data.result.discount))
|
||||
if (!min.includes(parseFloat(res.data.result.discount))) {
|
||||
await sendNotify('锦鲤红包', `账号${index + 1} ${UserName}\n${t.packetAmount}`)
|
||||
}
|
||||
await wait(6000)
|
||||
}
|
||||
} else if (![1, 2].includes(t.packetStatus)) {
|
||||
console.log(`${j}`, t.hasAssistNum, '/', t.requireAssistNum)
|
||||
}
|
||||
j++
|
||||
}
|
||||
}
|
||||
|
||||
catch (e) {
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
await wait(1000)
|
||||
await wait(3000)
|
||||
}
|
||||
}
|
||||
})()
|
||||
}
|
||||
|
||||
async function api(fn: string, body: object, retry: number = 0) {
|
||||
async function help() {
|
||||
for (let [index, value] of cookiesArr.entries()) {
|
||||
try {
|
||||
cookie = value
|
||||
UserName = decodeURIComponent(cookie.match(/pt_pin=([^;]*)/)![1])
|
||||
if (shareCodesHW.length === 0) {
|
||||
shareCodesHW = await getshareCodeHW('jlhb')
|
||||
}
|
||||
if (index === 0) {
|
||||
shareCodes = Array.from(new Set([...shareCodesHW, ...shareCodesSelf]))
|
||||
} else {
|
||||
shareCodes = Array.from(new Set([...shareCodesSelf, ...shareCodesHW]))
|
||||
}
|
||||
|
||||
let me: string = await getShareCodeSelf(true)
|
||||
let success: boolean = false
|
||||
for (let code of shareCodes) {
|
||||
if (success) break
|
||||
if (!fullCode.includes(code) && code !== me) {
|
||||
console.log(`账号${index + 1} ${UserName} 去助力 ${code} ${shareCodesSelf.includes(code) ? '*内部*' : ''}`)
|
||||
for (let i = 0; i < 5; i++) {
|
||||
log = await getLog()
|
||||
res = await api('jinli_h5assist', {"redPacketId": code, "followShop": 0, random: log.match(/"random":"(\d+)"/)[1], log: log.match(/"log":"(.*)"/)[1], sceneid: 'JLHBhPageh5'})
|
||||
if (res.rtn_code === 403) {
|
||||
console.log('log error')
|
||||
await wait(5000)
|
||||
} else {
|
||||
if (res.data.result.status === 0) {
|
||||
console.log('助力成功:', parseFloat(res.data.result.assistReward.discount))
|
||||
success = true
|
||||
await wait(45000)
|
||||
break
|
||||
} else if (res.data.result.status === 3) {
|
||||
console.log('今日助力次数已满')
|
||||
success = true
|
||||
await wait(45000)
|
||||
break
|
||||
} else {
|
||||
console.log('助力结果:', res.data.result.statusDesc)
|
||||
if (res.data.result.statusDesc === '啊偶,TA的助力已满,开启自己的红包活动吧~') {
|
||||
fullCode.push(code)
|
||||
}
|
||||
await wait(45000)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
await wait(6000)
|
||||
}
|
||||
}
|
||||
|
||||
async function api(fn: string, body: object) {
|
||||
let {data} = await axios.post(`https://api.m.jd.com/api?appid=jinlihongbao&functionId=${fn}&loginType=2&client=jinlihongbao&clientVersion=10.2.4&osVersion=AndroidOS&d_brand=Xiaomi&d_model=Xiaomi`, `body=${encodeURIComponent(JSON.stringify(body))}`, {
|
||||
headers: {
|
||||
"Cookie": cookie,
|
||||
"origin": "https://h5.m.jd.com",
|
||||
"referer": "https://h5.m.jd.com/babelDiy/Zeus/2NUvze9e1uWf4amBhe1AV6ynmSuH/index.html",
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
"X-Requested-With": "com.jingdong.app.mall",
|
||||
"User-Agent": UA,
|
||||
"User-Agent": "Mozilla/5.0 (Linux; U; Android 8.0.0; zh-cn; Mi Note 2 Build/OPR1.170623.032) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/61.0.3163.128 Mobile Safari/537.36 XiaoMi/MiuiBrowser/10.1.1",
|
||||
"Cookie": cookie,
|
||||
}
|
||||
})
|
||||
await wait(5000)
|
||||
if (data.rtn_code === 403 && retry < 3) {
|
||||
console.log('retry...')
|
||||
await wait(1000)
|
||||
log = logs[getRandomNumberByRange(0, logs.length - 1)]
|
||||
body['random'] = log.match(/"random":"(\d+)"/)[1]
|
||||
body['log'] = log.match(/"log":"(.*)"/)[1]
|
||||
await wait(5000)
|
||||
await api(fn, body, ++retry)
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
async function getLog() {
|
||||
let data = await get(`https://api.jdsharecode.xyz/api/jlhb`)
|
||||
if (data !== 1 && data !== '1') {
|
||||
return data
|
||||
} else {
|
||||
console.log('No log')
|
||||
process.exit(0)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user