2020-11-10 09:29:58 +08:00
|
|
|
|
/**
|
2020-12-16 11:07:38 +08:00
|
|
|
|
宠汪汪邀请助力与赛跑助力脚本,感谢github@Zero-S1提供帮助
|
2021-01-07 14:05:50 +08:00
|
|
|
|
更新时间:2021-1-7(宠汪汪助力更新Token的配置正则表达式已改)
|
2021-01-27 10:47:52 +08:00
|
|
|
|
活动入口:京东APP我的-更多工具-宠汪汪
|
2020-12-16 11:07:38 +08:00
|
|
|
|
token时效很短,几个小时就失效了,闲麻烦的放弃就行
|
|
|
|
|
|
每天拿到token后,可一次性运行完毕即可。
|
|
|
|
|
|
互助码friendPin是京东用户名,不是昵称(可在京东APP->我的->设置 查看获得)
|
|
|
|
|
|
token获取途径:
|
|
|
|
|
|
1、微信搜索'来客有礼'小程序,登陆京东账号,点击底部的'我的'或者'发现'两处地方,即可获取Token,脚本运行提示token失效后,继续按此方法获取即可
|
|
|
|
|
|
2、或者每天去'来客有礼'小程序->宠汪汪里面,领狗粮->签到领京豆 也可获取Token(此方法每天只能获取一次)
|
|
|
|
|
|
脚本里面有内置提供的friendPin,如果你没有修改脚本或者BoxJs处填写自己的互助码,会默认给脚本内置的助力。
|
2020-11-12 16:04:37 +08:00
|
|
|
|
[MITM]
|
|
|
|
|
|
hostname = draw.jdfcloud.com
|
|
|
|
|
|
|
2021-01-21 11:19:08 +08:00
|
|
|
|
===========Surge=================
|
2020-11-12 16:04:37 +08:00
|
|
|
|
[Script]
|
2021-01-28 14:27:50 +08:00
|
|
|
|
宠汪汪邀请助力与赛跑助力 = type=cron,cronexp="15 10 * * *",wake-system=1,timeout=3600,script-path=https://gitee.com/lxk0301/jd_scripts/raw/master/jd_joy_run.js
|
|
|
|
|
|
宠汪汪助力更新Token = type=http-response,pattern=^https:\/\/draw\.jdfcloud\.com(\/mirror)?\/\/api\/user\/addUser\?code=, requires-body=1, max-size=0, script-path=https://gitee.com/lxk0301/jd_scripts/raw/master/jd_joy_run.js
|
|
|
|
|
|
宠汪汪助力获取Token = type=http-request,pattern=^https:\/\/draw\.jdfcloud\.com(\/mirror)?\/\/api\/user\/user\/detail\?openId=, requires-body=1, max-size=0, script-path=https://gitee.com/lxk0301/jd_scripts/raw/master/jd_joy_run.js
|
2020-11-12 16:04:37 +08:00
|
|
|
|
|
2021-01-21 11:19:08 +08:00
|
|
|
|
===================Quantumult X=====================
|
2020-11-12 16:04:37 +08:00
|
|
|
|
[task_local]
|
|
|
|
|
|
# 宠汪汪邀请助力与赛跑助力
|
2021-01-28 14:27:50 +08:00
|
|
|
|
15 10 * * * https://gitee.com/lxk0301/jd_scripts/raw/master/jd_joy_run.js, tag=宠汪汪邀请助力与赛跑助力, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdcww.png, enabled=true
|
2020-11-12 16:04:37 +08:00
|
|
|
|
[rewrite_local]
|
|
|
|
|
|
# 宠汪汪助力更新Token
|
2021-01-28 14:27:50 +08:00
|
|
|
|
^https:\/\/draw\.jdfcloud\.com(\/mirror)?\/\/api\/user\/addUser\?code= url script-response-body https://gitee.com/lxk0301/jd_scripts/raw/master/jd_joy_run.js
|
2020-11-12 16:04:37 +08:00
|
|
|
|
# 宠汪汪助力获取Token
|
2021-01-28 14:27:50 +08:00
|
|
|
|
^https:\/\/draw\.jdfcloud\.com(\/mirror)?\/\/api\/user\/user\/detail\?openId= url script-request-header https://gitee.com/lxk0301/jd_scripts/raw/master/jd_joy_run.js
|
2020-11-12 16:04:37 +08:00
|
|
|
|
|
2021-01-21 11:19:08 +08:00
|
|
|
|
=====================Loon=====================
|
2020-11-12 16:04:37 +08:00
|
|
|
|
[Script]
|
2021-01-28 14:27:50 +08:00
|
|
|
|
cron "15 10 * * *" script-path=https://gitee.com/lxk0301/jd_scripts/raw/master/jd_joy_run.js, tag=宠汪汪邀请助力与赛跑助力
|
|
|
|
|
|
http-response ^https:\/\/draw\.jdfcloud\.com(\/mirror)?\/\/api\/user\/addUser\?code= script-path=https://gitee.com/lxk0301/jd_scripts/raw/master/jd_joy_run.js, requires-body=true, timeout=3600, tag=宠汪汪助力更新Token
|
|
|
|
|
|
http-request ^https:\/\/draw\.jdfcloud\.com(\/mirror)?\/\/api\/user\/user\/detail\?openId= script-path=https://gitee.com/lxk0301/jd_scripts/raw/master/jd_joy_run.js, requires-body=true, timeout=3600, tag=宠汪汪助力获取Token
|
2020-11-10 09:29:58 +08:00
|
|
|
|
**/
|
|
|
|
|
|
const isRequest = typeof $request != "undefined"
|
2020-11-27 19:02:13 +08:00
|
|
|
|
const $ = new Env('宠汪汪赛跑');
|
2020-11-10 09:29:58 +08:00
|
|
|
|
const JD_BASE_API = `https://draw.jdfcloud.com//pet`;
|
|
|
|
|
|
//此处填入你需要助力好友的京东用户名
|
2020-12-05 14:46:18 +08:00
|
|
|
|
//下面给出好友邀请助力的示例填写规则
|
2021-02-05 12:28:21 +08:00
|
|
|
|
let invite_pins = ["jd_6cd93e613b0e5,被折叠的记忆33,jd_704a2e5e28a66,jd_45a6b5953b15b,zooooo58,jd_66f5cecc1efcd,jd_41345a6f96aa5,jd_sIhNpDXJehOr,jd_mCbhXxmqzYJC"];
|
2020-12-05 14:46:18 +08:00
|
|
|
|
//下面给出好友赛跑助力的示例填写规则
|
2021-01-30 12:57:01 +08:00
|
|
|
|
let run_pins = ["被折叠的记忆33,jd_6cd93e613b0e5,jd_45a6b5953b15b,jd_66f5cecc1efcd,jd_sIhNpDXJehOr,jd_41345a6f96aa5,jd_704a2e5e28a66,zooooo58"];
|
2020-11-10 09:29:58 +08:00
|
|
|
|
// $.LKYLToken = '76fe7794c475c18711e3b47185f114b5' || $.getdata('jdJoyRunToken');
|
2020-11-29 20:47:03 +08:00
|
|
|
|
// $.LKYLToken = $.getdata('jdJoyRunToken');
|
2021-02-05 12:28:21 +08:00
|
|
|
|
const friendsArr = ["被折叠的记忆33","jd_7557b5f882acf","1209815-33190621","voxb","jd_60c91968f5779","Imnotwhoiam","tracyxu123","jacky_ma","虎贲1937","gdxx_hhw_m","13966269193_p","lxm3719","精神还是病","冬天冬至110","cocoty","jd_7bd7fb4cb6f82","yinlang46","jd_78f0d6524a1dc","wdxDdEiHWGeRxb","lxd5088","281309140","ypqian","jd_53df36eb204a0","henry1927_m","jd_752603c55d5d3","hnlymx","苏素红","hunter5213","wuyaoxin2012","setsail11","529577509-275616","15817094457_p","xyyshy1983","wdZFjkEVSAdaFy","88333498-57398981","jd_6610ed573c95e","wgrid","yhr_19820404","jd_76b37bc4f48dc","jd_7a9fbd6b875e7","jd_717cd34f51296","jd_6e348ece13e20","hqt_1988","花开花花落","jd_5a1329af66692","13872993806_p","chenshijie0416","P1neapple_m","明子溪","jd_59a9823f35496","jd_5b7cc9e532426","知足常乐自由飞翔","tangtangxiaoyue","jd_67c3f5c60aed7","cxhhcn","jd_56b0de7d9f47d","jd_611e082213c89","jd_4ab1734a949f1","354392569-110871","jd_5ff306cf94512","velennhk","jd_412498c6eeeb8","josua","蜜糖向日葵","jd_72311671abe3d","13008094886_p","wonghe","jd_4ba477ae26ff1","1069705301_m","lylflf123","jd_DzskmAWqwzlD","yangkaixiang","jd_592b225e3e263","jd_413d4539c4263","13902581495_p","天涯82301952","chamy99","hnlygudu","4607127-36658554","houjielala","kevinlen","204570195-134844","jd_vadDHUsmpSYm","jd_4fd63de4a6033","jd_461e384274c34","jd_41f7147738121","1147051-91577601","yang20678","jd_5b989f697d6e2","129867657-673064","佑一的夏天","jd_7f7814d692897","jd_7b6d6e7dc98f1","772826997_m","jd_FmcKiIMtOwpC","jd_63423cd594e8b","jd_71e77d9235cf5","ningjingde_meh","188810721-227782","dreamscometrue5120","云中鹤乐乐","jd_57156ec970076","623466-89793308","cq101030840","csmkaka","jd_4e4d9825e5fb1","jd_437b4f3fa5d83","gaohan0219","jd_DtamhJbBfTIb","jd_7b4b5a8207d90","fengduyidi","greatyunyun","jd_61683425167e6","jd_706c8fdab45af","jason7614","shevon85","失控de节奏","q_07","13166644472_p","aady丶","xiqial_m","jd_458825ccc2eb4","36453197-121619","jd_599646a803846","52032415-82431850","jd_6f916d2e318be","pan-guang","4349小丢丢","jd_7d33469dff8c5","q345665092","twogen","jd_6968d7dc24ba0","ququkoko","367210784-17070766","jd_610ec35319099","jd_5d7bcae4e6d17","jd_704a3e2d9c46b","jd_733ee77e8ca16","jd_502948d2b0e71","我爱玩游戏2012","15207695569_p","jd_6edb943cacbfb","jd_480c67e5d8819","limi363","MISCX","jd_7c8a7ad41e0c8","605612253_m","209649430-287793","jd_76d611ba9afaf","873937-50303892","jd_6064c9214e522","1176058947_m","31925640-481429","jd_423b97887f61d","zhouhuayh","雁南飞羊羊得亿","jd_63cd74e16d144","jd_539dc4aa25ed6","蒋周南19620607","jd_7c19732d17448","jd_618297dc33911","llbai11","jd_4a2970c6c6b09","jd_BvfYUytnBqQv","1123034-76073227","rockglass","jd_455da88071d1e","jd_7a4f6e65ca98f","jd_6f072cb5d59bf","hpseed001","tracyxyan","794826119-974749","jd_bUHzjYIiUkdk","jd_4d82dc61d0857","jd_706bb2ae5d924","q373456281","jd_7688619214526","jd_4a820fdf116dd","绿萝贝贝0708","jd_vuJPKtkTgnDy","ceiltop","lhx1220","zjw10wei32_m","怡秋","diablocp","983446382_m","1127157758-394132","754634469_m","1298361-36459413","jd_BeHLshNirani","caibaibai","18666404632_p","3818286-73685755","jd_481a39523f173","84795326-80349196","jd_76bef217859df","18923155789_p","wdypuifGSRbDln","418001066_m","6ird","540206926_m","jd_478f44263fce3","wdudNUlfawPZPg","jd_54ddb8af5374a","哎哟猪呀","qieziting","hujie5592427","jd_704a0d02ed793","jd_IfjaGQtbblpB","jd_68179e65e9fbd","niuming13603880535","wdNKCEOZqTqXTAT","鬼魅英雄","13453395506_p","wdQMkwHgxvotDX","jd_709659bfcd3d8","jd_66d25f1dd3267","jd_iFnquhpWWAzO","123by456","13916051043","scgameboy","jd_5db2a90394adb","Swiss-Knife","xunxun1982","jd_BLiGRtQCzhDE","skypjsfly","akingaja","jd_53f0d5608779c","jd_49edae2964101","jd_41cfa9d67438f","350402604-69748236","zhangshibao","KleinerSou_m","18311575050_p","18027486801_p","唯若linaa","1446025433-328227","龙岩","wdNRUvbJItetlvB","jd_rDYpRlFpvOcX","jd_6fc455fddb72a","jd_7c125a19294c1","陶子72","jd_5a80254ee91c6","zues1","sh19890627","jd_40a5adaba1d38","jd_602fdb17dfd69","jd_7b3e2647bb6c3","13631429708_p","8438837289","jd_40
|
2020-12-16 11:07:38 +08:00
|
|
|
|
|
2020-11-10 09:29:58 +08:00
|
|
|
|
//Node.js用户请在jdCookie.js处填写京东ck;
|
|
|
|
|
|
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
|
|
|
|
|
|
//IOS等用户直接用NobyDa的jd cookie
|
|
|
|
|
|
let cookiesArr = [], cookie = '';
|
|
|
|
|
|
const headers = {
|
|
|
|
|
|
'Connection' : 'keep-alive',
|
|
|
|
|
|
'Accept-Encoding' : 'gzip, deflate, br',
|
|
|
|
|
|
'App-Id' : '',
|
|
|
|
|
|
'Lottery-Access-Signature' : '',
|
|
|
|
|
|
'Content-Type' : 'application/json',
|
|
|
|
|
|
'reqSource' : 'weapp',
|
2021-01-12 14:01:32 +08:00
|
|
|
|
'User-Agent' : $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0"),
|
2020-11-10 09:29:58 +08:00
|
|
|
|
'Cookie' : '',
|
|
|
|
|
|
'openId' : '',
|
|
|
|
|
|
'Host' : 'draw.jdfcloud.com',
|
|
|
|
|
|
'Referer' : 'https://servicewechat.com/wxccb5c536b0ecd1bf/633/page-frame.html',
|
|
|
|
|
|
'Accept-Language' : 'zh-cn',
|
|
|
|
|
|
'Accept' : '*/*',
|
|
|
|
|
|
'LKYLToken' : ''
|
|
|
|
|
|
}
|
|
|
|
|
|
if ($.isNode()) {
|
|
|
|
|
|
Object.keys(jdCookieNode).forEach((item) => {
|
|
|
|
|
|
cookiesArr.push(jdCookieNode[item])
|
|
|
|
|
|
})
|
|
|
|
|
|
} else {
|
|
|
|
|
|
//支持 "京东多账号 Ck 管理"的cookie
|
|
|
|
|
|
let cookiesData = $.getdata('CookiesJD') || "[]";
|
|
|
|
|
|
cookiesData = jsonParse(cookiesData);
|
|
|
|
|
|
cookiesArr = cookiesData.map(item => item.cookie);
|
2020-12-11 16:39:20 +08:00
|
|
|
|
cookiesArr.reverse();
|
|
|
|
|
|
cookiesArr.push(...[$.getdata('CookieJD2'), $.getdata('CookieJD')]);
|
|
|
|
|
|
cookiesArr.reverse();
|
2020-12-24 10:21:47 +08:00
|
|
|
|
cookiesArr = cookiesArr.filter(item => item !== "" && item !== null && item !== undefined);
|
2020-11-10 09:29:58 +08:00
|
|
|
|
if ($.getdata('jd_joy_invite_pin')) {
|
|
|
|
|
|
invite_pins = [];
|
|
|
|
|
|
invite_pins.push($.getdata('jd_joy_invite_pin'));
|
|
|
|
|
|
}
|
|
|
|
|
|
if ($.getdata('jd2_joy_invite_pin')) {
|
|
|
|
|
|
if (invite_pins.length > 0) {
|
|
|
|
|
|
invite_pins.push($.getdata('jd2_joy_invite_pin'))
|
|
|
|
|
|
} else {
|
|
|
|
|
|
invite_pins = [];
|
|
|
|
|
|
invite_pins.push($.getdata('jd2_joy_invite_pin'));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if ($.getdata('jd_joy_run_pin')) {
|
|
|
|
|
|
run_pins = []
|
|
|
|
|
|
run_pins.push($.getdata('jd_joy_run_pin'));
|
|
|
|
|
|
}
|
|
|
|
|
|
if ($.getdata('jd2_joy_run_pin')) {
|
|
|
|
|
|
if (run_pins.length > 0) {
|
|
|
|
|
|
run_pins.push($.getdata('jd2_joy_run_pin'))
|
|
|
|
|
|
} else {
|
|
|
|
|
|
run_pins = [];
|
|
|
|
|
|
run_pins.push($.getdata('jd2_joy_run_pin'));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//获取来客有礼Token
|
2020-11-29 20:47:03 +08:00
|
|
|
|
let count = 0;
|
2020-11-30 13:57:11 +08:00
|
|
|
|
async function getToken() {
|
2020-11-10 09:29:58 +08:00
|
|
|
|
const url = $request.url;
|
|
|
|
|
|
$.log(`${$.name}url\n${url}\n`)
|
2020-11-13 01:19:27 +08:00
|
|
|
|
if (isURL(url, /^https:\/\/draw\.jdfcloud\.com(\/mirror)?\/\/api\/user\/addUser\?code=/)) {
|
2020-11-10 09:29:58 +08:00
|
|
|
|
const body = JSON.parse($response.body);
|
2020-11-27 18:41:19 +08:00
|
|
|
|
const LKYLToken = body.data && body.data.token;
|
|
|
|
|
|
if (LKYLToken) {
|
|
|
|
|
|
$.log(`${$.name} token\n${LKYLToken}\n`);
|
2020-11-28 09:56:26 +08:00
|
|
|
|
count = $.getdata('countFlag') ? $.getdata('countFlag') * 1 : 0;
|
|
|
|
|
|
count ++;
|
2020-11-27 18:41:19 +08:00
|
|
|
|
console.log(`count: ${count}`)
|
2020-11-28 09:56:26 +08:00
|
|
|
|
$.setdata(`${count}`, 'countFlag');
|
|
|
|
|
|
if ($.getdata('countFlag') * 1 === 3) {
|
2020-11-27 18:41:19 +08:00
|
|
|
|
count = 0;
|
2020-11-28 09:56:26 +08:00
|
|
|
|
$.setdata(`${count}`, 'countFlag');
|
2020-11-27 19:02:13 +08:00
|
|
|
|
$.msg($.name, '更新Token: 成功🎉', ``);
|
2020-11-29 20:47:03 +08:00
|
|
|
|
console.log(`开始上传Token`)
|
2021-01-17 14:29:30 +08:00
|
|
|
|
await $.http.get({url: `http://jd.turinglabs.net/api/v2/jd/joy/create/${LKYLToken}/`}).then((resp) => {
|
2020-11-29 20:47:03 +08:00
|
|
|
|
if (resp.statusCode === 200) {
|
|
|
|
|
|
let { body } = resp;
|
|
|
|
|
|
console.log(`Token提交结果:${body}`)
|
|
|
|
|
|
body = JSON.parse(body);
|
|
|
|
|
|
console.log(`${body.message}`)
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2020-11-27 18:41:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
$.setdata(LKYLToken, 'jdJoyRunToken');
|
2020-11-10 09:29:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
$.done({ body: JSON.stringify(body) })
|
2020-11-13 01:19:27 +08:00
|
|
|
|
} else if (isURL(url, /^https:\/\/draw\.jdfcloud\.com(\/mirror)?\/\/api\/user\/user\/detail\?openId=/)){
|
2020-11-10 09:29:58 +08:00
|
|
|
|
if ($request && $request.method !== 'OPTIONS') {
|
|
|
|
|
|
const LKYLToken = $request.headers['LKYLToken'];
|
|
|
|
|
|
//if ($.getdata('jdJoyRunToken')) {
|
|
|
|
|
|
//if ($.getdata('jdJoyRunToken') !== LKYLToken) {
|
|
|
|
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
//$.msg($.name, '更新获取Token: 成功🎉', `\n${LKYLToken}\n`);
|
|
|
|
|
|
//} else {
|
|
|
|
|
|
//$.msg($.name, '获取Token: 成功🎉', `\n${LKYLToken}\n`);
|
|
|
|
|
|
//}
|
|
|
|
|
|
$.setdata(LKYLToken, 'jdJoyRunToken');
|
|
|
|
|
|
|
2020-11-27 19:02:13 +08:00
|
|
|
|
$.msg($.name, '获取Token: 成功🎉', ``);
|
2020-11-10 09:29:58 +08:00
|
|
|
|
|
|
|
|
|
|
// $.done({ body: JSON.stringify(body) })
|
|
|
|
|
|
$.done({ url: url })
|
|
|
|
|
|
}
|
2020-11-16 17:26:23 +08:00
|
|
|
|
} else {
|
2020-11-27 18:41:19 +08:00
|
|
|
|
$.done()
|
2020-11-10 09:29:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-11-29 20:47:03 +08:00
|
|
|
|
function readToken() {
|
2020-11-30 13:57:11 +08:00
|
|
|
|
return new Promise(resolve => {
|
2021-01-17 14:29:30 +08:00
|
|
|
|
$.get({url: `http://jd.turinglabs.net/api/v2/jd/joy/read/1/`, 'timeout': 10000}, (err, resp, data) => {
|
2020-11-29 20:47:03 +08:00
|
|
|
|
try {
|
|
|
|
|
|
if (err) {
|
|
|
|
|
|
console.log(`${JSON.stringify(err)}`)
|
|
|
|
|
|
console.log(`${$.name} API请求失败,请检查网路重试`)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
if (data) {
|
|
|
|
|
|
console.log(data)
|
|
|
|
|
|
data = JSON.parse(data);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
$.logErr(e, resp)
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
resolve(data);
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2020-11-10 09:29:58 +08:00
|
|
|
|
async function main() {
|
|
|
|
|
|
if (!cookiesArr[0]) {
|
2021-01-09 13:53:14 +08:00
|
|
|
|
$.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
|
2020-11-10 09:29:58 +08:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
2020-11-30 13:57:11 +08:00
|
|
|
|
const readTokenRes = await readToken();
|
|
|
|
|
|
if (readTokenRes && readTokenRes.code === 200) {
|
|
|
|
|
|
$.LKYLToken = readTokenRes.data[0] || $.getdata('jdJoyRunToken');
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$.LKYLToken = $.getdata('jdJoyRunToken');
|
|
|
|
|
|
}
|
|
|
|
|
|
// $.LKYLToken = $.getdata('jdJoyRunToken');
|
2020-11-29 20:47:03 +08:00
|
|
|
|
console.log(`打印token \n${$.LKYLToken}\n`)
|
2020-11-10 09:29:58 +08:00
|
|
|
|
if (!$.LKYLToken) {
|
|
|
|
|
|
$.msg($.name, '【提示】请先获取来客有礼宠汪汪token', "微信搜索'来客有礼'小程序\n点击底部的'发现'Tab\n即可获取Token");
|
|
|
|
|
|
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;
|
|
|
|
|
|
$.inviteReward = 0;
|
|
|
|
|
|
$.runReward = 0;
|
|
|
|
|
|
console.log(`\n开始【京东账号${$.index}】${UserName}\n`);
|
|
|
|
|
|
$.jdLogin = true;
|
|
|
|
|
|
$.LKYLLogin = true;
|
|
|
|
|
|
console.log(`=============【开始邀请助力】===============`)
|
|
|
|
|
|
const inviteIndex = $.index > invite_pins.length ? (invite_pins.length - 1) : ($.index - 1);
|
2020-12-16 11:07:38 +08:00
|
|
|
|
let new_invite_pins = invite_pins[inviteIndex].split(',');
|
|
|
|
|
|
new_invite_pins = [...new_invite_pins, ...getRandomArrayElements(friendsArr, 6)];
|
2020-11-10 09:29:58 +08:00
|
|
|
|
await invite(new_invite_pins);
|
|
|
|
|
|
if ($.jdLogin && $.LKYLLogin) {
|
|
|
|
|
|
console.log(`===========【开始助力好友赛跑】===========`)
|
|
|
|
|
|
const runIndex = $.index > run_pins.length ? (run_pins.length - 1) : ($.index - 1);
|
|
|
|
|
|
const new_run_pins = run_pins[runIndex].split(',');
|
|
|
|
|
|
await run(new_run_pins);
|
|
|
|
|
|
}
|
2020-12-16 11:07:38 +08:00
|
|
|
|
await showMsg();
|
2020-11-10 09:29:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
$.done()
|
|
|
|
|
|
}
|
2020-12-16 11:07:38 +08:00
|
|
|
|
function showMsg() {
|
|
|
|
|
|
return new Promise(async resolve => {
|
|
|
|
|
|
if ($.inviteReward || $.runReward) {
|
|
|
|
|
|
let message = '';
|
2020-12-20 17:22:30 +08:00
|
|
|
|
if ($.inviteReward > 0) {
|
|
|
|
|
|
message += `给${$.inviteReward / 30}人邀请助力成功,获得${$.inviteReward}积分\n`;
|
|
|
|
|
|
}
|
|
|
|
|
|
if ($.runReward > 0) {
|
|
|
|
|
|
message += `给${$.runReward / 5}人赛跑助力成功,获得狗粮${$.runReward}g`;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (message) {
|
|
|
|
|
|
$.msg($.name, '', `京东账号${$.index} ${UserName}\n${message}`);
|
|
|
|
|
|
}
|
2020-12-16 11:07:38 +08:00
|
|
|
|
}
|
|
|
|
|
|
resolve();
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2020-11-10 09:29:58 +08:00
|
|
|
|
//邀请助力
|
|
|
|
|
|
async function invite(invite_pins) {
|
|
|
|
|
|
console.log(`账号${$.index} [${UserName}] 给下面名单的人进行邀请助力\n${invite_pins.map(item => item.trim())}\n`);
|
|
|
|
|
|
for (let item of invite_pins.map(item => item.trim())) {
|
|
|
|
|
|
console.log(`\n账号${$.index} [${UserName}] 开始给好友 [${item}] 进行邀请助力`)
|
|
|
|
|
|
const data = await enterRoom(item);
|
2021-01-06 16:02:25 +08:00
|
|
|
|
if (data) {
|
2021-01-06 16:20:10 +08:00
|
|
|
|
if (data.success) {
|
2021-01-06 16:02:25 +08:00
|
|
|
|
const { helpStatus } = data.data;
|
|
|
|
|
|
console.log(`helpStatus ${helpStatus}`)
|
|
|
|
|
|
if (helpStatus=== 'help_full') {
|
|
|
|
|
|
console.log(`您的邀请助力机会已耗尽\n`)
|
|
|
|
|
|
break;
|
|
|
|
|
|
} else if (helpStatus=== 'cannot_help') {
|
|
|
|
|
|
console.log(`已给该好友 ${item} 助力过或者此friendPin是你自己\n`)
|
|
|
|
|
|
continue;
|
|
|
|
|
|
} else if (helpStatus=== 'invite_full') {
|
|
|
|
|
|
console.log(`助力失败,该好友 ${item} 已经满3人给他助力了,无需您再次助力\n`)
|
|
|
|
|
|
continue;
|
|
|
|
|
|
} else if (helpStatus=== 'can_help') {
|
|
|
|
|
|
console.log(`开始给好友 ${item} 助力\n`)
|
|
|
|
|
|
const LKYL_DATA = await helpInviteFriend(item);
|
|
|
|
|
|
if (LKYL_DATA.errorCode === 'L0001' && !LKYL_DATA.success) {
|
|
|
|
|
|
console.log('来客有礼宠汪汪token失效');
|
|
|
|
|
|
$.setdata('', 'jdJoyRunToken');
|
|
|
|
|
|
$.msg($.name, '【提示】来客有礼token失效,请重新获取', "微信搜索'来客有礼'小程序\n点击底部的'发现'Tab\n即可获取Token")
|
|
|
|
|
|
$.LKYLLogin = false;
|
|
|
|
|
|
break
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$.LKYLLogin = true;
|
|
|
|
|
|
}
|
2020-11-10 09:29:58 +08:00
|
|
|
|
}
|
2021-01-06 16:02:25 +08:00
|
|
|
|
$.jdLogin = true;
|
2021-01-06 16:20:10 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
if (data.errorCode === 'B0001') {
|
|
|
|
|
|
console.log('京东Cookie失效');
|
2021-01-09 13:53:14 +08:00
|
|
|
|
$.msg($.name, `【提示】京东cookie已失效`, `京东账号${$.index} ${UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
|
2021-01-06 16:20:10 +08:00
|
|
|
|
$.jdLogin = false;
|
|
|
|
|
|
break
|
|
|
|
|
|
}
|
2020-11-10 09:29:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-12-16 11:07:38 +08:00
|
|
|
|
// if ($.inviteReward > 0) {
|
|
|
|
|
|
// $.msg($.name, ``, `账号${$.index} [${UserName}]\n给${$.inviteReward/5}人邀请助力成功\n获得${$.inviteReward}积分`)
|
|
|
|
|
|
// }
|
2020-11-10 09:29:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
function enterRoom(invitePin) {
|
|
|
|
|
|
return new Promise(resolve => {
|
|
|
|
|
|
headers.Cookie = cookie;
|
|
|
|
|
|
headers.LKYLToken = $.LKYLToken;
|
2021-01-07 14:05:50 +08:00
|
|
|
|
headers['Content-Type'] = "application/json";
|
2020-11-10 09:29:58 +08:00
|
|
|
|
const options = {
|
2021-01-06 16:20:10 +08:00
|
|
|
|
url: `${JD_BASE_API}/enterRoom/h5?reqSource=weapp&invitePin=${encodeURI(invitePin)}&inviteSource=task_invite&shareSource=weapp&inviteTimeStamp=${Date.now()}`,
|
|
|
|
|
|
body: '{}',
|
2020-11-10 09:29:58 +08:00
|
|
|
|
headers
|
|
|
|
|
|
}
|
2021-01-06 16:20:10 +08:00
|
|
|
|
$.post(options, (err, resp, data) => {
|
2020-11-10 09:29:58 +08:00
|
|
|
|
try {
|
|
|
|
|
|
if (err) {
|
2021-01-06 16:02:25 +08:00
|
|
|
|
$.log(`${$.name} API请求失败`)
|
|
|
|
|
|
$.log(JSON.stringify(err))
|
2020-11-10 09:29:58 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
// console.log('进入房间', data)
|
2021-01-07 14:05:50 +08:00
|
|
|
|
data = JSON.parse(data);
|
2020-11-10 09:29:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
$.logErr(e, resp)
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
resolve(data);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
function helpInviteFriend(friendPin) {
|
|
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
|
|
headers.Cookie = cookie;
|
|
|
|
|
|
headers.LKYLToken = $.LKYLToken;
|
|
|
|
|
|
const options = {
|
|
|
|
|
|
url: `${JD_BASE_API}/helpFriend?friendPin=${encodeURI(friendPin)}`,
|
|
|
|
|
|
headers
|
|
|
|
|
|
}
|
|
|
|
|
|
$.get(options, (err, resp, data) => {
|
|
|
|
|
|
try {
|
|
|
|
|
|
if (err) {
|
|
|
|
|
|
$.log('API请求失败')
|
|
|
|
|
|
$.logErr(JSON.stringify(err));
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$.log(`邀请助力结果:${data}`);
|
|
|
|
|
|
data = JSON.parse(data);
|
|
|
|
|
|
// {"errorCode":"help_ok","errorMessage":null,"currentTime":1600254297789,"data":29466,"success":true}
|
|
|
|
|
|
if (data.success && data.errorCode === 'help_ok') {
|
2020-12-16 11:07:38 +08:00
|
|
|
|
$.inviteReward += 30;
|
2020-11-10 09:29:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
$.logErr(e, resp)
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
resolve(data);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
//赛跑助力
|
|
|
|
|
|
async function run(run_pins) {
|
|
|
|
|
|
console.log(`账号${$.index} [${UserName}] 给下面名单的人进行赛跑助力\n${(run_pins.map(item => item.trim()))}\n`);
|
|
|
|
|
|
for (let item of run_pins.map(item => item.trim())) {
|
|
|
|
|
|
console.log(`\n账号${$.index} [${UserName}] 开始给好友 [${item}] 进行赛跑助力`)
|
|
|
|
|
|
const combatDetailRes = await combatDetail(item);
|
|
|
|
|
|
const { petRaceResult } = combatDetailRes.data;
|
|
|
|
|
|
console.log(`petRaceResult ${petRaceResult}`);
|
|
|
|
|
|
if (petRaceResult === 'help_full') {
|
|
|
|
|
|
console.log('您的赛跑助力机会已耗尽');
|
|
|
|
|
|
break;
|
|
|
|
|
|
} else if (petRaceResult === 'can_help') {
|
|
|
|
|
|
console.log(`开始赛跑助力好友 ${item}`)
|
|
|
|
|
|
const LKYL_DATA = await combatHelp(item);
|
|
|
|
|
|
if (LKYL_DATA.errorCode === 'L0001' && !LKYL_DATA.success) {
|
|
|
|
|
|
console.log('来客有礼宠汪汪token失效');
|
|
|
|
|
|
$.setdata('', 'jdJoyRunToken');
|
|
|
|
|
|
$.msg($.name, '【提示】来客有礼token失效,请重新获取', "微信搜索'来客有礼'小程序\n点击底部的'发现'Tab\n即可获取Token")
|
|
|
|
|
|
$.LKYLLogin = false;
|
|
|
|
|
|
break
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$.LKYLLogin = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-12-16 11:07:38 +08:00
|
|
|
|
// if ($.runReward > 0) {
|
|
|
|
|
|
// $.msg($.name, ``, `账号${$.index} [${UserName}]\n给${$.runReward/5}人赛跑助力成功\n获得狗粮${$.runReward}g`)
|
|
|
|
|
|
// }
|
2020-11-10 09:29:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
function combatHelp(friendPin) {
|
|
|
|
|
|
return new Promise(resolve => {
|
|
|
|
|
|
headers.Cookie = cookie;
|
|
|
|
|
|
headers.LKYLToken = $.LKYLToken;
|
|
|
|
|
|
const options = {
|
|
|
|
|
|
url: `${JD_BASE_API}/combat/help?friendPin=${encodeURI(friendPin)}`,
|
|
|
|
|
|
headers
|
|
|
|
|
|
}
|
|
|
|
|
|
$.get(options, (err, resp, data) => {
|
|
|
|
|
|
try {
|
|
|
|
|
|
if (err) {
|
|
|
|
|
|
$.log('API请求失败')
|
|
|
|
|
|
$.logErr(JSON.stringify(err));
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$.log(`赛跑助力结果${data}`);
|
|
|
|
|
|
data = JSON.parse(data);
|
|
|
|
|
|
// {"errorCode":"help_ok","errorMessage":null,"currentTime":1600479266133,"data":{"rewardNum":5,"helpStatus":"help_ok","newUser":false},"success":true}
|
|
|
|
|
|
if (data.errorCode === 'help_ok' && data.data.helpStatus === 'help_ok') {
|
|
|
|
|
|
console.log(`助力${friendPin}成功\n获得狗粮${data.data.rewardNum}g\n`);
|
|
|
|
|
|
$.runReward += data.data.rewardNum;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
$.logErr(e, resp)
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
resolve(data);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
function combatDetail(invitePin) {
|
|
|
|
|
|
return new Promise(resolve => {
|
|
|
|
|
|
headers.Cookie = cookie;
|
|
|
|
|
|
headers.LKYLToken = $.LKYLToken;
|
|
|
|
|
|
const options = {
|
|
|
|
|
|
url: `${JD_BASE_API}/combat/detail/v2?help=true&inviterPin=${encodeURI(invitePin)}`,
|
|
|
|
|
|
headers
|
|
|
|
|
|
}
|
|
|
|
|
|
$.get(options, (err, resp, data) => {
|
|
|
|
|
|
try {
|
|
|
|
|
|
if (err) {
|
|
|
|
|
|
$.log('API请求失败')
|
|
|
|
|
|
$.logErr(JSON.stringify(err));
|
|
|
|
|
|
} else {
|
|
|
|
|
|
data = JSON.parse(data);
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
$.logErr(e, resp)
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
resolve(data);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
function isURL(domain, reg) {
|
|
|
|
|
|
// const name = reg;
|
|
|
|
|
|
return reg.test(domain);
|
|
|
|
|
|
}
|
|
|
|
|
|
function jsonParse(str) {
|
|
|
|
|
|
if (typeof str == "string") {
|
|
|
|
|
|
try {
|
|
|
|
|
|
return JSON.parse(str);
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
console.log(e);
|
2020-12-15 09:34:31 +08:00
|
|
|
|
$.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
|
2020-11-10 09:29:58 +08:00
|
|
|
|
return [];
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-12-16 11:07:38 +08:00
|
|
|
|
function getRandomArrayElements(arr, count) {
|
|
|
|
|
|
let shuffled = arr.slice(0), i = arr.length, min = i - count, temp, index;
|
|
|
|
|
|
while (i-- > min) {
|
|
|
|
|
|
index = Math.floor((i + 1) * Math.random());
|
|
|
|
|
|
temp = shuffled[index];
|
|
|
|
|
|
shuffled[index] = shuffled[i];
|
|
|
|
|
|
shuffled[i] = temp;
|
|
|
|
|
|
}
|
|
|
|
|
|
return shuffled.slice(min);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-11-10 09:29:58 +08:00
|
|
|
|
isRequest ? getToken() : main();
|
2021-01-22 17:28:30 +08:00
|
|
|
|
function Env(t,e){"undefined"!=typeof process&&JSON.stringify(process.env).indexOf("GITHUB")>-1&&process.exit(0);class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,r)=>{t?i(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`🔔${this.name}, 开始!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const i=this.getdata(t);if(i)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,i)=>e(i))})}runScript(t,e){return new Promise(s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),n={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(n,(t,e,i)=>s(i))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"])
|