mirror of
https://github.com/shufflewzc/faker2.git
synced 2025-04-23 02:48:44 +08:00
update
This commit is contained in:
parent
bc0d774295
commit
888ccc0451
1605
jd_fruit.js
1605
jd_fruit.js
File diff suppressed because one or more lines are too long
@ -10,16 +10,17 @@
|
|||||||
==========================Quantumultx=========================
|
==========================Quantumultx=========================
|
||||||
[task_local]
|
[task_local]
|
||||||
#jd免费水果
|
#jd免费水果
|
||||||
10 5,17 * * * jd_fruit_friend.js, tag=东东农场好友删减奖励, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdnc.png, enabled=true
|
10 2 * * * jd_fruit_friend.js, tag=东东农场好友删减奖励, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdnc.png, enabled=true
|
||||||
=========================Loon=============================
|
=========================Loon=============================
|
||||||
[Script]
|
[Script]
|
||||||
cron "10 5,17 * * *" script-path=jd_fruit_friend.js,tag=东东农场好友删减奖励
|
cron "10 2 * * *" script-path=jd_fruit_friend.js,tag=东东农场好友删减奖励
|
||||||
|
|
||||||
=========================Surge============================
|
=========================Surge============================
|
||||||
东东农场好友删减奖励 = type=cron,cronexp="10 5,17 * * *",wake-system=1,timeout=3600,script-path=jd_fruit_friend.js
|
东东农场好友删减奖励 = type=cron,cronexp="10 2 * * *",wake-system=1,timeout=3600,script-path=jd_fruit_friend.js
|
||||||
|
|
||||||
=========================小火箭===========================
|
=========================小火箭===========================
|
||||||
东东农场好友删减奖励 = type=cron,script-path=jd_fruit_friend.js, cronexpr="10 5,17 * * *", timeout=3600, enable=true
|
东东农场好友删减奖励 = type=cron,script-path=jd_fruit_friend.js, cronexpr="10 2 * * *", timeout=3600, enable=true
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
const $ = new Env('东东农场好友删减奖励');
|
const $ = new Env('东东农场好友删减奖励');
|
||||||
@ -32,7 +33,22 @@ let jdFruitBeanCard = false;//农场使用水滴换豆卡(如果出现限时活
|
|||||||
const JD_API_HOST = 'https://api.m.jd.com/client.action';
|
const JD_API_HOST = 'https://api.m.jd.com/client.action';
|
||||||
const urlSchema = `openjd://virtual?params=%7B%20%22category%22:%20%22jump%22,%20%22des%22:%20%22m%22,%20%22url%22:%20%22https://h5.m.jd.com/babelDiy/Zeus/3KSjXqQabiTuD1cJ28QskrpWoBKT/index.html%22%20%7D`;
|
const urlSchema = `openjd://virtual?params=%7B%20%22category%22:%20%22jump%22,%20%22des%22:%20%22m%22,%20%22url%22:%20%22https://h5.m.jd.com/babelDiy/Zeus/3KSjXqQabiTuD1cJ28QskrpWoBKT/index.html%22%20%7D`;
|
||||||
let NowHour = new Date().getHours();
|
let NowHour = new Date().getHours();
|
||||||
let llhelp=true;
|
let llhelp = true;
|
||||||
|
const fs = require('fs');
|
||||||
|
let boolneedUpdate = false;
|
||||||
|
let strShare = './Fruit_ShareCache.json';
|
||||||
|
let Fileexists = fs.existsSync(strShare);
|
||||||
|
let TempShareCache = [];
|
||||||
|
if (Fileexists) {
|
||||||
|
console.log("检测到东东农场缓存文件Fruit_ShareCache.json,载入...");
|
||||||
|
TempShareCache = fs.readFileSync(strShare, 'utf-8');
|
||||||
|
if (TempShareCache) {
|
||||||
|
TempShareCache = TempShareCache.toString();
|
||||||
|
TempShareCache = JSON.parse(TempShareCache);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let lnrun = 0;
|
||||||
|
let llgetshare = false;
|
||||||
!(async () => {
|
!(async () => {
|
||||||
await requireConfig();
|
await requireConfig();
|
||||||
if (!cookiesArr[0]) {
|
if (!cookiesArr[0]) {
|
||||||
@ -40,55 +56,83 @@ let llhelp=true;
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(llhelp){
|
if(llhelp){
|
||||||
console.log('开始收集您的互助码,用于好友删除与加好友操作');
|
console.log('\n【开始收集您的互助码,用于好友删除与加好友操作】\n');
|
||||||
for (let i = 0; i < cookiesArr.length; i++) {
|
for (let i = 0; i < cookiesArr.length; i++) {
|
||||||
if (cookiesArr[i]) {
|
if (cookiesArr[i]) {
|
||||||
cookie = cookiesArr[i];
|
cookie = cookiesArr[i];
|
||||||
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
|
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
|
||||||
$.index = i + 1;
|
$.index = i + 1;
|
||||||
$.isLogin = true;
|
$.isLogin = true;
|
||||||
$.nickName = '';
|
$.nickName = '';
|
||||||
await TotalBean();
|
await TotalBean();
|
||||||
if (!$.isLogin) {
|
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" });
|
$.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()) {
|
if ($.isNode()) {
|
||||||
await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
|
await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
message = '';
|
message = '';
|
||||||
subTitle = '';
|
subTitle = '';
|
||||||
option = {};
|
option = {};
|
||||||
$.retry = 0;
|
$.retry = 0;
|
||||||
await GetCollect();
|
llgetshare = false;
|
||||||
}
|
await GetCollect();
|
||||||
}
|
if(llgetshare){
|
||||||
}
|
await $.wait(5000);
|
||||||
for (let i = 0; i < cookiesArr.length; i++) {
|
lnrun++;
|
||||||
if (cookiesArr[i]) {
|
}
|
||||||
cookie = cookiesArr[i];
|
if(lnrun == 10){
|
||||||
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
|
console.log(`\n【访问接口次数达到10次,休息一分钟.....】\n`);
|
||||||
$.index = i + 1;
|
await $.wait(60*1000);
|
||||||
$.isLogin = true;
|
lnrun = 0;
|
||||||
$.nickName = '';
|
}
|
||||||
await TotalBean();
|
}
|
||||||
console.log(`\n开始【京东账号${$.index}】${$.nickName || $.UserName}\n`);
|
}
|
||||||
if (!$.isLogin) {
|
if (boolneedUpdate) {
|
||||||
$.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" });
|
var str = JSON.stringify(TempShareCache, null, 2);
|
||||||
|
fs.writeFile(strShare, str, function (err) {
|
||||||
if ($.isNode()) {
|
if (err) {
|
||||||
await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
|
console.log(err);
|
||||||
}
|
console.log("\n【缓存文件Fruit_ShareCache.json更新失败!】\n");
|
||||||
continue
|
} else {
|
||||||
|
console.log("\n【缓存文件Fruit_ShareCache.json更新成功!】\n");
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
message = '';
|
|
||||||
subTitle = '';
|
|
||||||
option = {};
|
|
||||||
$.retry = 0;
|
|
||||||
await jdFruit();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
console.log('\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();
|
||||||
|
console.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
|
||||||
|
}
|
||||||
|
message = '';
|
||||||
|
subTitle = '';
|
||||||
|
option = {};
|
||||||
|
$.retry = 0;
|
||||||
|
lnrun++;
|
||||||
|
await jdFruit();
|
||||||
|
if (lnrun == 5) {
|
||||||
|
console.log(`\n【访问接口次数达到5次,休息一分钟.....】\n`);
|
||||||
|
await $.wait(60 * 1000);
|
||||||
|
lnrun = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if ($.isNode() && allMessage && $.ctrTemp) {
|
if ($.isNode() && allMessage && $.ctrTemp) {
|
||||||
await notify.sendNotify(`${$.name}`, `${allMessage}`)
|
await notify.sendNotify(`${$.name}`, `${allMessage}`)
|
||||||
}
|
}
|
||||||
@ -164,18 +208,44 @@ async function receiveFriendInvite() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
async function GetCollect() {
|
async function GetCollect() {
|
||||||
try {
|
try {
|
||||||
await initForFarm();
|
console.log(`\n【京东账号${$.index}(${$.UserName})的${$.name}好友互助码】`);
|
||||||
if ($.farmInfo.farmUserPro) {
|
var llfound = false;
|
||||||
console.log(`\n【京东账号${$.index}(${$.UserName})的${$.name}互助码】${$.farmInfo.farmUserPro.shareCode}`);
|
var strShareCode = "";
|
||||||
newShareCodes.push($.farmInfo.farmUserPro.shareCode)
|
if (TempShareCache) {
|
||||||
} else {
|
for (let j = 0; j < TempShareCache.length; j++) {
|
||||||
console.log(`\n【京东账号${$.index}(${$.UserName})的${$.name}互助码】\n数据异常,使用City的互助码:4921b9fe76a340f695f9621b53f35cf5`);
|
if (TempShareCache[j].pt_pin == $.UserName) {
|
||||||
newShareCodes.push("4921b9fe76a340f695f9621b53f35cf5");
|
llfound = true;
|
||||||
|
strShareCode = TempShareCache[j].ShareCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!llfound) {
|
||||||
|
console.log($.UserName + "该账号无缓存,尝试联网获取互助码.....");
|
||||||
|
llgetshare=true;
|
||||||
|
await initForFarm();
|
||||||
|
if ($.farmInfo.farmUserPro) {
|
||||||
|
var tempAddCK = {};
|
||||||
|
strShareCode=$.farmInfo.farmUserPro.shareCode;
|
||||||
|
tempAddCK = {
|
||||||
|
"pt_pin": $.UserName,
|
||||||
|
"ShareCode": strShareCode
|
||||||
|
};
|
||||||
|
TempShareCache.push(tempAddCK);
|
||||||
|
//标识,需要更新缓存文件
|
||||||
|
boolneedUpdate = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strShareCode) {
|
||||||
|
console.log(`\n`+strShareCode);
|
||||||
|
newShareCodes.push(strShareCode)
|
||||||
|
} else {
|
||||||
|
console.log(`\n数据异常`);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
$.logErr(e);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
|
||||||
$.logErr(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// ========================API调用接口========================
|
// ========================API调用接口========================
|
||||||
//鸭子,点我有惊喜
|
//鸭子,点我有惊喜
|
||||||
@ -564,7 +634,7 @@ function TotalBean() {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
function request(function_id, body = {}, timeout = 1000) {
|
function request(function_id, body = {}, timeout = 2000) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
$.get(taskUrl(function_id, body), (err, resp, data) => {
|
$.get(taskUrl(function_id, body), (err, resp, data) => {
|
||||||
|
854
jd_fruit_help.js
Normal file
854
jd_fruit_help.js
Normal file
File diff suppressed because one or more lines are too long
1507
jd_fruit_task.js
Normal file
1507
jd_fruit_task.js
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user