增加助力活动
This commit is contained in:
@@ -0,0 +1,574 @@
|
|||||||
|
/*
|
||||||
|
领京豆额外奖励&抢京豆
|
||||||
|
脚本自带助力码,介意者可将 29行 helpAuthor 变量设置为 false
|
||||||
|
活动入口:京东APP首页-领京豆
|
||||||
|
更新地址:https://gitee.com/lxk0301/jd_scripts/raw/master/jd_bean_home.js
|
||||||
|
已支持IOS双京东账号, Node.js支持N个京东账号
|
||||||
|
脚本兼容: QuantumultX, Surge, Loon, 小火箭,JSBox, Node.js
|
||||||
|
============Quantumultx===============
|
||||||
|
[task_local]
|
||||||
|
#领京豆额外奖励
|
||||||
|
10 7 * * * https://gitee.com/lxk0301/jd_scripts/raw/master/jd_bean_home.js, tag=领京豆额外奖励, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jd_bean_home.png, enabled=true
|
||||||
|
|
||||||
|
================Loon==============
|
||||||
|
[Script]
|
||||||
|
cron "10 7 * * *" script-path=https://gitee.com/lxk0301/jd_scripts/raw/master/jd_bean_home.js, tag=领京豆额外奖励
|
||||||
|
|
||||||
|
===============Surge=================
|
||||||
|
领京豆额外奖励 = type=cron,cronexp="10 7 * * *",wake-system=1,timeout=3600,script-path=https://gitee.com/lxk0301/jd_scripts/raw/master/jd_bean_home.js
|
||||||
|
|
||||||
|
============小火箭=========
|
||||||
|
领京豆额外奖励 = type=cron,script-path=https://gitee.com/lxk0301/jd_scripts/raw/master/jd_bean_home.js, cronexpr="10 7 * * *", timeout=3600, enable=true
|
||||||
|
*/
|
||||||
|
const notify = $.isNode() ? require('./sendNotify') : '';
|
||||||
|
//Node.js用户请在jdCookie.js处填写京东ck;
|
||||||
|
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
|
||||||
|
let jdNotify = true;//是否关闭通知,false打开通知推送,true关闭通知推送
|
||||||
|
const helpAuthor = false; // 是否帮助作者助力,false打开通知推送,true关闭通知推送
|
||||||
|
//IOS等用户直接用NobyDa的jd cookie
|
||||||
|
let cookiesArr = [], cookie = '', message;
|
||||||
|
let newShareCodes = []
|
||||||
|
let roleMap = {
|
||||||
|
"jd_4521b375ebb5d": "锟子怪",
|
||||||
|
"jd_542c10c0222bc": "康子怪",
|
||||||
|
"jd_66dcb31363ef6": "涛子怪",
|
||||||
|
"jd_45d917547c763": "跑腿小怪",
|
||||||
|
"417040678_m": "斌子怪",
|
||||||
|
"jd_73d88459d908e": "杰杰子",
|
||||||
|
"381550701lol": "漪漪子",
|
||||||
|
"jd_4333d5dc1ac5f": "舒楠子",
|
||||||
|
"jd_66ea783827d30": "军子",
|
||||||
|
"jd_4311ac0ff4456": "居子"
|
||||||
|
}
|
||||||
|
let dingtalk = "https://oapi.dingtalk.com/robot/send?access_token=d2b6042cb38f0df63e20797c002208d2710104750c18a1dc84d54106a859a3f0"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if ($.isNode()) {
|
||||||
|
Object.keys(jdCookieNode).forEach((item) => {
|
||||||
|
cookiesArr.push(jdCookieNode[item])
|
||||||
|
})
|
||||||
|
if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') that.log = () => {
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
|
||||||
|
}
|
||||||
|
const JD_API_HOST = 'https://api.m.jd.com/';
|
||||||
|
!(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;
|
||||||
|
}
|
||||||
|
message += "<font color=\'#FFA500\'>[通知] </font><font color=\'#006400\' size='3'>额外领京豆</font> \n\n"
|
||||||
|
|
||||||
|
for (let i = 0; i < cookiesArr.length; i++) {
|
||||||
|
if (cookiesArr[i]) {
|
||||||
|
cookie = cookiesArr[i];
|
||||||
|
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
|
||||||
|
$.index = i + 1;
|
||||||
|
$.isLogin = true;
|
||||||
|
$.nickName = '';
|
||||||
|
await TotalBean();
|
||||||
|
|
||||||
|
if (roleMap[username] != undefined) {
|
||||||
|
username = roleMap[username]
|
||||||
|
}
|
||||||
|
//加上名称
|
||||||
|
message = message + "<font color=\'#778899\' size=2>【羊毛姐妹】<font color=\'#FFA500\' size=3>" + username + " </font> </font> \n\n "
|
||||||
|
|
||||||
|
that.log(`\n******开始【京东账号${$.index}】${$.nickName || $.UserName}*********\n`);
|
||||||
|
if (!$.isLogin) {
|
||||||
|
$.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, { "open-url": "https://bean.m.jd.com/bean/signIndex.action" });
|
||||||
|
|
||||||
|
if ($.isNode()) {
|
||||||
|
await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
|
||||||
|
}
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
await jdBeanHome();
|
||||||
|
}
|
||||||
|
|
||||||
|
message += "----\n\n"
|
||||||
|
}
|
||||||
|
postToDingTalk(message)
|
||||||
|
message += "<font color=\'#FFA500\'>[通知] </font><font color=\'#006400\' size='3'>额外领京豆</font> \n\n"
|
||||||
|
|
||||||
|
for (let i = 0; i < cookiesArr.length; i++) {
|
||||||
|
if (cookiesArr[i]) {
|
||||||
|
cookie = cookiesArr[i];
|
||||||
|
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
|
||||||
|
that.log(`${$.UserName}去帮助下一个人`)
|
||||||
|
cookie = cookiesArr[i];
|
||||||
|
for (let j = 0; i < newShareCodes.length; j++) {
|
||||||
|
let code = newShareCodes[j]
|
||||||
|
await help(code[0], code[1])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})()
|
||||||
|
.catch((e) => {
|
||||||
|
$.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
postToDingTalk(message)
|
||||||
|
$.done();
|
||||||
|
})
|
||||||
|
|
||||||
|
async function jdBeanHome() {
|
||||||
|
$.doneState = false
|
||||||
|
do {
|
||||||
|
await doTask2()
|
||||||
|
await $.wait(3000)
|
||||||
|
} while (!$.doneState)
|
||||||
|
await $.wait(1000)
|
||||||
|
await award("feeds")
|
||||||
|
await $.wait(1000)
|
||||||
|
await getUserInfo()
|
||||||
|
await $.wait(1000)
|
||||||
|
await getTaskList();
|
||||||
|
await receiveJd2();
|
||||||
|
await showMsg();
|
||||||
|
}
|
||||||
|
|
||||||
|
function getRandomInt(min, max) {
|
||||||
|
min = Math.ceil(min);
|
||||||
|
max = Math.floor(max);
|
||||||
|
return Math.floor(Math.random() * (max - min)) + min;
|
||||||
|
}
|
||||||
|
function doTask2() {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
const body = { "awardFlag": false, "skuId": `${getRandomInt(10000000, 20000000)}`, "source": "feeds", "type": '1' };
|
||||||
|
$.post(taskUrl('beanHomeTask', body), (err, resp, data) => {
|
||||||
|
try {
|
||||||
|
if (err) {
|
||||||
|
that.log(`${JSON.stringify(err)}`)
|
||||||
|
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||||
|
} else {
|
||||||
|
if (safeGet(data)) {
|
||||||
|
data = JSON.parse(data);
|
||||||
|
if (data.code === '0' && data.data) {
|
||||||
|
that.log(`任务完成进度:${data.data.taskProgress} / ${data.data.taskThreshold}`)
|
||||||
|
if (data.data.taskProgress === data.data.taskThreshold)
|
||||||
|
$.doneState = true
|
||||||
|
} else if (data.code === '0' && data.errorCode === 'HT201') {
|
||||||
|
$.doneState = true
|
||||||
|
} else {
|
||||||
|
//HT304风控用户
|
||||||
|
$.doneState = true
|
||||||
|
that.log(`做任务异常:${JSON.stringify(data)}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
$.logErr(e, resp)
|
||||||
|
} finally {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function getUserInfo() {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
let body = {}
|
||||||
|
$.post(taskUrl('signBeanGroupStageIndex', body), async (err, resp, data) => {
|
||||||
|
try {
|
||||||
|
if (err) {
|
||||||
|
that.log(`${JSON.stringify(err)}`)
|
||||||
|
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||||
|
} else {
|
||||||
|
if (safeGet(data)) {
|
||||||
|
data = JSON.parse(data);
|
||||||
|
if (data.data.jklInfo) {
|
||||||
|
$.actId = data.data.jklInfo.keyId
|
||||||
|
let { shareCode, groupCode } = data.data
|
||||||
|
if (!shareCode) {
|
||||||
|
that.log(`未获取到助力码,去开团`)
|
||||||
|
await hitGroup()
|
||||||
|
} else {
|
||||||
|
that.log(shareCode, groupCode)
|
||||||
|
// 去做逛会场任务
|
||||||
|
if (data.data.beanActivityVisitVenue && data.data.beanActivityVisitVenue.taskStatus === '0') {
|
||||||
|
await help(shareCode, groupCode, 1)
|
||||||
|
}
|
||||||
|
newShareCodes.push([shareCode, groupCode])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
$.logErr(e, resp)
|
||||||
|
} finally {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function hitGroup() {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
const body = { "activeType": 2, };
|
||||||
|
$.get(taskGetUrl('signGroupHit', body), async (err, resp, data) => {
|
||||||
|
try {
|
||||||
|
if (err) {
|
||||||
|
that.log(`${JSON.stringify(err)}`)
|
||||||
|
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||||
|
} else {
|
||||||
|
if (safeGet(data)) {
|
||||||
|
data = JSON.parse(data);
|
||||||
|
if (data.data.respCode === "SG150") {
|
||||||
|
let { shareCode, groupCode } = data.data.signGroupMain
|
||||||
|
if (shareCode) {
|
||||||
|
newShareCodes.push([shareCode, groupCode])
|
||||||
|
that.log('开团成功')
|
||||||
|
await help(shareCode, groupCode, 1)
|
||||||
|
} else {
|
||||||
|
that.log(`为获取到助力码,错误信息${JSON.stringify(data.data)}`)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
that.log(`开团失败,错误信息${JSON.stringify(data.data)}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
$.logErr(e, resp)
|
||||||
|
} finally {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function help(shareCode, groupCode, isTask = 0) {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
const body = {
|
||||||
|
"activeType": 2,
|
||||||
|
"groupCode": groupCode,
|
||||||
|
"shareCode": shareCode,
|
||||||
|
"activeId": $.actId,
|
||||||
|
};
|
||||||
|
if (isTask) {
|
||||||
|
that.log(`【抢京豆】做任务获取助力`)
|
||||||
|
body['isTask'] = "1"
|
||||||
|
} else {
|
||||||
|
that.log(`【抢京豆】去助力好友${shareCode}`)
|
||||||
|
|
||||||
|
body['source'] = "guest"
|
||||||
|
}
|
||||||
|
$.get(taskGetUrl('signGroupHelp', body), async (err, resp, data) => {
|
||||||
|
try {
|
||||||
|
if (err) {
|
||||||
|
that.log(`${JSON.stringify(err)}`)
|
||||||
|
that.log(`【抢京豆】${$.name} API请求失败,请检查网路重试`)
|
||||||
|
} else {
|
||||||
|
if (safeGet(data)) {
|
||||||
|
data = JSON.parse(data);
|
||||||
|
that.log(`【抢京豆】${data.data.helpToast}`)
|
||||||
|
message = message + "<font color=\'#778899\' size=2>【羊毛姐妹】<font color=\'#FFA500\' size=3>" + `【抢京豆】去助力好友${shareCode}` + " </font> </font> \n\n "
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
$.logErr(e, resp)
|
||||||
|
} finally {
|
||||||
|
resolve(data);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function showMsg() {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
if (message) $.msg($.name, '', `【京东账号${$.index}】${$.nickName}\n${message}`);
|
||||||
|
resolve()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function getTaskList() {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
const body = { "rnVersion": "4.7", "rnClient": "2", "source": "AppHome" };
|
||||||
|
$.post(taskUrl('findBeanHome', body), async (err, resp, data) => {
|
||||||
|
try {
|
||||||
|
if (err) {
|
||||||
|
that.log(`${JSON.stringify(err)}`)
|
||||||
|
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||||
|
} else {
|
||||||
|
if (safeGet(data)) {
|
||||||
|
data = JSON.parse(data);
|
||||||
|
let beanTask = data.data.floorList.filter(vo => vo.floorName === "种豆得豆定制化场景")[0]
|
||||||
|
if (!beanTask.viewed) {
|
||||||
|
await receiveTask()
|
||||||
|
await $.wait(3000)
|
||||||
|
}
|
||||||
|
|
||||||
|
let tasks = data.data.floorList.filter(vo => vo.floorName === "赚京豆")[0]['stageList']
|
||||||
|
for (let i = 0; i < tasks.length; ++i) {
|
||||||
|
const vo = tasks[i]
|
||||||
|
if (vo.viewed) continue
|
||||||
|
await receiveTask(vo.stageId, `4_${vo.stageId}`)
|
||||||
|
await $.wait(3000)
|
||||||
|
}
|
||||||
|
await award()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
$.logErr(e, resp)
|
||||||
|
} finally {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function receiveTask(itemId = "zddd", type = "3") {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
const body = { "awardFlag": false, "itemId": itemId, "source": "home", "type": type };
|
||||||
|
$.post(taskUrl('beanHomeTask', body), (err, resp, data) => {
|
||||||
|
try {
|
||||||
|
if (err) {
|
||||||
|
that.log(`${JSON.stringify(err)}`)
|
||||||
|
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||||
|
} else {
|
||||||
|
if (safeGet(data)) {
|
||||||
|
data = JSON.parse(data);
|
||||||
|
if (data.data) {
|
||||||
|
that.log(`完成任务成功,进度${data.data.taskProgress}/${data.data.taskThreshold}`)
|
||||||
|
} else {
|
||||||
|
that.log(`完成任务失败,${data.errorMessage}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
$.logErr(e, resp)
|
||||||
|
} finally {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function award(source = "home") {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
const body = { "awardFlag": true, "source": source };
|
||||||
|
$.post(taskUrl('beanHomeTask', body), (err, resp, data) => {
|
||||||
|
try {
|
||||||
|
if (err) {
|
||||||
|
that.log(`${JSON.stringify(err)}`)
|
||||||
|
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||||
|
} else {
|
||||||
|
if (safeGet(data)) {
|
||||||
|
data = JSON.parse(data);
|
||||||
|
if (data.data) {
|
||||||
|
that.log(`领奖成功,获得 ${data.data.beanNum} 个京豆`)
|
||||||
|
message += "<font color=\'#FFA500\'>" +`领奖成功,获得 ${data.data.beanNum} 个京豆\n` + "</font> \n\n"
|
||||||
|
|
||||||
|
} else {
|
||||||
|
that.log(`领奖失败,${data.errorMessage}`)
|
||||||
|
// message += `领奖失败,${data.errorMessage}\n`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
$.logErr(e, resp)
|
||||||
|
} finally {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function receiveJd2() {
|
||||||
|
var headers = {
|
||||||
|
'Host': 'api.m.jd.com',
|
||||||
|
'content-type': 'application/x-www-form-urlencoded',
|
||||||
|
'accept': '*/*',
|
||||||
|
'user-agent': 'JD4iPhone/167515 (iPhone; iOS 14.2; Scale/3.00)',
|
||||||
|
'accept-language': 'zh-Hans-JP;q=1, en-JP;q=0.9, zh-Hant-TW;q=0.8, ja-JP;q=0.7, en-US;q=0.6',
|
||||||
|
'Cookie': cookie
|
||||||
|
};
|
||||||
|
var dataString = 'body=%7B%7D&build=167576&client=apple&clientVersion=9.4.3&openudid=53f4d9c70c1c81f1c8769d2fe2fef0190a3f60d2&osVersion=14.2&partner=TF&rfs=0000&scope=10&screen=1242%2A2208&sign=19c33b5b9ad4f02c53b6040fc8527119&st=1614701322170&sv=122'
|
||||||
|
var options = {
|
||||||
|
url: 'https://api.m.jd.com/client.action?functionId=sceneInitialize',
|
||||||
|
headers: headers,
|
||||||
|
body: dataString
|
||||||
|
};
|
||||||
|
return new Promise(resolve => {
|
||||||
|
$.post(options, (err, resp, data) => {
|
||||||
|
try {
|
||||||
|
if (err) {
|
||||||
|
that.log(`${JSON.stringify(err)}`)
|
||||||
|
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||||
|
} else {
|
||||||
|
if (safeGet(data)) {
|
||||||
|
data = JSON.parse(data);
|
||||||
|
if (data['code'] === '0' && data['data']) {
|
||||||
|
that.log(`强制开启新版领京豆成功,获得${data['data']['sceneLevelConfig']['beanNum']}京豆\n`);
|
||||||
|
$.msg($.name, '', `强制开启新版领京豆成功\n获得${data['data']['sceneLevelConfig']['beanNum']}京豆`);
|
||||||
|
} else {
|
||||||
|
that.log(`强制开启新版领京豆结果:${JSON.stringify(data)}\n`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
$.logErr(e, resp)
|
||||||
|
} finally {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function taskGetUrl(function_id, body) {
|
||||||
|
return {
|
||||||
|
url: `${JD_API_HOST}client.action?functionId=${function_id}&body=${escape(JSON.stringify(body))}&appid=ld&clientVersion=9.2.0`,
|
||||||
|
headers: {
|
||||||
|
'Cookie': cookie,
|
||||||
|
'Host': 'api.m.jd.com',
|
||||||
|
'Accept': '*/*',
|
||||||
|
'Connection': 'keep-alive',
|
||||||
|
'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.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"),
|
||||||
|
'Accept-Language': 'zh-Hans-CN;q=1,en-CN;q=0.9',
|
||||||
|
'Accept-Encoding': 'gzip, deflate, br',
|
||||||
|
'Content-Type': "application/x-www-form-urlencoded"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function taskUrl(function_id, body) {
|
||||||
|
body["version"] = "9.0.0.1";
|
||||||
|
body["monitor_source"] = "plant_app_plant_index";
|
||||||
|
body["monitor_refer"] = "";
|
||||||
|
return {
|
||||||
|
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`,
|
||||||
|
headers: {
|
||||||
|
'Cookie': cookie,
|
||||||
|
'Host': 'api.m.jd.com',
|
||||||
|
'Accept': '*/*',
|
||||||
|
'Connection': 'keep-alive',
|
||||||
|
'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.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"),
|
||||||
|
'Accept-Language': 'zh-Hans-CN;q=1,en-CN;q=0.9',
|
||||||
|
'Accept-Encoding': 'gzip, deflate, br',
|
||||||
|
'Content-Type': "application/x-www-form-urlencoded"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function TotalBean() {
|
||||||
|
return new Promise(async resolve => {
|
||||||
|
const options = {
|
||||||
|
"url": `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`,
|
||||||
|
"headers": {
|
||||||
|
"Accept": "application/json,text/plain, */*",
|
||||||
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
|
"Accept-Encoding": "gzip, deflate, br",
|
||||||
|
"Accept-Language": "zh-cn",
|
||||||
|
"Connection": "keep-alive",
|
||||||
|
"Cookie": cookie,
|
||||||
|
"Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2",
|
||||||
|
"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.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$.post(options, (err, resp, data) => {
|
||||||
|
try {
|
||||||
|
if (err) {
|
||||||
|
that.log(`${JSON.stringify(err)}`)
|
||||||
|
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||||
|
} else {
|
||||||
|
if (data) {
|
||||||
|
data = JSON.parse(data);
|
||||||
|
if (data['retcode'] === 13) {
|
||||||
|
$.isLogin = false; //cookie过期
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (data['retcode'] === 0) {
|
||||||
|
$.nickName = (data['base'] && data['base'].nickname) || $.UserName;
|
||||||
|
} else {
|
||||||
|
$.nickName = $.UserName
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
that.log(`京东服务器返回空数据`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
$.logErr(e, resp)
|
||||||
|
} finally {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function safeGet(data) {
|
||||||
|
try {
|
||||||
|
if (typeof JSON.parse(data) == "object") {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
that.log(e);
|
||||||
|
that.log(`京东服务器访问数据为空,请检查自身设备网络情况`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function jsonParse(str) {
|
||||||
|
if (typeof str == "string") {
|
||||||
|
try {
|
||||||
|
return JSON.parse(str);
|
||||||
|
} catch (e) {
|
||||||
|
that.log(e);
|
||||||
|
$.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//我加的函数
|
||||||
|
function postToDingTalk(messgae) {
|
||||||
|
const message1 = "" + messgae
|
||||||
|
// that.log(messgae)
|
||||||
|
|
||||||
|
const body = {
|
||||||
|
"msgtype": "markdown",
|
||||||
|
"markdown": {
|
||||||
|
"title": "签到领现金",
|
||||||
|
"text": message1
|
||||||
|
},
|
||||||
|
"at": {
|
||||||
|
"atMobiles": [],
|
||||||
|
"isAtAll": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$.post(toDingtalk(dingtalk, JSON.stringify(body)), (data, status, xhr) => {
|
||||||
|
try {
|
||||||
|
that.log(resp)
|
||||||
|
that.log(data)
|
||||||
|
if (err) {
|
||||||
|
that.log(JSON.stringify(err));
|
||||||
|
$.logErr(err);
|
||||||
|
} else {
|
||||||
|
if (safeGet(data)) {
|
||||||
|
$.duckRes = JSON.parse(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
$.logErr(e, resp)
|
||||||
|
} finally {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
}, "json")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function toDingtalk(urlmain, bodyMain) {
|
||||||
|
return {
|
||||||
|
url: urlmain,
|
||||||
|
body: bodyMain,
|
||||||
|
headers: { 'Content-Type': 'application/json;charset=utf-8' },
|
||||||
|
timeout: 10000,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,303 +0,0 @@
|
|||||||
let cookiesArr = [], cookie = '';
|
|
||||||
const JD_API_HOST = 'https://ms.jr.jd.com/gw/generic/uc/h5/m';
|
|
||||||
const notify = $.isNode() ? require('./sendNotify') : '';
|
|
||||||
let message = ""
|
|
||||||
//Node.js用户请在jdCookie.js处填写动动ck;
|
|
||||||
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
|
|
||||||
if ($.isNode()) {
|
|
||||||
Object.keys(jdCookieNode).forEach((item) => {
|
|
||||||
cookiesArr.push(jdCookieNode[item])
|
|
||||||
})
|
|
||||||
if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') that.log = () => {};
|
|
||||||
} else {
|
|
||||||
cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
|
|
||||||
}
|
|
||||||
!(async () => {
|
|
||||||
|
|
||||||
message += "<font color=\'#FFA500\'>[通知] </font><font color=\'#006400\' size='3'>天天提鹅</font> \n\n --- \n\n"
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
for (let i = 0; i < cookiesArr.length; i++) {
|
|
||||||
if (cookiesArr[i]) {
|
|
||||||
cookie = cookiesArr[i];
|
|
||||||
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
|
|
||||||
$.index = i + 1;
|
|
||||||
$.isLogin = true;
|
|
||||||
$.nickName = '';
|
|
||||||
await TotalBean();
|
|
||||||
username = $.UserName
|
|
||||||
if ($.UserName == "jd_66ea783827d30"){
|
|
||||||
username = "跑腿小弟"
|
|
||||||
}
|
|
||||||
if ($.UserName == "jd_4521b375ebb5d"){
|
|
||||||
username = "锟锟"
|
|
||||||
}
|
|
||||||
if ($.UserName == "jd_542c10c0222bc"){
|
|
||||||
username = "康康"
|
|
||||||
}
|
|
||||||
//加上名称
|
|
||||||
message = message + "<font color=\'#778899\' size=2>【羊毛姐妹】<font color=\'#FFA500\' size=3>" + username + " </font> </font> \n\n "
|
|
||||||
that.log(`\n***********开始【动动账号${$.index}】${$.nickName || $.UserName}********\n`);
|
|
||||||
if (!$.isLogin) {
|
|
||||||
$.msg($.name, `【提示】cookie已失效`, `动动账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
|
|
||||||
|
|
||||||
if ($.isNode()) {
|
|
||||||
await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `动动账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
|
|
||||||
}
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
await jdDailyEgg();
|
|
||||||
}
|
|
||||||
message = message +"----\n\n"
|
|
||||||
}
|
|
||||||
})()
|
|
||||||
.catch((e) => {
|
|
||||||
$.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
that.log(message)
|
|
||||||
postToDingTalk(message)
|
|
||||||
$.done();
|
|
||||||
})
|
|
||||||
async function jdDailyEgg() {
|
|
||||||
await toDailyHome()
|
|
||||||
await toWithdraw()
|
|
||||||
await toGoldExchange();
|
|
||||||
}
|
|
||||||
function toGoldExchange() {
|
|
||||||
return new Promise(async resolve => {
|
|
||||||
const body = {
|
|
||||||
"timeSign": 0,
|
|
||||||
"environment": "jrApp",
|
|
||||||
"riskDeviceInfo": "{}"
|
|
||||||
}
|
|
||||||
$.post(taskUrl('toGoldExchange', body), (err, resp, data) => {
|
|
||||||
try {
|
|
||||||
if (err) {
|
|
||||||
that.log(`${JSON.stringify(err)}`)
|
|
||||||
that.log(`${$.name} API请求失败,请检查网路重试`)
|
|
||||||
} else {
|
|
||||||
if (data) {
|
|
||||||
// that.log(data)
|
|
||||||
data = JSON.parse(data);
|
|
||||||
if (data.resultCode === 0) {
|
|
||||||
if (data.resultData.code === '0000') {
|
|
||||||
that.log(`兑换金币:${data.resultData.data.cnumber}`);
|
|
||||||
message += "<font color=\'#778899\' size=2>" + `兑换金币:${data.resultData.data.cnumber}` + "</font>\n\n"
|
|
||||||
that.log(`当前总金币:${data.resultData.data.goldTotal}`);
|
|
||||||
message += "<font color=\'#778899\' size=2>" + `当前总金币:${data.resultData.data.goldTotal}` +"</font>\n\n"
|
|
||||||
} else if (data.resultData.code !== '0000') {
|
|
||||||
that.log(`兑换金币失败:${data.resultData.msg}`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
that.log(`动动服务器返回空数据`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
$.logErr(e, resp)
|
|
||||||
} finally {
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
function toWithdraw() {
|
|
||||||
return new Promise(async resolve => {
|
|
||||||
const body = {
|
|
||||||
"timeSign": 0,
|
|
||||||
"environment": "jrApp",
|
|
||||||
"riskDeviceInfo": "{}"
|
|
||||||
}
|
|
||||||
$.post(taskUrl('toWithdraw', body), (err, resp, data) => {
|
|
||||||
try {
|
|
||||||
if (err) {
|
|
||||||
that.log(`${JSON.stringify(err)}`)
|
|
||||||
that.log(`${$.name} API请求失败,请检查网路重试`)
|
|
||||||
} else {
|
|
||||||
if (data) {
|
|
||||||
// that.log(data)
|
|
||||||
data = JSON.parse(data);
|
|
||||||
if (data.resultCode === 0) {
|
|
||||||
if (data.resultData.code === '0000') {
|
|
||||||
message += "<font color=\'#778899\' size=2>" +`收取鹅蛋:${data.resultData.data.eggTotal}个成功` + "</font>\n\n"
|
|
||||||
message += "<font color=\'#778899\' size=2>" + `当前总鹅蛋数量:${data.resultData.data.userLevelDto.userHaveEggNum}` + "</font>\n\n"
|
|
||||||
that.log(`收取鹅蛋:${data.resultData.data.eggTotal}个成功`);
|
|
||||||
that.log(`当前总鹅蛋数量:${data.resultData.data.userLevelDto.userHaveEggNum}`);
|
|
||||||
} else if (data.resultData.code !== '0000') {
|
|
||||||
that.log(`收取鹅蛋失败:${data.resultData.msg}`)
|
|
||||||
message += "<font color=\'#778899\' size=2>" + `收取鹅蛋失败:${data.resultData.msg}` + "</font>\n\n"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
that.log(`动动服务器返回空数据`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
$.logErr(e, resp)
|
|
||||||
} finally {
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
function toDailyHome() {
|
|
||||||
return new Promise(async resolve => {
|
|
||||||
const body = {
|
|
||||||
"timeSign": 0,
|
|
||||||
"environment": "jrApp",
|
|
||||||
"riskDeviceInfo": "{}"
|
|
||||||
}
|
|
||||||
$.post(taskUrl('toDailyHome', body), (err, resp, data) => {
|
|
||||||
try {
|
|
||||||
if (err) {
|
|
||||||
that.log(`${JSON.stringify(err)}`)
|
|
||||||
that.log(`${$.name} API请求失败,请检查网路重试`)
|
|
||||||
} else {
|
|
||||||
if (data) {
|
|
||||||
// that.log(data)
|
|
||||||
data = JSON.parse(data);
|
|
||||||
} else {
|
|
||||||
that.log(`动动服务器返回空数据`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
$.logErr(e, resp)
|
|
||||||
} finally {
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
function TotalBean() {
|
|
||||||
return new Promise(async resolve => {
|
|
||||||
const options = {
|
|
||||||
"url": `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`,
|
|
||||||
"headers": {
|
|
||||||
"Accept": "application/json,text/plain, */*",
|
|
||||||
"Content-Type": "application/x-www-form-urlencoded",
|
|
||||||
"Accept-Language": "zh-cn",
|
|
||||||
"Connection": "keep-alive",
|
|
||||||
"Cookie": cookie,
|
|
||||||
"Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2",
|
|
||||||
"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.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$.post(options, (err, resp, data) => {
|
|
||||||
try {
|
|
||||||
if (err) {
|
|
||||||
that.log(`${JSON.stringify(err)}`)
|
|
||||||
that.log(`${$.name} API请求失败,请检查网路重试`)
|
|
||||||
} else {
|
|
||||||
if (data) {
|
|
||||||
data = JSON.parse(data);
|
|
||||||
if (data['retcode'] === 13) {
|
|
||||||
$.isLogin = false; //cookie过期
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (data['retcode'] === 0) {
|
|
||||||
$.nickName = (data['base'] && data['base'].nickname) || $.UserName;
|
|
||||||
} else {
|
|
||||||
$.nickName = $.UserName
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
that.log(`动动服务器返回空数据`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
$.logErr(e, resp)
|
|
||||||
} finally {
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
function taskUrl(function_id, body) {
|
|
||||||
return {
|
|
||||||
url: `${JD_API_HOST}/${function_id}`,
|
|
||||||
body: `reqData=${encodeURIComponent(JSON.stringify(body))}`,
|
|
||||||
headers: {
|
|
||||||
'Accept' : `application/json`,
|
|
||||||
'Origin' : `https://uua.jr.jd.com`,
|
|
||||||
'Cookie' : cookie,
|
|
||||||
'Content-Type' : `application/x-www-form-urlencoded;charset=UTF-8`,
|
|
||||||
'Host' : `ms.jr.jd.com`,
|
|
||||||
'Connection' : `keep-alive`,
|
|
||||||
'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.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"),
|
|
||||||
'Referer' : `https://uua.jr.jd.com/uc-fe-wxgrowing/moneytree/index`,
|
|
||||||
'Accept-Language' : `zh-cn`
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function jsonParse(str) {
|
|
||||||
if (typeof str == "string") {
|
|
||||||
try {
|
|
||||||
return JSON.parse(str);
|
|
||||||
} catch (e) {
|
|
||||||
that.log(e);
|
|
||||||
$.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//我加的函数
|
|
||||||
function postToDingTalk(messgae) {
|
|
||||||
const dingtalk = "https://oapi.dingtalk.com/robot/send?access_token=18444b555747aad3381bc1d1e3dea72b03158e152a846f818d82a1ca946bd430"
|
|
||||||
|
|
||||||
const message1 = "" + messgae
|
|
||||||
that.log(messgae)
|
|
||||||
|
|
||||||
const body = {
|
|
||||||
"msgtype": "markdown",
|
|
||||||
"markdown": {
|
|
||||||
"title":"天天提鹅",
|
|
||||||
"text": message1
|
|
||||||
},
|
|
||||||
"at": {
|
|
||||||
"atMobiles": [],
|
|
||||||
"isAtAll": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$.post(toDingtalk(dingtalk,JSON.stringify(body)), (data,status,xhr)=>{
|
|
||||||
try {
|
|
||||||
that.log(resp)
|
|
||||||
that.log(data)
|
|
||||||
if (err) {
|
|
||||||
that.log(JSON.stringify(err));
|
|
||||||
$.logErr(err);
|
|
||||||
} else {
|
|
||||||
if (safeGet(data)) {
|
|
||||||
$.duckRes = JSON.parse(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
$.logErr(e, resp)
|
|
||||||
} finally {
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
},"json")
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function toDingtalk(urlmain, bodyMain) {
|
|
||||||
return {
|
|
||||||
url: urlmain,
|
|
||||||
body:bodyMain,
|
|
||||||
headers: { 'Content-Type': 'application/json;charset=utf-8' },
|
|
||||||
timeout: 10000,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getPic(){
|
|
||||||
let code = ["1.gif","2.png","3.png","4.png","5.gif","6.gif","7.gif","8.gif","9.gif","10.png","11.png"]
|
|
||||||
let address = "\n\n )
|
|
||||||
address = address + code[pos] + ")"
|
|
||||||
return address
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,827 @@
|
|||||||
|
//开团赚京豆 - 赚京豆
|
||||||
|
const notify = $.isNode() ? require('./sendNotify') : '';
|
||||||
|
//Node.js用户请在jdCookie.js处填写京东ck;
|
||||||
|
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
|
||||||
|
let jdNotify = true;//是否关闭通知,false打开通知推送,true关闭通知推送
|
||||||
|
const randomCount = $.isNode() ? 0 : 5;
|
||||||
|
//IOS等用户直接用NobyDa的jd cookie
|
||||||
|
let cookiesArr = [], cookie = '', message;
|
||||||
|
$.tuanList = [];
|
||||||
|
let roleMap = {
|
||||||
|
"jd_4521b375ebb5d": "锟子怪",
|
||||||
|
"jd_542c10c0222bc": "康子怪",
|
||||||
|
"jd_66dcb31363ef6": "涛子怪",
|
||||||
|
"jd_45d917547c763": "跑腿小怪",
|
||||||
|
"417040678_m": "斌子怪",
|
||||||
|
"jd_73d88459d908e": "杰杰子",
|
||||||
|
"381550701lol": "漪漪子",
|
||||||
|
"jd_4333d5dc1ac5f": "舒楠子",
|
||||||
|
"jd_66ea783827d30": "军子",
|
||||||
|
"jd_4311ac0ff4456": "居子"
|
||||||
|
}
|
||||||
|
let dingtalk = "https://oapi.dingtalk.com/robot/send?access_token=d2b6042cb38f0df63e20797c002208d2710104750c18a1dc84d54106a859a3f0"
|
||||||
|
|
||||||
|
if ($.isNode()) {
|
||||||
|
Object.keys(jdCookieNode).forEach((item) => {
|
||||||
|
cookiesArr.push(jdCookieNode[item])
|
||||||
|
})
|
||||||
|
if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') that.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);
|
||||||
|
}
|
||||||
|
const JD_API_HOST = 'https://api.m.jd.com/api';
|
||||||
|
!(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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
message += "<font color=\'#FFA500\'>[通知] </font><font color=\'#006400\' size='3'>赚京豆</font> \n\n"
|
||||||
|
for (let i = 0; i < cookiesArr.length; i++) {
|
||||||
|
if (cookiesArr[i]) {
|
||||||
|
cookie = cookiesArr[i];
|
||||||
|
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
|
||||||
|
$.index = i + 1;
|
||||||
|
$.isLogin = true;
|
||||||
|
$.nickName = '';
|
||||||
|
await TotalBean();
|
||||||
|
|
||||||
|
if (roleMap[username] != undefined) {
|
||||||
|
username = roleMap[username]
|
||||||
|
}
|
||||||
|
//加上名称
|
||||||
|
message = message + "<font color=\'#778899\' size=2>【羊毛姐妹】<font color=\'#FFA500\' size=3>" + username + " </font> </font> \n\n "
|
||||||
|
|
||||||
|
|
||||||
|
that.log(`\n******开始【京东账号${$.index}】${$.nickName || $.UserName}*********\n`);
|
||||||
|
if (!$.isLogin) {
|
||||||
|
$.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, { "open-url": "https://bean.m.jd.com/bean/signIndex.action" });
|
||||||
|
|
||||||
|
if ($.isNode()) {
|
||||||
|
await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
|
||||||
|
}
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
await main();
|
||||||
|
}
|
||||||
|
message += "----\n\n"
|
||||||
|
|
||||||
|
}
|
||||||
|
postToDingTalk(message)
|
||||||
|
message += "<font color=\'#FFA500\'>[通知] </font><font color=\'#006400\' size='3'>赚京豆</font> \n\n"
|
||||||
|
|
||||||
|
that.log(`\n\n内部互助 【赚京豆(微信小程序)-瓜分京豆】活动(优先内部账号互助(需内部cookie数量大于${$.assistNum || 4}个)\n`)
|
||||||
|
for (let i = 0; i < cookiesArr.length; i++) {
|
||||||
|
$.canHelp = true
|
||||||
|
if (cookiesArr[i]) {
|
||||||
|
cookie = cookiesArr[i];
|
||||||
|
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
|
||||||
|
if ($.canHelp && (cookiesArr.length > $.assistNum)) {
|
||||||
|
if ($.tuanList.length) that.log(`开始账号内部互助 赚京豆-瓜分京豆 活动,优先内部账号互助`)
|
||||||
|
for (let j = 0; j < $.tuanList.length; ++j) {
|
||||||
|
that.log(`账号 ${$.UserName} 开始给 【${$.tuanList[j]['assistedPinEncrypted']}】助力`)
|
||||||
|
message += "<font color=\'#FFA500\'>" + `账号 ${$.UserName} 开始给 【${$.tuanList[j]['assistedPinEncrypted']}】助力` + "</font> \n\n"
|
||||||
|
await helpFriendTuan($.tuanList[j])
|
||||||
|
if (!$.canHelp) break
|
||||||
|
await $.wait(200)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})()
|
||||||
|
.catch((e) => {
|
||||||
|
$.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
postToDingTalk(message)
|
||||||
|
$.done();
|
||||||
|
})
|
||||||
|
|
||||||
|
function showMsg() {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
if (message) $.msg($.name, '', `【京东账号${$.index}】${$.nickName}\n${message}`);
|
||||||
|
resolve()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
async function main() {
|
||||||
|
try {
|
||||||
|
// await userSignIn();//赚京豆-签到领京豆
|
||||||
|
await vvipTask();//赚京豆-加速领京豆
|
||||||
|
await distributeBeanActivity();//赚京豆-瓜分京豆
|
||||||
|
await showMsg();
|
||||||
|
} catch (e) {
|
||||||
|
$.logErr(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//================赚京豆-签到领京豆===================
|
||||||
|
let signFlag = 0;
|
||||||
|
function userSignIn() {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
const body = { "activityId": "ccd8067defcd4787871b7f0c96fcbf5c", "inviterId": "", "channel": "MiniProgram" };
|
||||||
|
$.get(taskUrl('userSignIn', body), async (err, resp, data) => {
|
||||||
|
try {
|
||||||
|
if (err) {
|
||||||
|
that.log(`${JSON.stringify(err)}`)
|
||||||
|
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||||
|
} else {
|
||||||
|
if (safeGet(data)) {
|
||||||
|
data = JSON.parse(data);
|
||||||
|
if (data.code === 0) {
|
||||||
|
signFlag = 0;
|
||||||
|
that.log(`${$.name}今日签到成功`);
|
||||||
|
if (data.data) {
|
||||||
|
let { alreadySignDays, beanTotalNum, todayPrize, eachDayPrize } = data.data;
|
||||||
|
|
||||||
|
message += "<font color=\'#FFA500\'>" + `【第${alreadySignDays}日签到】成功,获得${todayPrize.beanAmount}京豆 🐶\n` + "</font> \n\n"
|
||||||
|
if (alreadySignDays === 7) alreadySignDays = 0;
|
||||||
|
message += "<font color=\'#FFA500\'>" + `【明日签到】可获得${eachDayPrize[alreadySignDays].beanAmount}京豆 🐶\n` + "</font> \n\n"
|
||||||
|
message += "<font color=\'#FFA500\'>" + `【累计获得】${beanTotalNum}京豆 🐶` + "</font> \n\n"
|
||||||
|
}
|
||||||
|
} else if (data.code === 81) {
|
||||||
|
that.log(`【签到】失败,今日已签到`)
|
||||||
|
// message += `【签到】失败,今日已签到`;
|
||||||
|
} else if (data.code === 6) {
|
||||||
|
//此处有时会遇到 服务器繁忙 导致签到失败,故重复三次签到
|
||||||
|
$.log(`${$.name}签到失败${signFlag}:${data.msg}`);
|
||||||
|
if (signFlag < 3) {
|
||||||
|
signFlag++;
|
||||||
|
await userSignIn();
|
||||||
|
}
|
||||||
|
} else if (data.code === 66) {
|
||||||
|
//此处有时会遇到 服务器繁忙 导致签到失败,故重复三次签到
|
||||||
|
$.log(`${$.name}签到失败:${data.msg}`);
|
||||||
|
message += `【签到】失败,${data.msg}`;
|
||||||
|
} else {
|
||||||
|
that.log(`异常:${JSON.stringify(data)}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
$.logErr(e, resp)
|
||||||
|
} finally {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
//================赚京豆-加速领京豆===================
|
||||||
|
async function vvipTask() {
|
||||||
|
try {
|
||||||
|
$.vvipFlag = false;
|
||||||
|
$.rewardBeanNum = 0;
|
||||||
|
await vvipscdp_raffle_auto_send_bean();
|
||||||
|
await pg_channel_page_data();
|
||||||
|
if (!$.vvipFlag) return
|
||||||
|
await vviptask_receive_list();//做任务
|
||||||
|
await $.wait(1000)
|
||||||
|
await pg_channel_page_data();
|
||||||
|
} catch (e) {
|
||||||
|
$.logErr(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function pg_channel_page_data() {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
const body = { "paramData": { "token": "3b9f3e0d-7a67-4be3-a05f-9b076cb8ed6a" } };
|
||||||
|
$.get(taskUrl('pg_channel_page_data', body), async (err, resp, data) => {
|
||||||
|
try {
|
||||||
|
if (err) {
|
||||||
|
that.log(`${JSON.stringify(err)}`)
|
||||||
|
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||||
|
} else {
|
||||||
|
if (safeGet(data)) {
|
||||||
|
data = JSON.parse(data);
|
||||||
|
if (data['success']) {
|
||||||
|
if (data['data'] && data['data']['floorInfoList']) {
|
||||||
|
const floorInfo = data['data']['floorInfoList'].filter(vo => !!vo && vo['code'] === "SWAT_RED_PACKET_ACT_INFO")[0];
|
||||||
|
if (floorInfo.hasOwnProperty('token') && floorInfo['floorData'].hasOwnProperty('userActivityInfo')) {
|
||||||
|
$.token = floorInfo['token'];
|
||||||
|
const { activityExistFlag, redPacketOpenFlag, redPacketRewardTakeFlag, beanAmountTakeMinLimit, currActivityBeanAmount } = floorInfo['floorData']['userActivityInfo'];
|
||||||
|
if (activityExistFlag) {
|
||||||
|
if (!redPacketOpenFlag) {
|
||||||
|
that.log(`【做任务 天天领京豆】 活动未开启,现在去开启此活动\n`)
|
||||||
|
await openRedPacket($.token);
|
||||||
|
} else {
|
||||||
|
if (currActivityBeanAmount < beanAmountTakeMinLimit) $.vvipFlag = true;
|
||||||
|
if (redPacketRewardTakeFlag) {
|
||||||
|
that.log(`【做任务 天天领京豆】 ${beanAmountTakeMinLimit}京豆已领取`);
|
||||||
|
} else {
|
||||||
|
if (currActivityBeanAmount >= beanAmountTakeMinLimit) {
|
||||||
|
//领取200京豆
|
||||||
|
that.log(`【做任务 天天领京豆】 累计到${beanAmountTakeMinLimit}京豆可领取到京东账户\n【做任务 天天领京豆】当前进度:${currActivityBeanAmount}/${beanAmountTakeMinLimit}`)
|
||||||
|
that.log(`【做任务 天天领京豆】 当前已到领取京豆条件。开始领取京豆\n`);
|
||||||
|
await pg_interact_interface_invoke($.token);
|
||||||
|
} else {
|
||||||
|
that.log(`【做任务 天天领京豆】 累计到${beanAmountTakeMinLimit}京豆可领取到京东账户\n【做任务 天天领京豆】当前进度:${currActivityBeanAmount}/${beanAmountTakeMinLimit}`)
|
||||||
|
that.log(`【做任务 天天领京豆】 当前未达到领取京豆条件。开始做任务\n`);
|
||||||
|
await pg_channel_page_data();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
that.log(`【做任务 天天领京豆】 活动已下线`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
that.log(`pg_channel_page_data: ${data.message}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
$.logErr(e, resp)
|
||||||
|
} finally {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
//抽奖
|
||||||
|
function vvipscdp_raffle_auto_send_bean() {
|
||||||
|
const body = { "channelCode": "swat_system_id" }
|
||||||
|
const options = {
|
||||||
|
url: `${JD_API_HOST}api?functionId=vvipscdp_raffle_auto_send_bean&body=${escape(JSON.stringify(body))}&appid=lottery_drew&t=${new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 8 * 60 * 60 * 1000}`,
|
||||||
|
headers: {
|
||||||
|
"Accept": "*/*",
|
||||||
|
"Accept-Encoding": "gzip, deflate, br",
|
||||||
|
"Accept-Language": "zh-cn",
|
||||||
|
"Connection": "keep-alive",
|
||||||
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
|
"Host": "api.m.jd.com",
|
||||||
|
"Referer": "https://lottery.m.jd.com/",
|
||||||
|
"Cookie": cookie,
|
||||||
|
"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.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
$.post(options, async (err, resp, data) => {
|
||||||
|
try {
|
||||||
|
if (err) {
|
||||||
|
that.log(`${JSON.stringify(err)}`)
|
||||||
|
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||||
|
} else {
|
||||||
|
if (safeGet(data)) {
|
||||||
|
data = JSON.parse(data);
|
||||||
|
if (data['success']) {
|
||||||
|
if (data.data && data.data['sendBeanAmount']) {
|
||||||
|
that.log(`【做任务 天天领京豆】 送成功:获得${data.data['sendBeanAmount']}京豆`)
|
||||||
|
$.rewardBeanNum += data.data['sendBeanAmount'];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
that.log("【做任务 天天领京豆】 送京异常:" + data.message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
$.logErr(e, resp)
|
||||||
|
} finally {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function vviptask_receive_list() {
|
||||||
|
$.taskData = [];
|
||||||
|
const body = { "channel": "SWAT_RED_PACKET", "systemId": "19", "withAutoAward": 1 }
|
||||||
|
const options = {
|
||||||
|
url: `${JD_API_HOST}?functionId=vviptask_receive_list&body=${escape(JSON.stringify(body))}&appid=swat_miniprogram&fromType=wxapp×tamp=${new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 8 * 60 * 60 * 1000}`,
|
||||||
|
headers: {
|
||||||
|
"Accept": "*/*",
|
||||||
|
"Accept-Encoding": "gzip, deflate, br",
|
||||||
|
"Accept-Language": "zh-cn",
|
||||||
|
"Connection": "keep-alive",
|
||||||
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
|
"Host": "api.m.jd.com",
|
||||||
|
"Referer": "https://servicewechat.com/wxa5bf5ee667d91626/108/page-frame.html",
|
||||||
|
"Cookie": cookie,
|
||||||
|
"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.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
$.post(options, async (err, resp, data) => {
|
||||||
|
try {
|
||||||
|
if (err) {
|
||||||
|
that.log(`${JSON.stringify(err)}`)
|
||||||
|
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||||
|
} else {
|
||||||
|
if (safeGet(data)) {
|
||||||
|
data = JSON.parse(data);
|
||||||
|
if (data['success']) {
|
||||||
|
$.taskData = data['data'].filter(vo => !!vo && vo['taskDataStatus'] !== 3);
|
||||||
|
for (let item of $.taskData) {
|
||||||
|
that.log(`\n领取 ${item['title']} 任务`)
|
||||||
|
await vviptask_receive_getone(item['id']);
|
||||||
|
await $.wait(1000);
|
||||||
|
that.log(`去完成 ${item['title']} 任务`)
|
||||||
|
await vviptask_reach_task(item['id']);
|
||||||
|
that.log(`领取 ${item['title']} 任务奖励\n`)
|
||||||
|
await vviptask_reward_receive(item['id']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
$.logErr(e, resp)
|
||||||
|
} finally {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
//领取任务
|
||||||
|
function vviptask_receive_getone(ids) {
|
||||||
|
const body = { "channel": "SWAT_RED_PACKET", "systemId": "19", ids }
|
||||||
|
const options = {
|
||||||
|
url: `${JD_API_HOST}?functionId=vviptask_receive_getone&body=${escape(JSON.stringify(body))}&appid=swat_miniprogram&fromType=wxapp×tamp=${new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 8 * 60 * 60 * 1000}`,
|
||||||
|
headers: {
|
||||||
|
"Accept": "*/*",
|
||||||
|
"Accept-Encoding": "gzip, deflate, br",
|
||||||
|
"Accept-Language": "zh-cn",
|
||||||
|
"Connection": "keep-alive",
|
||||||
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
|
"Host": "api.m.jd.com",
|
||||||
|
"Referer": "https://servicewechat.com/wxa5bf5ee667d91626/108/page-frame.html",
|
||||||
|
"Cookie": cookie,
|
||||||
|
"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.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
$.post(options, async (err, resp, data) => {
|
||||||
|
try {
|
||||||
|
if (err) {
|
||||||
|
that.log(`${JSON.stringify(err)}`)
|
||||||
|
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
$.logErr(e, resp)
|
||||||
|
} finally {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
//做任务
|
||||||
|
function vviptask_reach_task(taskIdEncrypted) {
|
||||||
|
const body = { "channel": "SWAT_RED_PACKET", "systemId": "19", taskIdEncrypted }
|
||||||
|
const options = {
|
||||||
|
url: `${JD_API_HOST}?functionId=vviptask_reach_task&body=${escape(JSON.stringify(body))}&appid=swat_miniprogram&fromType=wxapp×tamp=${new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 8 * 60 * 60 * 1000}`,
|
||||||
|
headers: {
|
||||||
|
"Accept": "*/*",
|
||||||
|
"Accept-Encoding": "gzip, deflate, br",
|
||||||
|
"Accept-Language": "zh-cn",
|
||||||
|
"Connection": "keep-alive",
|
||||||
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
|
"Host": "api.m.jd.com",
|
||||||
|
"Referer": "https://servicewechat.com/wxa5bf5ee667d91626/108/page-frame.html",
|
||||||
|
"Cookie": cookie,
|
||||||
|
"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.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
$.post(options, (err, resp, data) => {
|
||||||
|
try {
|
||||||
|
if (err) {
|
||||||
|
that.log(`${JSON.stringify(err)}`)
|
||||||
|
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||||
|
} else {
|
||||||
|
// that.log(`做任务任务:${data}`)
|
||||||
|
// if (safeGet(data)) {
|
||||||
|
// data = JSON.parse(data);
|
||||||
|
// if (data['success']) {
|
||||||
|
// $.taskData = data['data'];
|
||||||
|
// for (let item of $.taskData) {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
$.logErr(e, resp)
|
||||||
|
} finally {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
//领取做完任务后的奖励
|
||||||
|
function vviptask_reward_receive(idEncKey) {
|
||||||
|
const body = { "channel": "SWAT_RED_PACKET", "systemId": "19", idEncKey }
|
||||||
|
const options = {
|
||||||
|
url: `${JD_API_HOST}?functionId=vviptask_reward_receive&body=${escape(JSON.stringify(body))}&appid=swat_miniprogram&fromType=wxapp×tamp=${new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 8 * 60 * 60 * 1000}`,
|
||||||
|
headers: {
|
||||||
|
"Accept": "*/*",
|
||||||
|
"Accept-Encoding": "gzip, deflate, br",
|
||||||
|
"Accept-Language": "zh-cn",
|
||||||
|
"Connection": "keep-alive",
|
||||||
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
|
"Host": "api.m.jd.com",
|
||||||
|
"Referer": "https://servicewechat.com/wxa5bf5ee667d91626/108/page-frame.html",
|
||||||
|
"Cookie": cookie,
|
||||||
|
"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.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
$.post(options, (err, resp, data) => {
|
||||||
|
try {
|
||||||
|
if (err) {
|
||||||
|
that.log(`${JSON.stringify(err)}`)
|
||||||
|
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||||
|
} else {
|
||||||
|
// that.log(`做任务任务:${data}`)
|
||||||
|
// if (safeGet(data)) {
|
||||||
|
// data = JSON.parse(data);
|
||||||
|
// if (data['success']) {
|
||||||
|
// $.taskData = data['data'];
|
||||||
|
// for (let item of $.taskData) {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
$.logErr(e, resp)
|
||||||
|
} finally {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
//领取200京豆
|
||||||
|
function pg_interact_interface_invoke(floorToken) {
|
||||||
|
const body = { floorToken, "dataSourceCode": "takeReward", "argMap": {} }
|
||||||
|
const options = {
|
||||||
|
url: `${JD_API_HOST}?functionId=pg_interact_interface_invoke&body=${escape(JSON.stringify(body))}&appid=swat_miniprogram&fromType=wxapp×tamp=${new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 8 * 60 * 60 * 1000}`,
|
||||||
|
headers: {
|
||||||
|
"Accept": "*/*",
|
||||||
|
"Accept-Encoding": "gzip, deflate, br",
|
||||||
|
"Accept-Language": "zh-cn",
|
||||||
|
"Connection": "keep-alive",
|
||||||
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
|
"Host": "api.m.jd.com",
|
||||||
|
"Referer": "https://servicewechat.com/wxa5bf5ee667d91626/108/page-frame.html",
|
||||||
|
"Cookie": cookie,
|
||||||
|
"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.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
$.post(options, (err, resp, data) => {
|
||||||
|
try {
|
||||||
|
if (err) {
|
||||||
|
that.log(`${JSON.stringify(err)}`)
|
||||||
|
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||||
|
} else {
|
||||||
|
if (safeGet(data)) {
|
||||||
|
data = JSON.parse(data);
|
||||||
|
if (data['success']) {
|
||||||
|
that.log(`【做任务 天天领京豆】${data['data']['rewardBeanAmount']}京豆领取成功`);
|
||||||
|
$.rewardBeanNum += data['data']['rewardBeanAmount'];
|
||||||
|
message += "<font color=\'#FFA500\'>" + `【做任务 天天领京豆】${data['data']['rewardBeanAmount']}京豆领取成功` + "</font> \n\n"
|
||||||
|
} else {
|
||||||
|
that.log(`【做任务 天天领京豆】${data.message}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
$.logErr(e, resp)
|
||||||
|
} finally {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function openRedPacket(floorToken) {
|
||||||
|
const body = { floorToken, "dataSourceCode": "openRedPacket", "argMap": {} }
|
||||||
|
const options = {
|
||||||
|
url: `${JD_API_HOST}?functionId=pg_interact_interface_invoke&body=${escape(JSON.stringify(body))}&appid=swat_miniprogram&fromType=wxapp×tamp=${new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 8 * 60 * 60 * 1000}`,
|
||||||
|
headers: {
|
||||||
|
"Accept": "*/*",
|
||||||
|
"Accept-Encoding": "gzip, deflate, br",
|
||||||
|
"Accept-Language": "zh-cn",
|
||||||
|
"Connection": "keep-alive",
|
||||||
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
|
"Host": "api.m.jd.com",
|
||||||
|
"Referer": "https://servicewechat.com/wxa5bf5ee667d91626/108/page-frame.html",
|
||||||
|
"Cookie": cookie,
|
||||||
|
"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.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
$.post(options, (err, resp, data) => {
|
||||||
|
try {
|
||||||
|
if (err) {
|
||||||
|
that.log(`${JSON.stringify(err)}`)
|
||||||
|
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||||
|
} else {
|
||||||
|
if (safeGet(data)) {
|
||||||
|
data = JSON.parse(data);
|
||||||
|
if (data['success']) {
|
||||||
|
that.log(`活动开启成功,初始:${data.data && data.data['activityBeanInitAmount']}京豆`)
|
||||||
|
$.vvipFlag = true;
|
||||||
|
} else {
|
||||||
|
that.log(data.message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
$.logErr(e, resp)
|
||||||
|
} finally {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
//================赚京豆-加速领京豆===========END========
|
||||||
|
//================赚京豆开团===========
|
||||||
|
async function distributeBeanActivity() {
|
||||||
|
try {
|
||||||
|
$.tuan = ''
|
||||||
|
$.hasOpen = false;
|
||||||
|
$.assistStatus = 0;
|
||||||
|
await getUserTuanInfo()
|
||||||
|
if (!$.tuan && ($.assistStatus === 3 || $.assistStatus === 2 || $.assistStatus === 0) && $.canStartNewAssist) {
|
||||||
|
that.log(`准备再次开团`)
|
||||||
|
await openTuan()
|
||||||
|
if ($.hasOpen) await getUserTuanInfo()
|
||||||
|
}
|
||||||
|
if ($.tuan && $.tuan.hasOwnProperty('assistedPinEncrypted') && $.assistStatus !== 3) {
|
||||||
|
$.tuanList.push($.tuan);
|
||||||
|
const code = Object.assign($.tuan, { "time": Date.now() });
|
||||||
|
$.post({
|
||||||
|
url: `http://go.chiang.fun/autocommit`,
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
body: JSON.stringify({ "act": "zuan", code }),
|
||||||
|
timeout: 30000
|
||||||
|
}, (err, resp, res) => {
|
||||||
|
that.log("提交开团码:" + res);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
$.logErr(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function helpFriendTuan(body) {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
const data = {
|
||||||
|
"activityIdEncrypted": body['activityIdEncrypted'],
|
||||||
|
"assistStartRecordId": body['assistStartRecordId'],
|
||||||
|
"channel": body['channel'],
|
||||||
|
}
|
||||||
|
delete body['time'];
|
||||||
|
$.get(taskTuanUrl("vvipclub_distributeBean_assist", body), async (err, resp, data) => {
|
||||||
|
try {
|
||||||
|
if (err) {
|
||||||
|
that.log(`${JSON.stringify(err)}`)
|
||||||
|
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||||
|
} else {
|
||||||
|
if (safeGet(data)) {
|
||||||
|
data = JSON.parse(data);
|
||||||
|
if (data.success) {
|
||||||
|
that.log('助力结果:助力成功\n')
|
||||||
|
} else {
|
||||||
|
if (data.resultCode === '9200008') that.log('助力结果:不能助力自己\n')
|
||||||
|
else if (data.resultCode === '9200011') that.log('助力结果:已经助力过\n')
|
||||||
|
else if (data.resultCode === '2400205') that.log('助力结果:团已满\n')
|
||||||
|
else if (data.resultCode === '2400203') { that.log('助力结果:助力次数已耗尽\n'); $.canHelp = false }
|
||||||
|
else if (data.resultCode === '9000000') { that.log('助力结果:活动火爆,跳出\n'); $.canHelp = false }
|
||||||
|
else that.log(`助力结果:未知错误\n${JSON.stringify(data)}\n\n`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
$.logErr(e, resp)
|
||||||
|
} finally {
|
||||||
|
resolve(data);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function getUserTuanInfo() {
|
||||||
|
let body = { "paramData": { "channel": "FISSION_BEAN" } }
|
||||||
|
return new Promise(resolve => {
|
||||||
|
$.get(taskTuanUrl("distributeBeanActivityInfo", body), async (err, resp, data) => {
|
||||||
|
try {
|
||||||
|
if (err) {
|
||||||
|
that.log(`${JSON.stringify(err)}`)
|
||||||
|
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||||
|
} else {
|
||||||
|
if (safeGet(data)) {
|
||||||
|
data = JSON.parse(data);
|
||||||
|
if (data['success']) {
|
||||||
|
$.log(`\n\n当前【赚京豆(微信小程序)-瓜分京豆】能否再次开团: ${data.data.canStartNewAssist ? '可以' : '否'}`)
|
||||||
|
that.log(`assistStatus ${data.data.assistStatus}`)
|
||||||
|
if (data.data.assistStatus === 1 && !data.data.canStartNewAssist) {
|
||||||
|
that.log(`已开团(未达上限),但团成员人未满\n\n`)
|
||||||
|
} else if (data.data.assistStatus === 3 && data.data.canStartNewAssist) {
|
||||||
|
that.log(`已开团(未达上限),团成员人已满\n\n`)
|
||||||
|
} else if (data.data.assistStatus === 3 && !data.data.canStartNewAssist) {
|
||||||
|
that.log(`今日开团已达上限,且当前团成员人已满\n\n`)
|
||||||
|
}
|
||||||
|
if (data.data && !data.data.canStartNewAssist) {
|
||||||
|
$.tuan = {
|
||||||
|
"activityIdEncrypted": data.data.id,
|
||||||
|
"assistStartRecordId": data.data.assistStartRecordId,
|
||||||
|
"assistedPinEncrypted": data.data.encPin,
|
||||||
|
"channel": "FISSION_BEAN"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$.tuanActId = data.data.id;
|
||||||
|
$.assistNum = data['data']['assistNum'] || 4;
|
||||||
|
$.assistStatus = data['data']['assistStatus'];
|
||||||
|
$.canStartNewAssist = data['data']['canStartNewAssist'];
|
||||||
|
} else {
|
||||||
|
$.tuan = true;//活动火爆
|
||||||
|
that.log(`赚京豆(微信小程序)-瓜分京豆】获取【活动信息失败 ${JSON.stringify(data)}\n`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
$.logErr(e, resp)
|
||||||
|
} finally {
|
||||||
|
resolve(data);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function openTuan() {
|
||||||
|
let body = { "activityIdEncrypted": $.tuanActId, "channel": "FISSION_BEAN" }
|
||||||
|
return new Promise(resolve => {
|
||||||
|
$.get(taskTuanUrl("vvipclub_distributeBean_startAssist", body), async (err, resp, data) => {
|
||||||
|
try {
|
||||||
|
if (err) {
|
||||||
|
that.log(`${JSON.stringify(err)}`)
|
||||||
|
that.log(`${$.name} API请求失败,请检查网路重试`)
|
||||||
|
} else {
|
||||||
|
if (safeGet(data)) {
|
||||||
|
data = JSON.parse(data);
|
||||||
|
if (data['success']) {
|
||||||
|
that.log(`【赚京豆(微信小程序)-瓜分京豆】开团成功`)
|
||||||
|
$.hasOpen = true
|
||||||
|
} else {
|
||||||
|
that.log(`\n开团失败:${JSON.stringify(data)}\n`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
$.logErr(e, resp)
|
||||||
|
} finally {
|
||||||
|
resolve(data);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//======================赚京豆开团===========END=====
|
||||||
|
function taskUrl(function_id, body = {}) {
|
||||||
|
return {
|
||||||
|
url: `${JD_API_HOST}?functionId=${function_id}&body=${escape(JSON.stringify(body))}&appid=swat_miniprogram&osVersion=5.0.0&clientVersion=3.1.3&fromType=wxapp×tamp=${new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 8 * 60 * 60 * 1000}`,
|
||||||
|
headers: {
|
||||||
|
"Accept": "*/*",
|
||||||
|
"Accept-Encoding": "gzip, deflate, br",
|
||||||
|
"Accept-Language": "zh-cn",
|
||||||
|
"Connection": "keep-alive",
|
||||||
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
|
"Host": "api.m.jd.com",
|
||||||
|
"Referer": "https://servicewechat.com/wxa5bf5ee667d91626/108/page-frame.html",
|
||||||
|
"Cookie": cookie,
|
||||||
|
"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.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function taskTuanUrl(function_id, body = {}) {
|
||||||
|
return {
|
||||||
|
url: `${JD_API_HOST}?functionId=${function_id}&body=${escape(JSON.stringify(body))}&appid=swat_miniprogram&osVersion=5.0.0&clientVersion=3.1.3&fromType=wxapp×tamp=${new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 8 * 60 * 60 * 1000}`,
|
||||||
|
headers: {
|
||||||
|
"Accept": "*/*",
|
||||||
|
"Accept-Encoding": "gzip, deflate, br",
|
||||||
|
"Accept-Language": "zh-cn",
|
||||||
|
"Connection": "keep-alive",
|
||||||
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
|
"Host": "api.m.jd.com",
|
||||||
|
"Referer": "https://servicewechat.com/wxa5bf5ee667d91626/108/page-frame.html",
|
||||||
|
"Cookie": cookie,
|
||||||
|
"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.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function TotalBean() {
|
||||||
|
return new Promise(async resolve => {
|
||||||
|
const options = {
|
||||||
|
url: "https://me-api.jd.com/user_new/info/GetJDUserInfoUnion",
|
||||||
|
headers: {
|
||||||
|
Host: "me-api.jd.com",
|
||||||
|
Accept: "*/*",
|
||||||
|
Connection: "keep-alive",
|
||||||
|
Cookie: cookie,
|
||||||
|
"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.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"),
|
||||||
|
"Accept-Language": "zh-cn",
|
||||||
|
"Referer": "https://home.m.jd.com/myJd/newhome.action?sceneval=2&ufc=&",
|
||||||
|
"Accept-Encoding": "gzip, deflate, br"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$.get(options, (err, resp, data) => {
|
||||||
|
try {
|
||||||
|
if (err) {
|
||||||
|
$.logErr(err)
|
||||||
|
} else {
|
||||||
|
if (data) {
|
||||||
|
data = JSON.parse(data);
|
||||||
|
if (data['retcode'] === "1001") {
|
||||||
|
$.isLogin = false; //cookie过期
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (data['retcode'] === "0" && data.data && data.data.hasOwnProperty("userInfo")) {
|
||||||
|
$.nickName = data.data.userInfo.baseInfo.nickname;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$.log('京东服务器返回空数据');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
$.logErr(e)
|
||||||
|
} finally {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function safeGet(data) {
|
||||||
|
try {
|
||||||
|
if (typeof JSON.parse(data) == "object") {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
that.log(e);
|
||||||
|
that.log(`京东服务器访问数据为空,请检查自身设备网络情况`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function jsonParse(str) {
|
||||||
|
if (typeof str == "string") {
|
||||||
|
try {
|
||||||
|
return JSON.parse(str);
|
||||||
|
} catch (e) {
|
||||||
|
that.log(e);
|
||||||
|
$.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//我加的函数
|
||||||
|
function postToDingTalk(messgae) {
|
||||||
|
const message1 = "" + messgae
|
||||||
|
// that.log(messgae)
|
||||||
|
|
||||||
|
const body = {
|
||||||
|
"msgtype": "markdown",
|
||||||
|
"markdown": {
|
||||||
|
"title": "签到领现金",
|
||||||
|
"text": message1
|
||||||
|
},
|
||||||
|
"at": {
|
||||||
|
"atMobiles": [],
|
||||||
|
"isAtAll": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$.post(toDingtalk(dingtalk, JSON.stringify(body)), (data, status, xhr) => {
|
||||||
|
try {
|
||||||
|
that.log(resp)
|
||||||
|
that.log(data)
|
||||||
|
if (err) {
|
||||||
|
that.log(JSON.stringify(err));
|
||||||
|
$.logErr(err);
|
||||||
|
} else {
|
||||||
|
if (safeGet(data)) {
|
||||||
|
$.duckRes = JSON.parse(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
$.logErr(e, resp)
|
||||||
|
} finally {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
}, "json")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function toDingtalk(urlmain, bodyMain) {
|
||||||
|
return {
|
||||||
|
url: urlmain,
|
||||||
|
body: bodyMain,
|
||||||
|
headers: { 'Content-Type': 'application/json;charset=utf-8' },
|
||||||
|
timeout: 10000,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,386 +0,0 @@
|
|||||||
|
|
||||||
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
|
|
||||||
|
|
||||||
const randomCount = $.isNode() ? 20 : 5;
|
|
||||||
const notify = $.isNode() ? require('./sendNotify') : '';
|
|
||||||
let merge = {}
|
|
||||||
let codeList = []
|
|
||||||
//IOS等用户直接用NobyDa的jd cookie
|
|
||||||
let cookiesArr = [],message =- "",timeout,l,
|
|
||||||
cookie = '';
|
|
||||||
if ($.isNode()) {
|
|
||||||
Object.keys(jdCookieNode).forEach((item) => {
|
|
||||||
cookiesArr.push(jdCookieNode[item])
|
|
||||||
})
|
|
||||||
if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') that.log = () => {};
|
|
||||||
} else {
|
|
||||||
cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
|
|
||||||
}
|
|
||||||
|
|
||||||
const JD_API_HOST = `https://api.m.jd.com/client.action`;
|
|
||||||
|
|
||||||
!(async () => {
|
|
||||||
if (!cookiesArr[0]) {
|
|
||||||
$.msg($.name, '【提示】请先获取cookie\n直接使用NobyDa的动动签到获取', 'https://bean.m.jd.com/', {
|
|
||||||
"open-url": "https://bean.m.jd.com/"
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
message += "<font color=\'#FFA500\'>[通知] </font><font color=\'#006400\' size='3'>动动国创</font> \n\n --- \n\n"
|
|
||||||
|
|
||||||
|
|
||||||
for (let i = 0; i < cookiesArr.length; i++) {
|
|
||||||
cookie = cookiesArr[i];
|
|
||||||
if (cookie) {
|
|
||||||
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
|
|
||||||
$.index = i + 1;
|
|
||||||
$.isLogin = true;
|
|
||||||
$.nickName = '';
|
|
||||||
$.beans = 0
|
|
||||||
$.cando = true
|
|
||||||
username = $.UserName
|
|
||||||
if ($.UserName == "jd_66ea783827d30"){
|
|
||||||
username = "跑腿小弟"
|
|
||||||
}
|
|
||||||
if ($.UserName == "jd_4521b375ebb5d"){
|
|
||||||
username = "锟锟"
|
|
||||||
}
|
|
||||||
if ($.UserName == "jd_542c10c0222bc"){
|
|
||||||
username = "康康"
|
|
||||||
}
|
|
||||||
//加上名称
|
|
||||||
message = message + "<font color=\'#778899\' size=2>【羊毛姐妹】<font color=\'#FFA500\' size=3>" + username + " </font> </font> \n\n "
|
|
||||||
|
|
||||||
that.log(`\n******开始【动动账号${$.index}】${$.nickName || $.UserName}*********\n`);
|
|
||||||
if (!$.isLogin) {
|
|
||||||
$.msg($.name, `【提示】cookie已失效`, `动动账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {
|
|
||||||
"open-url": "https://bean.m.jd.com/bean/signIndex.action"
|
|
||||||
});
|
|
||||||
|
|
||||||
if ($.isNode()) {
|
|
||||||
await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `动动账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
|
|
||||||
}
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
let actdata= await getid("superBrandSecondFloorMainPage","secondfloor")
|
|
||||||
if($.cando){
|
|
||||||
$.actid = actdata.actid
|
|
||||||
$.enpid = actdata.enpid
|
|
||||||
//{actid,actname,enpid}
|
|
||||||
// await doTask("44spR7W6XFhQXzMvPva99WYLTscr", "1000000157", "3") //关注
|
|
||||||
// await superBrandTaskLottery()
|
|
||||||
await getCode()
|
|
||||||
|
|
||||||
await doTask("secondfloor",$.enpid,$.taskList[0].encryptAssignmentId,$.taskList[0].ext.followShop[0].itemId,$.taskList[0].assignmentType)
|
|
||||||
await doTask("secondfloor",$.enpid,$.taskList[2].encryptAssignmentId,$.taskList[2].ext.brandMemberList[0].itemId,$.taskList[2].assignmentType)
|
|
||||||
let signdata= await getid("showSecondFloorSignInfo","sign")
|
|
||||||
await doTask("sign",signdata.enpid,signdata.eid,1,5)
|
|
||||||
that.log("开始抽奖")
|
|
||||||
await superBrandTaskLottery()
|
|
||||||
await superBrandTaskLottery()
|
|
||||||
await superBrandTaskLottery()
|
|
||||||
}
|
|
||||||
|
|
||||||
cookie = cookiesArr[i];
|
|
||||||
if (cookie) {
|
|
||||||
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
|
|
||||||
$.index = i + 1;
|
|
||||||
$.isLogin = true;
|
|
||||||
$.nickName = '';
|
|
||||||
// $.beans = 0
|
|
||||||
// message = ''
|
|
||||||
|
|
||||||
// await shareCodesFormat();
|
|
||||||
that.log(`\n******开始【动动账号${$.index}】\n`);
|
|
||||||
|
|
||||||
for (l = 0; l < codeList.length; l++) {
|
|
||||||
that.log(`为 ${codeList[l]}助力中`)
|
|
||||||
await doTask("secondfloor",$.enpid,$.inviteenaid, codeList[l], 2)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cookie = cookiesArr[i];
|
|
||||||
if (cookie) {
|
|
||||||
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
|
|
||||||
$.index = i + 1;
|
|
||||||
$.isLogin = true;
|
|
||||||
$.nickName = '';
|
|
||||||
// await shareCodesFormat();
|
|
||||||
that.log(`\n******开始【动动账号${$.index}】抽奖\n`);
|
|
||||||
await superBrandTaskLottery()
|
|
||||||
await superBrandTaskLottery()
|
|
||||||
await superBrandTaskLottery()
|
|
||||||
// that.log(`共获得${$.beans} 京豆`)
|
|
||||||
}
|
|
||||||
message = message + "<font color=\'#778899\' size=2>" + `共获得${$.beans} 京豆\n` + "</font>\n\n"
|
|
||||||
}
|
|
||||||
message = message +"----\n\n"
|
|
||||||
}
|
|
||||||
})()
|
|
||||||
.catch((e) => {
|
|
||||||
$.logErr(e)
|
|
||||||
message = message + "<font color=\'#778899\' size=2>" + e + "</font>\n\n"
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
message = message + getPic()
|
|
||||||
that.log(message)
|
|
||||||
// postToDingTalk(message)
|
|
||||||
$.done()
|
|
||||||
})
|
|
||||||
//获取活动信息
|
|
||||||
|
|
||||||
function getid(functionid,source) {
|
|
||||||
return new Promise(async (resolve) => {
|
|
||||||
const options = taskPostUrl(functionid, `{"source":"${source}"}`)
|
|
||||||
// that.log(options)
|
|
||||||
$.post(options, async (err, resp, data) => {
|
|
||||||
try {
|
|
||||||
if (err) {
|
|
||||||
that.log(`${JSON.stringify(err)}`);
|
|
||||||
that.log(`${$.name} API请求失败,请检查网路重试`);
|
|
||||||
} else {
|
|
||||||
data = JSON.parse(data);
|
|
||||||
// that.log(data)
|
|
||||||
if ( data.data && data.code === "0"&&data.data.result) {
|
|
||||||
let json = {}
|
|
||||||
let result =data.data.result
|
|
||||||
json.actid = result.activityBaseInfo.activityId
|
|
||||||
json.actname= result.activityBaseInfo.activityName
|
|
||||||
json.enpid = result.activityBaseInfo.encryptProjectId
|
|
||||||
if(source === "sign"){json.eid=result.activitySign1Info.encryptAssignmentId}
|
|
||||||
resolve(json)
|
|
||||||
that.log(`当前活动:${json.actname} ${json.actid}`)
|
|
||||||
}else{
|
|
||||||
that.log("获取失败")
|
|
||||||
$.cando = false
|
|
||||||
resolve()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
$.logErr(e, resp);
|
|
||||||
} finally {
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function getsignid() {
|
|
||||||
return new Promise(async (resolve) => {
|
|
||||||
const options = taskPostUrl("superBrandSecondFloorMainPage", `{"source":"secondfloor"}`)
|
|
||||||
// that.log(options)
|
|
||||||
$.post(options, async (err, resp, data) => {
|
|
||||||
try {
|
|
||||||
if (err) {
|
|
||||||
that.log(`${JSON.stringify(err)}`);
|
|
||||||
that.log(`${$.name} API请求失败,请检查网路重试`);
|
|
||||||
} else {
|
|
||||||
data = JSON.parse(data);
|
|
||||||
// that.log(data)
|
|
||||||
if ( data.data && data.code === "0") {
|
|
||||||
$.actid = data.data.result.activityBaseInfo.activityId
|
|
||||||
$.actname=data.data.result.activityBaseInfo.activityName
|
|
||||||
$.enpid = data.data.result.activityBaseInfo.encryptProjectId
|
|
||||||
that.log(`当前活动:${actname} ${$.actid}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
$.logErr(e, resp);
|
|
||||||
} finally {
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getCode() {
|
|
||||||
return new Promise(async (resolve) => {
|
|
||||||
const options = taskPostUrl("superBrandTaskList", `{"source":"secondfloor","activityId":${$.actid},"assistInfoFlag":1}`)
|
|
||||||
// that.log(options)
|
|
||||||
$.post(options, async (err, resp, data) => {
|
|
||||||
try {
|
|
||||||
if (err) {
|
|
||||||
that.log(`${JSON.stringify(err)}`);
|
|
||||||
that.log(`${$.name} API请求失败,请检查网路重试`);
|
|
||||||
} else {
|
|
||||||
data = JSON.parse(data);
|
|
||||||
// that.log(data.data.result)
|
|
||||||
if (data && data.data && data.code === "0") {
|
|
||||||
if (data.data.result && data.data.result.taskList && data.data.result.taskList[3]) {
|
|
||||||
$.taskList = data.data.result.taskList
|
|
||||||
let result = data.data.result.taskList[3]
|
|
||||||
let encryptAssignmentId = result.encryptAssignmentId
|
|
||||||
let itemid = result.ext.assistTaskDetail.itemId
|
|
||||||
$.inviteenaid=result.encryptAssignmentId
|
|
||||||
codeList[codeList.length] = itemid
|
|
||||||
that.log(`获取邀请码成功 ${itemid}`);
|
|
||||||
} else {
|
|
||||||
that.log(data)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
$.logErr(e, resp);
|
|
||||||
} finally {
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function doTask(source,pid,encryptAssignmentId, id, type) {
|
|
||||||
return new Promise(async (resolve) => {
|
|
||||||
const options = taskPostUrl(`superBrandDoTask`, `{"source":"${source}","activityId":${$.actid},"encryptProjectId":"${pid}","encryptAssignmentId":"${encryptAssignmentId}","assignmentType":${type},"itemId":"${id}","actionType":0}`)
|
|
||||||
// that.log(options)
|
|
||||||
$.post(options, async (err, resp, data) => {
|
|
||||||
try {
|
|
||||||
if (err) {
|
|
||||||
that.log(`${JSON.stringify(err)}`);
|
|
||||||
that.log(`${$.name} API请求失败,请检查网路重试`);
|
|
||||||
} else {
|
|
||||||
// that.log(data)
|
|
||||||
data = JSON.parse(data);
|
|
||||||
if (data && data.code === "0") {
|
|
||||||
if (data.data.bizCode === "0") {
|
|
||||||
that.log("任务成功啦~")
|
|
||||||
} else {
|
|
||||||
that.log(data.data.bizMsg)
|
|
||||||
}
|
|
||||||
resolve(data.data.bizCode)
|
|
||||||
} else {
|
|
||||||
that.log(data)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
$.logErr(e, resp);
|
|
||||||
} finally {
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function superBrandTaskLottery() {
|
|
||||||
return new Promise(async (resolve) => {
|
|
||||||
const options = taskPostUrl("superBrandTaskLottery", `{"source":"secondfloor","activityId":${$.actid}}`)
|
|
||||||
$.post(options, async (err, resp, data) => {
|
|
||||||
try {
|
|
||||||
if (err) {
|
|
||||||
that.log(`${JSON.stringify(err)}`);
|
|
||||||
that.log(`${$.name} API请求失败,请检查网路重试`);
|
|
||||||
} else {
|
|
||||||
data = JSON.parse(data);
|
|
||||||
// that.log(data)
|
|
||||||
if (data && data.code === "0") {
|
|
||||||
if (data.data.bizCode === "TK000") {
|
|
||||||
that.log(`获得 你猜获得了啥🐶 ${data.data.bizMsg}`)
|
|
||||||
message += "<font color=\'#778899\' size=2>" + `获得 你猜获得了啥🐶 ${data.data.bizMsg}` + "</font>\n\n"
|
|
||||||
} else {
|
|
||||||
that.log(data.data.bizMsg)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
that.log(data)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
$.logErr(e, resp);
|
|
||||||
} finally {
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function taskPostUrl(functionid, body) {
|
|
||||||
const time = Date.now();
|
|
||||||
return {
|
|
||||||
url: `https://api.m.jd.com/api?functionId=${functionid}&appid=ProductZ4Brand&client=wh5&t=${time}&body=${encodeURIComponent(body)}`,
|
|
||||||
body: "",
|
|
||||||
headers: {
|
|
||||||
Accept: "application/json,text/plain, */*",
|
|
||||||
"Content-Type": "application/x-www-form-urlencoded",
|
|
||||||
"Accept-Encoding": "gzip, deflate, br",
|
|
||||||
"Accept-Language": "zh-cn",
|
|
||||||
Connection: "keep-alive",
|
|
||||||
Cookie: cookie,
|
|
||||||
Host: "api.m.jd.com",
|
|
||||||
Referer: "https://prodev.m.jd.com/mall/active/NrHM6Egy96gxeG4eb7vFX7fYXf3/index.html?activityId=1000007&encryptProjectId=cUNnf3E6aMLQcEQbTVxn8AyhjXb&assistEncryptAssignmentId=2jpJFvC9MBNC7Qsqrt8WzEEcVoiT&assistItemId=S5ijz_8ukVww&tttparams=GgS7lUeyJnTGF0IjoiMzMuMjUyNzYyIiwiZ0xuZyI6IjEwNy4xNjA1MDcifQ6%3D%3D&lng=107.147022&lat=33.255229&sid=e5150a3fdd017952350b4b41294b145w&un_area=27_2442_2444_31912",
|
|
||||||
"User-Agent": "jdapp;android;9.4.4;10;3b78ecc3f490c7ba;network/UNKNOWN;model/M2006J10C;addressid/138543439;aid/3b78ecc3f490c7ba;oaid/7d5870c5a1696881;osVer/29;appBuild/85576;psn/3b78ecc3f490c7ba|541;psq/2;uid/3b78ecc3f490c7ba;adk/;ads/;pap/JA2015_311210|9.2.4|ANDROID 10;osv/10;pv/548.2;jdv/0|iosapp|t_335139774|appshare|CopyURL|1606277982178|1606277986;ref/com.jd.lib.personal.view.fragment.JDPersonalFragment;partner/xiaomi001;apprpd/MyJD_Main;Mozilla/5.0 (Linux; Android 10; M2006J10C Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045227 Mobile Safari/537.36",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function jsonParse(str) {
|
|
||||||
if (typeof str == "string") {
|
|
||||||
try {
|
|
||||||
return JSON.parse(str);
|
|
||||||
} catch (e) {
|
|
||||||
that.log(e);
|
|
||||||
$.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//我加的函数
|
|
||||||
function postToDingTalk(messgae) {
|
|
||||||
const dingtalk = "https://oapi.dingtalk.com/robot/send?access_token=fa87e34729eaa6113fddfa857efebb477dea0a433d6eecfe93b1d3f5e24847b9"
|
|
||||||
|
|
||||||
const message1 = "" + messgae
|
|
||||||
that.log(messgae)
|
|
||||||
|
|
||||||
const body = {
|
|
||||||
"msgtype": "markdown",
|
|
||||||
"markdown": {
|
|
||||||
"title":"动动国创",
|
|
||||||
"text": message1
|
|
||||||
},
|
|
||||||
"at": {
|
|
||||||
"atMobiles": [],
|
|
||||||
"isAtAll": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$.post(toDingtalk(dingtalk,JSON.stringify(body)), (data,status,xhr)=>{
|
|
||||||
try {
|
|
||||||
that.log(resp)
|
|
||||||
that.log(data)
|
|
||||||
if (err) {
|
|
||||||
that.log(JSON.stringify(err));
|
|
||||||
$.logErr(err);
|
|
||||||
} else {
|
|
||||||
if (safeGet(data)) {
|
|
||||||
$.duckRes = JSON.parse(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
$.logErr(e, resp)
|
|
||||||
} finally {
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
},"json")
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function toDingtalk(urlmain, bodyMain) {
|
|
||||||
return {
|
|
||||||
url: urlmain,
|
|
||||||
body:bodyMain,
|
|
||||||
headers: { 'Content-Type': 'application/json;charset=utf-8' },
|
|
||||||
timeout: 10000,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function getPic(){
|
|
||||||
let code = ["1.gif","2.png","3.png","4.png","5.gif","6.gif","7.gif","8.gif","9.gif","10.png","11.png"]
|
|
||||||
let address = "\n\n )
|
|
||||||
address = address + code[pos] + ")"
|
|
||||||
return address
|
|
||||||
}
|
|
||||||
File diff suppressed because one or more lines are too long
@@ -1,937 +0,0 @@
|
|||||||
const notify = $.isNode() ? require('./sendNotify') : '';
|
|
||||||
//Node.js用户请在jdCookie.js处填写京东ck;
|
|
||||||
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
|
|
||||||
|
|
||||||
//IOS等用户直接用NobyDa的jd cookie
|
|
||||||
let cookiesArr = [], cookie = '', allMsg = ``;
|
|
||||||
if ($.isNode()) {
|
|
||||||
Object.keys(jdCookieNode).forEach((item) => {
|
|
||||||
cookiesArr.push(jdCookieNode[item])
|
|
||||||
})
|
|
||||||
if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') that.log = () => {};
|
|
||||||
} else {
|
|
||||||
cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
|
|
||||||
}
|
|
||||||
|
|
||||||
let jdNotify = true;//是否开启静默运行,默认true
|
|
||||||
let sellFruit = true;//是否卖出金果得到金币,默认'false'
|
|
||||||
const JD_API_HOST = 'https://ms.jr.jd.com/gw/generic/uc/h5/m';
|
|
||||||
let userInfo = null, taskInfo = [], message = "", subTitle = '', fruitTotal = 0;
|
|
||||||
!(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"});
|
|
||||||
}
|
|
||||||
message += "<font color=\'#FFA500\'>[通知] </font><font color=\'#006400\' size='3'>动动摇钱树</font> \n\n --- \n\n"
|
|
||||||
for (let i = 0; i < cookiesArr.length; i++) {
|
|
||||||
if (cookiesArr[i]) {
|
|
||||||
cookie = cookiesArr[i];
|
|
||||||
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
|
|
||||||
$.index = i + 1;
|
|
||||||
$.isLogin = true;
|
|
||||||
$.nickName = '';
|
|
||||||
|
|
||||||
|
|
||||||
username = $.UserName
|
|
||||||
if ($.UserName == "jd_66ea783827d30"){
|
|
||||||
username = "跑腿小弟"
|
|
||||||
}
|
|
||||||
if ($.UserName == "jd_4521b375ebb5d"){
|
|
||||||
username = "锟锟"
|
|
||||||
}
|
|
||||||
if ($.UserName == "jd_542c10c0222bc"){
|
|
||||||
username = "康康"
|
|
||||||
}
|
|
||||||
//加上名称
|
|
||||||
message = message + "<font color=\'#778899\' size=2>【羊毛姐妹】<font color=\'#FFA500\' size=3>" + username + " </font> </font> \n\n "
|
|
||||||
|
|
||||||
|
|
||||||
await TotalBean();
|
|
||||||
that.log(`\n****开始【京东账号${$.index}】${$.nickName || $.UserName}****\n`);
|
|
||||||
if (!$.isLogin) {
|
|
||||||
$.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
|
|
||||||
|
|
||||||
if ($.isNode()) {
|
|
||||||
await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
|
|
||||||
}
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
subTitle = '';
|
|
||||||
await jd_moneyTree();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (allMsg) {
|
|
||||||
jdNotify = $.isNode() ? (process.env.MONEYTREE_NOTIFY_CONTROL ? process.env.MONEYTREE_NOTIFY_CONTROL : jdNotify) : ($.getdata('jdMoneyTreeNotify') ? $.getdata('jdMoneyTreeNotify') : jdNotify);
|
|
||||||
if (!jdNotify || jdNotify === 'false') {
|
|
||||||
if ($.isNode()) await notify.sendNotify($.name, allMsg);
|
|
||||||
$.msg($.name, '', allMsg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})()
|
|
||||||
.catch((e) => {
|
|
||||||
$.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
message += getPic()
|
|
||||||
taht.log(message)
|
|
||||||
postToDingTalk(message)
|
|
||||||
$.done();
|
|
||||||
})
|
|
||||||
|
|
||||||
async function jd_moneyTree() {
|
|
||||||
try {
|
|
||||||
const userRes = await user_info();
|
|
||||||
if (!userRes || !userRes.realName) return
|
|
||||||
await signEveryDay();
|
|
||||||
await dayWork();
|
|
||||||
await harvest();
|
|
||||||
await sell();
|
|
||||||
await myWealth();
|
|
||||||
await stealFriendFruit()
|
|
||||||
|
|
||||||
$.log(`\n${message}\n`);
|
|
||||||
} catch (e) {
|
|
||||||
$.logErr(e)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function user_info() {
|
|
||||||
that.log('初始化摇钱树个人信息');
|
|
||||||
const params = {
|
|
||||||
"sharePin": "",
|
|
||||||
"shareType": 1,
|
|
||||||
"channelLV": "",
|
|
||||||
"source": 2,
|
|
||||||
"riskDeviceParam": {
|
|
||||||
"eid": "",
|
|
||||||
"fp": "",
|
|
||||||
"sdkToken": "",
|
|
||||||
"token": "",
|
|
||||||
"jstub": "",
|
|
||||||
"appType": "2",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
params.riskDeviceParam = JSON.stringify(params.riskDeviceParam);
|
|
||||||
await $.wait(5000); //歇口气儿, 不然会报操作频繁
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
$.post(taskurl('login', params), async (err, resp, data) => {
|
|
||||||
try {
|
|
||||||
if (err) {
|
|
||||||
that.log("\n摇钱树京东API请求失败 ‼️‼️")
|
|
||||||
that.log(JSON.stringify(err));
|
|
||||||
} else {
|
|
||||||
if (data) {
|
|
||||||
const res = JSON.parse(data);
|
|
||||||
if (res && res.resultCode === 0) {
|
|
||||||
$.isLogin = true;
|
|
||||||
that.log('resultCode为0')
|
|
||||||
if (res.resultData.data) {
|
|
||||||
userInfo = res.resultData.data;
|
|
||||||
// userInfo.realName = null;
|
|
||||||
if (userInfo.realName) {
|
|
||||||
// that.log(`助力码sharePin为::${userInfo.sharePin}`);
|
|
||||||
$.treeMsgTime = userInfo.sharePin;
|
|
||||||
subTitle = `【${userInfo.nick}】${userInfo.treeInfo.treeName}`;
|
|
||||||
message += "<font color=\'#778899\' size=2>" + `【我的金果数量】${userInfo.treeInfo.fruit}\n` + "</font>\n\n";
|
|
||||||
message += "<font color=\'#778899\' size=2>" + `【我的金币数量】${userInfo.treeInfo.coin}\n` + "</font>\n\n";
|
|
||||||
message += "<font color=\'#778899\' size=2>" + `【距离${userInfo.treeInfo.level + 1}级摇钱树还差】${userInfo.treeInfo.progressLeft}\n` + "</font>\n\n";
|
|
||||||
} else {
|
|
||||||
$.log(`京东账号${$.index}${$.UserName}运行失败\n此账号未实名认证或者未参与过此活动\n①如未参与活动,请先去京东app参加摇钱树活动\n入口:我的->游戏与互动->查看更多\n②如未实名认证,请进行实名认证`)
|
|
||||||
// $.msg($.name, `【提示】京东账号${$.index}${$.UserName}运行失败`, '此账号未实名认证或者未参与过此活动\n①如未参与活动,请先去京东app参加摇钱树活动\n入口:我的->游戏与互动->查看更多\n②如未实名认证,请进行实名认证', {"open-url": "openApp.jdMobile://"});
|
|
||||||
message += "<font color=\'#778899\' size=2>" + `运行失败\n此账号未实名认证或者未参与过此活动\n①如未参与活动,请先去京东app参加摇钱树活动\n入口:我的->游戏与互动->查看更多\n②如未实名认证,请进行实名认证` + "</font>\n\n"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
that.log(`其他情况::${JSON.stringify(res)}`);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
that.log(`京豆api返回数据为空,请检查自身原因`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (eor) {
|
|
||||||
$.logErr(eor, err)
|
|
||||||
} finally {
|
|
||||||
resolve(userInfo)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
async function dayWork() {
|
|
||||||
that.log(`开始做任务userInfo了\n`)
|
|
||||||
return new Promise(async resolve => {
|
|
||||||
const data = {
|
|
||||||
"source": 0,
|
|
||||||
"linkMissionIds": ["666", "667"],
|
|
||||||
"LinkMissionIdValues": [7, 7],
|
|
||||||
"riskDeviceParam": {
|
|
||||||
"eid": "",
|
|
||||||
"dt": "",
|
|
||||||
"ma": "",
|
|
||||||
"im": "",
|
|
||||||
"os": "",
|
|
||||||
"osv": "",
|
|
||||||
"ip": "",
|
|
||||||
"apid": "",
|
|
||||||
"ia": "",
|
|
||||||
"uu": "",
|
|
||||||
"cv": "",
|
|
||||||
"nt": "",
|
|
||||||
"at": "1",
|
|
||||||
"fp": "",
|
|
||||||
"token": ""
|
|
||||||
}
|
|
||||||
};
|
|
||||||
let response = await request('dayWork', data);
|
|
||||||
// that.log(`获取任务的信息:${JSON.stringify(response)}\n`)
|
|
||||||
let canTask = [];
|
|
||||||
taskInfo = [];
|
|
||||||
if (response && response.resultCode === 0) {
|
|
||||||
if (response.resultData.code === '200') {
|
|
||||||
response.resultData.data.map((item) => {
|
|
||||||
if (item.prizeType === 2) {
|
|
||||||
canTask.push(item);
|
|
||||||
}
|
|
||||||
if (item.workType === 7 && item.prizeType === 0) {
|
|
||||||
// missionId.push(item.mid);
|
|
||||||
taskInfo.push(item);
|
|
||||||
}
|
|
||||||
// if (item.workType === 7 && item.prizeType === 0) {
|
|
||||||
// missionId2 = item.mid;
|
|
||||||
// }
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
that.log(`canTask::${JSON.stringify(canTask)}\n`)
|
|
||||||
that.log(`浏览任务列表taskInfo::${JSON.stringify(taskInfo)}\n`)
|
|
||||||
for (let item of canTask) {
|
|
||||||
if (item.workType === 1) {
|
|
||||||
// 签到任务
|
|
||||||
// let signRes = await sign();
|
|
||||||
// that.log(`签到结果:${JSON.stringify(signRes)}`);
|
|
||||||
if (item.workStatus === 0) {
|
|
||||||
// const data = {"source":2,"workType":1,"opType":2};
|
|
||||||
// let signRes = await request('doWork', data);
|
|
||||||
let signRes = await sign();
|
|
||||||
that.log(`三餐签到结果:${JSON.stringify(signRes)}`);
|
|
||||||
} else if (item.workStatus === 2) {
|
|
||||||
that.log(`三餐签到任务已经做过`)
|
|
||||||
} else if (item.workStatus === -1) {
|
|
||||||
that.log(`三餐签到任务不在时间范围内`)
|
|
||||||
}
|
|
||||||
} else if (item.workType === 2) {
|
|
||||||
// 分享任务
|
|
||||||
if (item.workStatus === 0) {
|
|
||||||
// share();
|
|
||||||
const data = {"source": 0, "workType": 2, "opType": 1};
|
|
||||||
//开始分享
|
|
||||||
// let shareRes = await request('doWork', data);
|
|
||||||
let shareRes = await share(data);
|
|
||||||
that.log(`开始分享的动作:${JSON.stringify(shareRes)}`);
|
|
||||||
const b = {"source": 0, "workType": 2, "opType": 2};
|
|
||||||
// let shareResJL = await request('doWork', b);
|
|
||||||
let shareResJL = await share(b);
|
|
||||||
that.log(`领取分享后的奖励:${JSON.stringify(shareResJL)}`)
|
|
||||||
} else if (item.workStatus === 2) {
|
|
||||||
that.log(`分享任务已经做过`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (let task of taskInfo) {
|
|
||||||
if (task.mid && task.workStatus === 0) {
|
|
||||||
that.log('开始做浏览任务');
|
|
||||||
// yield setUserLinkStatus(task.mid);
|
|
||||||
let aa = await setUserLinkStatus(task.mid);
|
|
||||||
that.log(`aaa${JSON.stringify(aa)}`);
|
|
||||||
} else if (task.mid && task.workStatus === 1) {
|
|
||||||
that.log(`workStatus === 1开始领取浏览后的奖励:mid:${task.mid}`);
|
|
||||||
let receiveAwardRes = await receiveAward(task.mid);
|
|
||||||
that.log(`领取浏览任务奖励成功:${JSON.stringify(receiveAwardRes)}`)
|
|
||||||
} else if (task.mid && task.workStatus === 2) {
|
|
||||||
that.log('所有的浏览任务都做完了')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
resolve();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function harvest() {
|
|
||||||
if (!userInfo) return
|
|
||||||
const data = {
|
|
||||||
"source": 2,
|
|
||||||
"sharePin": "",
|
|
||||||
"userId": userInfo.userInfo,
|
|
||||||
"userToken": userInfo.userToken,
|
|
||||||
"shareType": 1,
|
|
||||||
"channel": "",
|
|
||||||
"riskDeviceParam": {
|
|
||||||
"eid": "",
|
|
||||||
"appType": 2,
|
|
||||||
"fp": "",
|
|
||||||
"jstub": "",
|
|
||||||
"sdkToken": "",
|
|
||||||
"token": ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
data.riskDeviceParam = JSON.stringify(data.riskDeviceParam);
|
|
||||||
return new Promise((rs, rj) => {
|
|
||||||
request('harvest', data).then((harvestRes) => {
|
|
||||||
if (harvestRes && harvestRes.resultCode === 0 && harvestRes.resultData.code === '200') {
|
|
||||||
that.log(`\n收获金果成功:${JSON.stringify(harvestRes)}\n`)
|
|
||||||
let data = harvestRes.resultData.data;
|
|
||||||
message +="<font color=\'#778899\' size=2>" + `【距离${data.treeInfo.level + 1}级摇钱树还差】${data.treeInfo.progressLeft}\n` + "</font>\n\n";
|
|
||||||
fruitTotal = data.treeInfo.fruit;
|
|
||||||
} else {
|
|
||||||
that.log(`\n收获金果异常:${JSON.stringify(harvestRes)}`)
|
|
||||||
}
|
|
||||||
rs()
|
|
||||||
// gen.next();
|
|
||||||
})
|
|
||||||
})
|
|
||||||
// request('harvest', data).then((harvestRes) => {
|
|
||||||
// if (harvestRes.resultCode === 0 && harvestRes.resultData.code === '200') {
|
|
||||||
// let data = harvestRes.resultData.data;
|
|
||||||
// message += `【距离${data.treeInfo.level + 1}级摇钱树还差】${data.treeInfo.progressLeft}\n`;
|
|
||||||
// fruitTotal = data.treeInfo.fruit;
|
|
||||||
// gen.next();
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
}
|
|
||||||
|
|
||||||
//卖出金果,得到金币
|
|
||||||
function sell() {
|
|
||||||
return new Promise((rs, rj) => {
|
|
||||||
const params = {
|
|
||||||
"source": 2,
|
|
||||||
"jtCount": 7.000000000000001,
|
|
||||||
"riskDeviceParam": {
|
|
||||||
"eid": "",
|
|
||||||
"fp": "",
|
|
||||||
"sdkToken": "",
|
|
||||||
"token": "",
|
|
||||||
"jstub": "",
|
|
||||||
"appType": 2,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
params.riskDeviceParam = JSON.stringify(params.riskDeviceParam);//这一步,不可省略,否则提交会报错(和login接口一样)
|
|
||||||
that.log(`目前金果数量${fruitTotal}`)
|
|
||||||
sellFruit = $.isNode() ? (process.env.MONEY_TREE_SELL_FRUIT ? process.env.MONEY_TREE_SELL_FRUIT : `${sellFruit}`) : ($.getdata('MONEY_TREE_SELL_FRUIT') ? $.getdata('MONEY_TREE_SELL_FRUIT') : `${sellFruit}`);
|
|
||||||
if (sellFruit && sellFruit === 'false') {
|
|
||||||
that.log(`\n设置的不卖出金果\n`)
|
|
||||||
rs()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (fruitTotal >= 8000 * 7) {
|
|
||||||
if (userInfo['jtRest'] === 0) {
|
|
||||||
that.log(`\n今日已卖出5.6万金果(已达上限),获得0.07金贴\n`)
|
|
||||||
rs()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
request('sell', params).then((sellRes) => {
|
|
||||||
if (sellRes && sellRes['resultCode'] === 0) {
|
|
||||||
if (sellRes['resultData']['code'] === '200') {
|
|
||||||
if (sellRes['resultData']['data']['sell'] === 0) {
|
|
||||||
that.log(`卖出金果成功,获得0.07金贴\n`);
|
|
||||||
allMsg += `账号${$.index}:${$.nickName || $.UserName}\n今日成功卖出5.6万金果,获得0.07金贴${$.index !== cookiesArr.length ? '\n\n' : ''}`
|
|
||||||
} else {
|
|
||||||
that.log(`卖出金果失败:${JSON.stringify(sellRes)}\n`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
rs()
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
that.log(`当前金果数量不够兑换 0.07金贴\n`);
|
|
||||||
rs()
|
|
||||||
}
|
|
||||||
// request('sell', params).then(response => {
|
|
||||||
// rs(response);
|
|
||||||
// })
|
|
||||||
})
|
|
||||||
// request('sell', params).then((sellRes) => {
|
|
||||||
// that.log(`卖出金果结果:${JSON.stringify(sellRes)}\n`)
|
|
||||||
// gen.next();
|
|
||||||
// })
|
|
||||||
}
|
|
||||||
|
|
||||||
//获取金币和金果数量
|
|
||||||
function myWealth() {
|
|
||||||
return new Promise((resolve) => {
|
|
||||||
const params = {
|
|
||||||
"source": 2,
|
|
||||||
"riskDeviceParam": {
|
|
||||||
"eid": "",
|
|
||||||
"dt": "",
|
|
||||||
"ma": "",
|
|
||||||
"im": "",
|
|
||||||
"os": "",
|
|
||||||
"osv": "",
|
|
||||||
"ip": "",
|
|
||||||
"apid": "",
|
|
||||||
"ia": "",
|
|
||||||
"uu": "",
|
|
||||||
"cv": "",
|
|
||||||
"nt": "",
|
|
||||||
"at": "1",
|
|
||||||
"fp": "",
|
|
||||||
"token": ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
params.riskDeviceParam = JSON.stringify(params.riskDeviceParam);//这一步,不可省略,否则提交会报错(和login接口一样)
|
|
||||||
request('myWealth', params).then(res => {
|
|
||||||
if (res && res.resultCode === 0 && res.resultData.code === '200') {
|
|
||||||
that.log(`金贴和金果数量::${JSON.stringify(res)}`);
|
|
||||||
message += "<font color=\'#778899\' size=2>" + `【我的金果数量】${res.resultData.data.gaAmount}\n` + "</font>\n\n";
|
|
||||||
message += "<font color=\'#778899\' size=2>" + `【我的金贴数量】${res.resultData.data.gcAmount / 100}\n` + "</font>\n\n";
|
|
||||||
}
|
|
||||||
resolve();
|
|
||||||
})
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function sign() {
|
|
||||||
that.log('开始三餐签到')
|
|
||||||
const data = {"source": 2, "workType": 1, "opType": 2};
|
|
||||||
return new Promise((rs, rj) => {
|
|
||||||
request('doWork', data).then(response => {
|
|
||||||
rs(response);
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function signIndex() {
|
|
||||||
const params = {
|
|
||||||
"source": 0,
|
|
||||||
"riskDeviceParam": {
|
|
||||||
"eid": "",
|
|
||||||
"dt": "",
|
|
||||||
"ma": "",
|
|
||||||
"im": "",
|
|
||||||
"os": "",
|
|
||||||
"osv": "",
|
|
||||||
"ip": "",
|
|
||||||
"apid": "",
|
|
||||||
"ia": "",
|
|
||||||
"uu": "",
|
|
||||||
"cv": "",
|
|
||||||
"nt": "",
|
|
||||||
"at": "1",
|
|
||||||
"fp": "",
|
|
||||||
"token": ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return new Promise((rs, rj) => {
|
|
||||||
request('signIndex', params).then(response => {
|
|
||||||
rs(response);
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
async function signEveryDay() {
|
|
||||||
return new Promise(async (resolve) => {
|
|
||||||
try {
|
|
||||||
let signIndexRes = await signIndex();
|
|
||||||
if (signIndexRes.resultCode === 0) {
|
|
||||||
that.log(`每日签到条件查询:${signIndexRes.resultData.data.canSign === 2 ? '可以签到' : '已经签到过了'}`);
|
|
||||||
if (signIndexRes.resultData && signIndexRes.resultData.data.canSign == 2) {
|
|
||||||
that.log('准备每日签到')
|
|
||||||
let signOneRes = await signOne(signIndexRes.resultData.data.signDay);
|
|
||||||
that.log(`第${signIndexRes.resultData.data.signDay}日签到结果:${JSON.stringify(signOneRes)}`);
|
|
||||||
if (signIndexRes.resultData.data.signDay === 7) {
|
|
||||||
let getSignAwardRes = await getSignAward();
|
|
||||||
that.log(`店铺券(49-10)领取结果:${JSON.stringify(getSignAwardRes)}`)
|
|
||||||
if (getSignAwardRes.resultCode === 0 && getSignAwardRes.data.code === 0) {
|
|
||||||
message += "<font color=\'#778899\' size=2>" + `【7日签到奖励领取】${getSignAwardRes.datamessage}\n` + "</font>\n\n"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
$.logErr(e);
|
|
||||||
} finally {
|
|
||||||
resolve()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function signOne(signDay) {
|
|
||||||
const params = {
|
|
||||||
"source": 0,
|
|
||||||
"signDay": signDay,
|
|
||||||
"riskDeviceParam": {
|
|
||||||
"eid": "",
|
|
||||||
"dt": "",
|
|
||||||
"ma": "",
|
|
||||||
"im": "",
|
|
||||||
"os": "",
|
|
||||||
"osv": "",
|
|
||||||
"ip": "",
|
|
||||||
"apid": "",
|
|
||||||
"ia": "",
|
|
||||||
"uu": "",
|
|
||||||
"cv": "",
|
|
||||||
"nt": "",
|
|
||||||
"at": "1",
|
|
||||||
"fp": "",
|
|
||||||
"token": ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return new Promise((rs, rj) => {
|
|
||||||
request('signOne', params).then(response => {
|
|
||||||
rs(response);
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 领取七日签到后的奖励(店铺优惠券)
|
|
||||||
function getSignAward() {
|
|
||||||
const params = {
|
|
||||||
"source": 2,
|
|
||||||
"awardType": 2,
|
|
||||||
"deviceRiskParam": 1,
|
|
||||||
"riskDeviceParam": {
|
|
||||||
"eid": "",
|
|
||||||
"dt": "",
|
|
||||||
"ma": "",
|
|
||||||
"im": "",
|
|
||||||
"os": "",
|
|
||||||
"osv": "",
|
|
||||||
"ip": "",
|
|
||||||
"apid": "",
|
|
||||||
"ia": "",
|
|
||||||
"uu": "",
|
|
||||||
"cv": "",
|
|
||||||
"nt": "",
|
|
||||||
"at": "1",
|
|
||||||
"fp": "",
|
|
||||||
"token": ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return new Promise((rs, rj) => {
|
|
||||||
request('getSignAward', params).then(response => {
|
|
||||||
rs(response);
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 浏览任务
|
|
||||||
async function setUserLinkStatus(missionId) {
|
|
||||||
let index = 0;
|
|
||||||
do {
|
|
||||||
const params = {
|
|
||||||
"missionId": missionId,
|
|
||||||
"pushStatus": 1,
|
|
||||||
"keyValue": index,
|
|
||||||
"riskDeviceParam": {
|
|
||||||
"eid": "",
|
|
||||||
"dt": "",
|
|
||||||
"ma": "",
|
|
||||||
"im": "",
|
|
||||||
"os": "",
|
|
||||||
"osv": "",
|
|
||||||
"ip": "",
|
|
||||||
"apid": "",
|
|
||||||
"ia": "",
|
|
||||||
"uu": "",
|
|
||||||
"cv": "",
|
|
||||||
"nt": "",
|
|
||||||
"at": "1",
|
|
||||||
"fp": "",
|
|
||||||
"token": ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let response = await request('setUserLinkStatus', params)
|
|
||||||
that.log(`missionId为${missionId}::第${index + 1}次浏览活动完成: ${JSON.stringify(response)}`);
|
|
||||||
// if (resultCode === 0) {
|
|
||||||
// let sportRevardResult = await getSportReward();
|
|
||||||
// that.log(`领取遛狗奖励完成: ${JSON.stringify(sportRevardResult)}`);
|
|
||||||
// }
|
|
||||||
index++;
|
|
||||||
} while (index < 7) //不知道结束的条件,目前写死循环7次吧
|
|
||||||
that.log('浏览店铺任务结束');
|
|
||||||
that.log('开始领取浏览后的奖励');
|
|
||||||
let receiveAwardRes = await receiveAward(missionId);
|
|
||||||
that.log(`领取浏览任务奖励成功:${JSON.stringify(receiveAwardRes)}`)
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
resolve(receiveAwardRes);
|
|
||||||
})
|
|
||||||
// gen.next();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 领取浏览后的奖励
|
|
||||||
function receiveAward(mid) {
|
|
||||||
if (!mid) return
|
|
||||||
mid = mid + "";
|
|
||||||
const params = {
|
|
||||||
"source": 0,
|
|
||||||
"workType": 7,
|
|
||||||
"opType": 2,
|
|
||||||
"mid": mid,
|
|
||||||
"riskDeviceParam": {
|
|
||||||
"eid": "",
|
|
||||||
"dt": "",
|
|
||||||
"ma": "",
|
|
||||||
"im": "",
|
|
||||||
"os": "",
|
|
||||||
"osv": "",
|
|
||||||
"ip": "",
|
|
||||||
"apid": "",
|
|
||||||
"ia": "",
|
|
||||||
"uu": "",
|
|
||||||
"cv": "",
|
|
||||||
"nt": "",
|
|
||||||
"at": "1",
|
|
||||||
"fp": "",
|
|
||||||
"token": ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return new Promise((rs, rj) => {
|
|
||||||
request('doWork', params).then(response => {
|
|
||||||
rs(response);
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function share(data) {
|
|
||||||
if (data.opType === 1) {
|
|
||||||
that.log(`开始做分享任务\n`)
|
|
||||||
} else {
|
|
||||||
that.log(`开始做领取分享后的奖励\n`)
|
|
||||||
}
|
|
||||||
return new Promise((rs, rj) => {
|
|
||||||
request('doWork', data).then(response => {
|
|
||||||
rs(response);
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
async function stealFriendFruit() {
|
|
||||||
await friendRank();
|
|
||||||
if ($.friendRankList && $.friendRankList.length > 0) {
|
|
||||||
const canSteal = $.friendRankList.some((item) => {
|
|
||||||
const boxShareCode = item.steal
|
|
||||||
return (boxShareCode === true);
|
|
||||||
});
|
|
||||||
if (canSteal) {
|
|
||||||
$.amount = 0;
|
|
||||||
for (let item of $.friendRankList) {
|
|
||||||
if (!item.self && item.steal) {
|
|
||||||
await friendTreeRoom(item.encryPin);
|
|
||||||
const stealFruitRes = await stealFruit(item.encryPin, $.friendTree.stoleInfo);
|
|
||||||
if (stealFruitRes && stealFruitRes.resultCode === 0 && stealFruitRes.resultData.code === '200') {
|
|
||||||
$.amount += stealFruitRes.resultData.data.amount;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
message +="<font color=\'#778899\' size=2>" + `【偷取好友金果】共${$.amount}个\n` + "</font>\n\n";
|
|
||||||
} else {
|
|
||||||
that.log(`今日已偷过好友的金果了,暂无好友可偷,请明天再来\n`)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
that.log(`您暂无好友,故跳过`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//获取好友列表API
|
|
||||||
async function friendRank() {
|
|
||||||
await $.wait(1000); //歇口气儿, 不然会报操作频繁
|
|
||||||
const params = {
|
|
||||||
"source": 2,
|
|
||||||
"riskDeviceParam": {
|
|
||||||
"eid": "",
|
|
||||||
"dt": "",
|
|
||||||
"ma": "",
|
|
||||||
"im": "",
|
|
||||||
"os": "",
|
|
||||||
"osv": "",
|
|
||||||
"ip": "",
|
|
||||||
"apid": "",
|
|
||||||
"ia": "",
|
|
||||||
"uu": "",
|
|
||||||
"cv": "",
|
|
||||||
"nt": "",
|
|
||||||
"at": "1",
|
|
||||||
"fp": "",
|
|
||||||
"token": ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
params.riskDeviceParam = JSON.stringify(params.riskDeviceParam);//这一步,不可省略,否则提交会报错(和login接口一样)
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
$.post(taskurl('friendRank', params), (err, resp, data) => {
|
|
||||||
try {
|
|
||||||
if (err) {
|
|
||||||
that.log("\n摇钱树京东API请求失败 ‼️‼️");
|
|
||||||
that.log(JSON.stringify(err));
|
|
||||||
$.logErr(err);
|
|
||||||
} else {
|
|
||||||
if (data) {
|
|
||||||
data = JSON.parse(data);
|
|
||||||
$.friendRankList = data.resultData.data;
|
|
||||||
} else {
|
|
||||||
that.log(`京豆api返回数据为空,请检查自身原因`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (eor) {
|
|
||||||
$.logErr(eor, err)
|
|
||||||
} finally {
|
|
||||||
resolve()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 进入好友房间API
|
|
||||||
async function friendTreeRoom(friendPin) {
|
|
||||||
await $.wait(1000); //歇口气儿, 不然会报操作频繁
|
|
||||||
const params = {
|
|
||||||
"source": 2,
|
|
||||||
"friendPin": friendPin,
|
|
||||||
"riskDeviceParam": {
|
|
||||||
"eid": "",
|
|
||||||
"dt": "",
|
|
||||||
"ma": "",
|
|
||||||
"im": "",
|
|
||||||
"os": "",
|
|
||||||
"osv": "",
|
|
||||||
"ip": "",
|
|
||||||
"apid": "",
|
|
||||||
"ia": "",
|
|
||||||
"uu": "",
|
|
||||||
"cv": "",
|
|
||||||
"nt": "",
|
|
||||||
"at": "1",
|
|
||||||
"fp": "",
|
|
||||||
"token": ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
params.riskDeviceParam = JSON.stringify(params.riskDeviceParam);//这一步,不可省略,否则提交会报错(和login接口一样)
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
$.post(taskurl('friendTree', params), (err, resp, data) => {
|
|
||||||
try {
|
|
||||||
if (err) {
|
|
||||||
that.log("\n摇钱树京东API请求失败 ‼️‼️");
|
|
||||||
that.log(JSON.stringify(err));
|
|
||||||
$.logErr(err);
|
|
||||||
} else {
|
|
||||||
if (data) {
|
|
||||||
data = JSON.parse(data);
|
|
||||||
$.friendTree = data.resultData.data;
|
|
||||||
} else {
|
|
||||||
that.log(`京豆api返回数据为空,请检查自身原因`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (eor) {
|
|
||||||
$.logErr(eor, err)
|
|
||||||
} finally {
|
|
||||||
resolve()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
//偷好友金果API
|
|
||||||
async function stealFruit(friendPin, stoleId) {
|
|
||||||
await $.wait(1000); //歇口气儿, 不然会报操作频繁
|
|
||||||
const params = {
|
|
||||||
"source": 2,
|
|
||||||
"friendPin": friendPin,
|
|
||||||
"stoleId": stoleId,
|
|
||||||
"riskDeviceParam": {
|
|
||||||
"eid": "",
|
|
||||||
"dt": "",
|
|
||||||
"ma": "",
|
|
||||||
"im": "",
|
|
||||||
"os": "",
|
|
||||||
"osv": "",
|
|
||||||
"ip": "",
|
|
||||||
"apid": "",
|
|
||||||
"ia": "",
|
|
||||||
"uu": "",
|
|
||||||
"cv": "",
|
|
||||||
"nt": "",
|
|
||||||
"at": "1",
|
|
||||||
"fp": "",
|
|
||||||
"token": ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
params.riskDeviceParam = JSON.stringify(params.riskDeviceParam);//这一步,不可省略,否则提交会报错(和login接口一样)
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
$.post(taskurl('stealFruit', params), (err, resp, data) => {
|
|
||||||
try {
|
|
||||||
if (err) {
|
|
||||||
that.log("\n摇钱树京东API请求失败 ‼️‼️");
|
|
||||||
that.log(JSON.stringify(err));
|
|
||||||
$.logErr(err);
|
|
||||||
} else {
|
|
||||||
if (data) {
|
|
||||||
data = JSON.parse(data);
|
|
||||||
} else {
|
|
||||||
that.log(`京豆api返回数据为空,请检查自身原因`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (eor) {
|
|
||||||
$.logErr(eor, err)
|
|
||||||
} finally {
|
|
||||||
resolve(data)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
async function request(function_id, body = {}) {
|
|
||||||
await $.wait(1000); //歇口气儿, 不然会报操作频繁
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
$.post(taskurl(function_id, body), (err, resp, data) => {
|
|
||||||
try {
|
|
||||||
if (err) {
|
|
||||||
that.log("\n摇钱树京东API请求失败 ‼️‼️");
|
|
||||||
that.log(JSON.stringify(err));
|
|
||||||
$.logErr(err);
|
|
||||||
} else {
|
|
||||||
if (data) {
|
|
||||||
data = JSON.parse(data);
|
|
||||||
} else {
|
|
||||||
that.log(`京豆api返回数据为空,请检查自身原因`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (eor) {
|
|
||||||
$.msg("摇钱树-初始化个人信息" + eor.name + "‼️", JSON.stringify(eor), eor.message)
|
|
||||||
} finally {
|
|
||||||
resolve(data)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function taskurl(function_id, body) {
|
|
||||||
return {
|
|
||||||
url: JD_API_HOST + '/' + function_id + '?_=' + new Date().getTime() * 1000,
|
|
||||||
body: `reqData=${function_id === 'harvest' || function_id === 'login' || function_id === 'signIndex' || function_id === 'signOne' || function_id === 'setUserLinkStatus' || function_id === 'dayWork' || function_id === 'getSignAward' || function_id === 'sell' || function_id === 'friendRank' || function_id === 'friendTree' || function_id === 'stealFruit' ? encodeURIComponent(JSON.stringify(body)) : JSON.stringify(body)}`,
|
|
||||||
headers: {
|
|
||||||
'Accept': `application/json`,
|
|
||||||
'Origin': `https://uua.jr.jd.com`,
|
|
||||||
'Accept-Encoding': `gzip, deflate, br`,
|
|
||||||
'Cookie': cookie,
|
|
||||||
'Content-Type': `application/x-www-form-urlencoded;charset=UTF-8`,
|
|
||||||
'Host': `ms.jr.jd.com`,
|
|
||||||
'Connection': `keep-alive`,
|
|
||||||
'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.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"),
|
|
||||||
'Referer': `https://uua.jr.jd.com/uc-fe-wxgrowing/moneytree/index`,
|
|
||||||
'Accept-Language': `zh-cn`
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function TotalBean() {
|
|
||||||
return new Promise(async resolve => {
|
|
||||||
const options = {
|
|
||||||
url: "https://me-api.jd.com/user_new/info/GetJDUserInfoUnion",
|
|
||||||
headers: {
|
|
||||||
Host: "me-api.jd.com",
|
|
||||||
Accept: "*/*",
|
|
||||||
Connection: "keep-alive",
|
|
||||||
Cookie: cookie,
|
|
||||||
"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.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"),
|
|
||||||
"Accept-Language": "zh-cn",
|
|
||||||
"Referer": "https://home.m.jd.com/myJd/newhome.action?sceneval=2&ufc=&",
|
|
||||||
"Accept-Encoding": "gzip, deflate, br"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$.get(options, (err, resp, data) => {
|
|
||||||
try {
|
|
||||||
if (err) {
|
|
||||||
$.logErr(err)
|
|
||||||
} else {
|
|
||||||
if (data) {
|
|
||||||
data = JSON.parse(data);
|
|
||||||
if (data['retcode'] === "1001") {
|
|
||||||
$.isLogin = false; //cookie过期
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (data['retcode'] === "0" && data.data && data.data.hasOwnProperty("userInfo")) {
|
|
||||||
$.nickName = data.data.userInfo.baseInfo.nickname;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$.log('京东服务器返回空数据');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
$.logErr(e)
|
|
||||||
} finally {
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function jsonParse(str) {
|
|
||||||
if (typeof str == "string") {
|
|
||||||
try {
|
|
||||||
return JSON.parse(str);
|
|
||||||
} catch (e) {
|
|
||||||
that.log(e);
|
|
||||||
$.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//我加的函数
|
|
||||||
function postToDingTalk(messgae) {
|
|
||||||
const dingtalk = "https://oapi.dingtalk.com/robot/send?access_token=18444b555747aad3381bc1d1e3dea72b03158e152a846f818d82a1ca946bd430"
|
|
||||||
|
|
||||||
const message1 = "" + messgae
|
|
||||||
that.log(messgae)
|
|
||||||
|
|
||||||
const body = {
|
|
||||||
"msgtype": "markdown",
|
|
||||||
"markdown": {
|
|
||||||
"title":"动动摇钱树",
|
|
||||||
"text": message1
|
|
||||||
},
|
|
||||||
"at": {
|
|
||||||
"atMobiles": [],
|
|
||||||
"isAtAll": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$.post(toDingtalk(dingtalk,JSON.stringify(body)), (data,status,xhr)=>{
|
|
||||||
try {
|
|
||||||
that.log(resp)
|
|
||||||
that.log(data)
|
|
||||||
if (err) {
|
|
||||||
that.log(JSON.stringify(err));
|
|
||||||
$.logErr(err);
|
|
||||||
} else {
|
|
||||||
if (safeGet(data)) {
|
|
||||||
$.duckRes = JSON.parse(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
$.logErr(e, resp)
|
|
||||||
} finally {
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
},"json")
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function toDingtalk(urlmain, bodyMain) {
|
|
||||||
return {
|
|
||||||
url: urlmain,
|
|
||||||
body:bodyMain,
|
|
||||||
headers: { 'Content-Type': 'application/json;charset=utf-8' },
|
|
||||||
timeout: 10000,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function getPic(){
|
|
||||||
let code = ["1.gif","2.png","3.png","4.png","5.gif","6.gif","7.gif","8.gif","9.gif","10.png","11.png"]
|
|
||||||
let address = "\n\n )
|
|
||||||
address = address + code[pos] + ")"
|
|
||||||
return address
|
|
||||||
}
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user