mirror of
https://github.com/shufflewzc/faker2.git
synced 2025-04-23 02:48:44 +08:00
update
This commit is contained in:
parent
17a7686017
commit
9707595792
@ -427,11 +427,16 @@ if(DisableIndex!=-1){
|
||||
TempBaipiao = "";
|
||||
strGuoqi="";
|
||||
console.log(`******开始查询【京东账号${$.index}】${$.nickName || $.UserName}*********`);
|
||||
|
||||
await TotalBean();
|
||||
//await TotalBean2();
|
||||
|
||||
if ($.beanCount == 0) {
|
||||
console.log("数据获取失败,等待30秒后重试....")
|
||||
await $.wait(30*1000);
|
||||
await TotalBean();
|
||||
}
|
||||
if ($.beanCount == 0) {
|
||||
console.log("疑似获取失败,等待10秒后用第二个接口试试....")
|
||||
await $.wait(10*1000);
|
||||
var userdata = await getuserinfo();
|
||||
if (userdata.code == 1) {
|
||||
$.beanCount = userdata.content.jdBean;
|
||||
@ -497,7 +502,7 @@ if(DisableIndex!=-1){
|
||||
TodayCache.push(tempAddCache);
|
||||
}
|
||||
|
||||
await getjdfruitinfo() //东东农场
|
||||
await getjdfruitinfo(); //东东农场
|
||||
await $.wait(1000);
|
||||
|
||||
await Promise.all([
|
||||
@ -2032,6 +2037,11 @@ function jdfruitRequest(function_id, body = {}, timeout = 1000) {
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
data = JSON.parse(data);
|
||||
if (data.code=="400"){
|
||||
console.log('东东农场: '+data.message);
|
||||
llgeterror = true;
|
||||
}
|
||||
else
|
||||
$.JDwaterEveryDayT = data.totalWaterTaskInit.totalWaterTaskTimes;
|
||||
}
|
||||
}
|
||||
@ -2056,6 +2066,9 @@ async function getjdfruitinfo() {
|
||||
"babelChannel": "120"
|
||||
});
|
||||
|
||||
if (llgeterror)
|
||||
return
|
||||
|
||||
await getjdfruit();
|
||||
if (llgeterror) {
|
||||
console.log(`东东农场API查询失败,等待10秒后再次尝试...`)
|
||||
@ -3053,7 +3066,7 @@ async function queryScores() {
|
||||
}
|
||||
|
||||
async function getuserinfo() {
|
||||
var body={"pin": "$cooMrdGatewayUid$"};
|
||||
var body=[{"pin": "$cooMrdGatewayUid$"}];
|
||||
var ua = `jdapp;iPhone;${random(["11.1.0", "10.5.0", "10.3.6"])};${random(["13.5", "14.0", "15.0"])};${uuidRandom()};network/wifi;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone11,6;addressid/7565095847;supportBestPay/0;appBuild/167541;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 13_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1`;
|
||||
|
||||
let config = {
|
||||
|
134
jd_beauty.js
134
jd_beauty.js
@ -1,24 +1,20 @@
|
||||
/*
|
||||
美丽研究院
|
||||
修复+尽量优化为同步执行,减少并发,说不定就减小黑号概率了呢?
|
||||
https://raw.githubusercontent.com/aTenb/jdOpenSharePicker/master/jd_beautyStudy.js
|
||||
更新时间:2021-12-03
|
||||
来源 Dylan
|
||||
定时自定义,集中访问可能炸
|
||||
活动入口:京东app首页-美妆馆-底部中间按钮
|
||||
#随机定时运行一次
|
||||
定时自定义,集中访问可能炸
|
||||
*/
|
||||
const $ = new Env('美丽研究院');
|
||||
const notify = $.isNode() ? require('./sendNotify') : '';
|
||||
console.log('连接服务器不稳定,能不能用随缘!!!')
|
||||
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
|
||||
|
||||
|
||||
const WebSocket = require('ws');
|
||||
const UA = process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)
|
||||
const JD_API_HOST = 'https://api.m.jd.com/client.action';
|
||||
$.accountCheck = true;
|
||||
$.init = false;
|
||||
let cookiesArr = [], cookie = '', message;
|
||||
|
||||
function oc(fn, defaultVal) {
|
||||
try {
|
||||
return fn()
|
||||
@ -26,7 +22,6 @@ function oc(fn, defaultVal) {
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
if ($.isNode()) {
|
||||
Object.keys(jdCookieNode).forEach((item) => {
|
||||
cookiesArr.push(jdCookieNode[item])
|
||||
@ -35,7 +30,7 @@ if ($.isNode()) {
|
||||
} 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/" });
|
||||
@ -55,7 +50,7 @@ if ($.isNode()) {
|
||||
$.nickName = '';
|
||||
message = '';
|
||||
$.token = '';
|
||||
//await TotalBean();
|
||||
await TotalBean();
|
||||
console.log(`\n******开始【京东账号${$.index}】${$.nickName || $.UserName}*********\n`);
|
||||
if (!$.isLogin) {
|
||||
$.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/`, { "open-url": "https://bean.m.jd.com/" });
|
||||
@ -66,7 +61,9 @@ if ($.isNode()) {
|
||||
continue
|
||||
}
|
||||
await accountCheck();
|
||||
await $.wait(10000)
|
||||
while (!$.hasDone) {
|
||||
await $.wait(3000)
|
||||
}
|
||||
if ($.accountCheck) {
|
||||
await jdBeauty();
|
||||
}
|
||||
@ -90,9 +87,9 @@ async function accountCheck() {
|
||||
await $.wait(10000)
|
||||
await getIsvToken2()
|
||||
await $.wait(10000)
|
||||
await getAuth()
|
||||
await getToken()
|
||||
await $.wait(10000)
|
||||
if (!$.token) {
|
||||
if (!$.token || !$.token2) {
|
||||
console.log(`\n\n提示:请尝试换服务器ip或者设置"xinruimz-isv.isvjcloud.com"域名直连,或者自定义UA再次尝试(环境变量JD_USER_AGENT)\n\n`)
|
||||
$.accountCheck = false;
|
||||
return
|
||||
@ -105,9 +102,9 @@ async function accountCheck() {
|
||||
client.onopen = async () => {
|
||||
console.log(`美容研究院服务器连接成功`);
|
||||
client.send('{"msg":{"type":"action","args":{"source":1},"action":"_init_"}}');
|
||||
await $.wait(20000);
|
||||
await $.wait(10000);
|
||||
client.send(`{"msg":{"type":"action","args":{"source":1},"action":"get_user"}}`);
|
||||
await $.wait(20000);
|
||||
await $.wait(10000);
|
||||
};
|
||||
client.onmessage = async function (e) {
|
||||
if (e.data !== 'pong' && e.data && safeGet(e.data)) {
|
||||
@ -146,6 +143,7 @@ async function jdBeauty() {
|
||||
async function mr() {
|
||||
$.coins = 0
|
||||
let positionList = ['b1', 'h1', 's1', 'b2', 'h2', 's2']
|
||||
let positionList2 = ['b2', 'h2', 's2']
|
||||
$.tokens = []
|
||||
$.pos = []
|
||||
$.helpInfo = []
|
||||
@ -167,18 +165,24 @@ async function mr() {
|
||||
await $.wait(10000);
|
||||
}
|
||||
console.log(`\n========生产任务相关========\n`)
|
||||
for (let help of helpInfo) {
|
||||
client.send(help);
|
||||
}
|
||||
await $.wait(3000)
|
||||
client.send(`{"msg":{"type":"action","args":{},"action":"get_produce_material"}}`)
|
||||
await $.wait(20000);
|
||||
await $.wait(10000);
|
||||
// 获得正在生产的商品信息
|
||||
client.send('{"msg":{"type":"action","args":{},"action":"product_producing"}}')
|
||||
await $.wait(20000);
|
||||
await $.wait(10000);
|
||||
// 获得库存
|
||||
client.send(`{"msg":{"type":"action","args":{},"action":"get_package"}}`)
|
||||
// 获得可生成的商品列表
|
||||
client.send(`{"msg":{"type":"action","args":{"page":1,"num":10},"action":"product_lists"}}`)
|
||||
await $.wait(20000);
|
||||
await $.wait(10000);
|
||||
// 获得原料生产列表
|
||||
for (let pos of positionList) {
|
||||
client.send(`{"msg":{"type":"action","args":{"position":"${pos}"},"action":"produce_position_info_v2"}}`)
|
||||
await $.wait(20000);
|
||||
await $.wait(10000);
|
||||
}
|
||||
console.log(`\n========日常任务相关========`)
|
||||
client.send(`{"msg":{"type":"action","args":{},"action":"check_up"}}`)
|
||||
@ -192,7 +196,7 @@ async function mr() {
|
||||
await $.wait(50000);
|
||||
//最后做时间最久的日常任务
|
||||
client.send(`{"msg":{"type":"action","args":{},"action":"shop_products"}}`)
|
||||
await $.wait(20000);
|
||||
await $.wait(10000);
|
||||
}
|
||||
};
|
||||
client.onclose = () => {
|
||||
@ -201,7 +205,10 @@ async function mr() {
|
||||
$.init = true;
|
||||
$.hasDone = true;
|
||||
for (let i = 0; i < $.pos.length && i < $.tokens.length; ++i) {
|
||||
$.helpInfo.push(`{"msg":{"type":"action","args":{"inviter_id":"${$.userInfo.id}","position":"${$.pos[i]}","token":"${$.tokens[i]}"},"action":"employee"}}`)
|
||||
client.send(`{"msg":{"type":"action","args":{"inviter_id":"${$.userInfo.id}"},"action":"employee_get_user"}}`);
|
||||
$.helpInfo.push(`{"msg":{"type":"action","args":{"inviter_id":"${$.userInfo.id}","position":"${$.pos[i]}","token":"${$.tokens[i]}"},"action":"employee_v2"}}`)
|
||||
client.send(`{"msg":{"type":"action","args":{"inviter_id":"${$.userInfo.id}","position":"${$.pos[i]}"},"action":"employee_speed_v2"}}`);
|
||||
client.send(`{"msg":{"action":"write","type":"action","args":{"action_type":3,"channel":2,"source_app":2}}}`);
|
||||
}
|
||||
};
|
||||
client.onmessage = async function (e) {
|
||||
@ -216,9 +223,9 @@ async function mr() {
|
||||
// 去签到
|
||||
console.log(`去做签到任务`)
|
||||
client.send(`{"msg":{"type":"action","args":{},"action":"sign_in"}}`)
|
||||
await $.wait(20000);
|
||||
await $.wait(10000);
|
||||
client.send(`{"msg":{"action":"write","type":"action","args":{"action_type":1,"channel":2,"source_app":2}}}`)
|
||||
await $.wait(20000);
|
||||
await $.wait(10000);
|
||||
}
|
||||
break
|
||||
case "get_user":
|
||||
@ -228,7 +235,7 @@ async function mr() {
|
||||
console.log(`去做新手任务`)
|
||||
for (let i = $.userInfo.step; i < 15; ++i) {
|
||||
client.send(`{"msg":{"type":"action","args":{},"action":"newcomer_update"}}`)
|
||||
await $.wait(20000);
|
||||
await $.wait(10000);
|
||||
}
|
||||
} else
|
||||
$.init = true;
|
||||
@ -281,10 +288,12 @@ async function mr() {
|
||||
}
|
||||
await $.wait(10000);
|
||||
}
|
||||
for (let i = $.taskState.meetingplace_view; i < $.taskState.mettingplace_count; ++i) {
|
||||
console.log(`去做第${i + 1}次浏览会场任务`)
|
||||
client.send(`{"msg":{"type":"action","args":{"source":1},"action":"meetingplace_view"}}`)
|
||||
await $.wait(10000);
|
||||
if ($.taskState.meetingplace_view.length <= vo.data.meetingplaces.length) {
|
||||
for (let vc of vo.data.meetingplaces) {
|
||||
console.log(`去做第${vc.name}浏览会场任务`)
|
||||
client.send(`{"msg":{"type":"action","args":{"source":1,"meetingplace_id":${vc.id}},"action":"meetingplace_view"}}`)
|
||||
await $.wait(2500)
|
||||
}
|
||||
}
|
||||
if ($.taskState.today_answered === 0) {
|
||||
console.log(`去做每日问答任务`)
|
||||
@ -356,7 +365,7 @@ async function mr() {
|
||||
client.send(`{"msg":{"type":"action","args":{"position":"${vo.data.position}","material_id":${ma.id}},"action":"material_produce_v2"}}`)
|
||||
await $.wait(5000);
|
||||
} else {
|
||||
ma = $.material.base[1]['items'][positionList.indexOf(vo.data.position)]
|
||||
ma = $.material.base[1]['items'][positionList2.indexOf(vo.data.position)]
|
||||
if (ma) {
|
||||
console.log(`else去生产${ma.name}`)
|
||||
client.send(`{"msg":{"type":"action","args":{"position":"${vo.data.position}","material_id":${ma.id}},"action":"material_produce_v2"}}`)
|
||||
@ -402,7 +411,7 @@ async function mr() {
|
||||
case "product_lists":
|
||||
let need_material = []
|
||||
if (vo.code === '200' || vo.code === 200) {
|
||||
$.products = vo.data.filter(vo=>vo.level===$.level)
|
||||
$.products = vo.data.filter(vo => vo.level === $.level - 1)
|
||||
console.log(`========可生产商品信息========`)
|
||||
for (let product of $.products) {
|
||||
let num = Infinity
|
||||
@ -431,6 +440,7 @@ async function mr() {
|
||||
console.log(`【${product.name}】可生产份数大于0,去生产`)
|
||||
//product_produce 产品研发里的生产
|
||||
client.send(`{"msg":{"type":"action","args":{"product_id":${product.id},"amount":${num}},"action":"product_produce"}}`)
|
||||
client.send(`{"msg":{"type":"action","args":{"product_id":${product.id},"amount":${num}},"action":"once_completion"}}`)
|
||||
await $.wait(10000);
|
||||
} else {
|
||||
console.log(msg)
|
||||
@ -494,9 +504,9 @@ async function mr() {
|
||||
for (let benefit of vo.data) {
|
||||
if (benefit.type === 1) { //type 1 是京豆
|
||||
//console.log(`benefit:${JSON.stringify(benefit)}`);
|
||||
if(benefit.description === "1 京豆" && parseInt(benefit.day_exchange_count) < 10 && $.total > benefit.coins){
|
||||
if (benefit.description === "1 京豆" && parseInt(benefit.day_exchange_count) < 5 && $.total > benefit.coins) {
|
||||
$timenum = parseInt($.total / benefit.coins);
|
||||
if ($timenum > 10) $timenum = 10;
|
||||
if ($timenum > 5) $timenum = 5;
|
||||
console.log(`\n可兑换${$timenum}次京豆:`)
|
||||
for (let i = 0; i < $timenum; i++) {
|
||||
client.send(`{"msg":{"type":"action","args":{"benefit_id":${benefit.id}},"action":"to_exchange"}}`);
|
||||
@ -518,7 +528,7 @@ async function mr() {
|
||||
break
|
||||
case "to_exchange":
|
||||
if (oc(() => vo.data.coins)) {
|
||||
console.log(`兑换${vo.data.coins/-1000}京豆成功`)
|
||||
console.log(`兑换${vo.data.coins / -10000}京豆成功`)
|
||||
} else {
|
||||
console.log(`兑换京豆失败`)
|
||||
}
|
||||
@ -526,15 +536,15 @@ async function mr() {
|
||||
case "get_produce_material":
|
||||
$.material = vo.data
|
||||
break
|
||||
case "to_employee":
|
||||
console.log(`雇佣助力码【${oc(() => vo.data.token)}】`)
|
||||
if(oc(() => vo.data.token)){
|
||||
$.tokens.push(vo.data.token)
|
||||
}else{
|
||||
console.log(`not exist:${oc(() => vo.data)}`)
|
||||
}
|
||||
break
|
||||
case "employee":
|
||||
//case "to_employee":
|
||||
// console.log(`雇佣助力码【${oc(() => vo.data.token)}】`)
|
||||
// if(oc(() => vo.data.token)){
|
||||
// $.tokens.push(vo.data.token)
|
||||
// }else{
|
||||
// console.log(`not exist:${oc(() => vo.data)}`)
|
||||
// }
|
||||
// break
|
||||
case "employee_v2":
|
||||
console.log(`${vo.msg}`)
|
||||
break
|
||||
}
|
||||
@ -564,7 +574,7 @@ function getIsvToken() {
|
||||
if (safeGet(data)) {
|
||||
data = JSON.parse(data);
|
||||
$.isvToken = data['tokenKey'];
|
||||
console.log(`isvToken:${$.isvToken}`);
|
||||
//console.log(`isvToken:${$.isvToken}`);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
@ -577,18 +587,24 @@ function getIsvToken() {
|
||||
}
|
||||
|
||||
async function getIsvToken2() {
|
||||
for (let i = 0; i < 3; i++) {
|
||||
var body = await getSignfromDY('isvObfuscator', { "id": "", "url": "https://xinruimz-isv.isvjcloud.com" })
|
||||
if (body) break;
|
||||
await $.wait(5000)
|
||||
}
|
||||
let config = {
|
||||
url: 'https://api.m.jd.com/client.action?functionId=isvObfuscator',
|
||||
body: await getSignfromDY('isvObfuscator',{"id":"","url":"https://xinruimz-isv.isvjcloud.com"}),
|
||||
body: body,
|
||||
headers: {
|
||||
'Host': 'api.m.jd.com',
|
||||
'accept': '*/*',
|
||||
'user-agent': UA,
|
||||
'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',
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
//'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',
|
||||
//'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': cookie
|
||||
}
|
||||
}
|
||||
|
||||
return new Promise(resolve => {
|
||||
$.post(config, async (err, resp, data) => {
|
||||
try {
|
||||
@ -599,7 +615,7 @@ async function getIsvToken2() {
|
||||
if (safeGet(data)) {
|
||||
data = JSON.parse(data);
|
||||
$.token2 = data['token']
|
||||
console.log(`token2:${$.token2}`);
|
||||
//console.log(`token2:${$.token2}`);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
@ -612,13 +628,13 @@ async function getIsvToken2() {
|
||||
}
|
||||
function getSignfromDY(functionId, body) {
|
||||
var strsign = '';
|
||||
let data = `functionId=${functionId}&body=${encodeURIComponent(JSON.stringify(body))}`
|
||||
let data = { 'fn': functionId, 'body': JSON.stringify(body) };
|
||||
return new Promise((resolve) => {
|
||||
let opt = {
|
||||
url: "https://jd.nbplay.xyz/dylan/getsign",
|
||||
body: data,
|
||||
url: "https://api.nolanstore.top/sign",
|
||||
body: JSON.stringify(data),
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Content-Type': 'application/json',
|
||||
}
|
||||
, timeout: 30000
|
||||
}
|
||||
@ -626,11 +642,9 @@ function getSignfromDY(functionId, body) {
|
||||
try {
|
||||
if (data) {
|
||||
data = JSON.parse(data);
|
||||
if (data && data.code == 0) {
|
||||
console.log("连接DY服务成功" );
|
||||
if (data.data){
|
||||
strsign = data.data || '';
|
||||
}
|
||||
if (data && data.body) {
|
||||
console.log("连接Nolan服务成功");
|
||||
strsign = data.body || '';
|
||||
if (strsign != '') {
|
||||
resolve(strsign);
|
||||
}
|
||||
@ -639,7 +653,7 @@ function getSignfromDY(functionId, body) {
|
||||
} else {
|
||||
console.log(data.msg);
|
||||
}
|
||||
}else{console.log('连接连接DY服务失败,重试。。。')}
|
||||
} else { console.log('连接服务失败,重试。。。') }
|
||||
} catch (e) {
|
||||
$.logErr(e, resp);
|
||||
} finally {
|
||||
@ -648,10 +662,10 @@ function getSignfromDY(functionId, body) {
|
||||
})
|
||||
})
|
||||
}
|
||||
function getAuth() {
|
||||
function getToken() {
|
||||
let config = {
|
||||
url: 'https://xinruimz-isv.isvjcloud.com/api/auth',
|
||||
body: JSON.stringify({"token":$.token2,"source":"01"}),
|
||||
body: JSON.stringify({ "token": $.token2, "source": "01", "channel": "meizhuangguandibudaohang" }),
|
||||
headers: {
|
||||
'Host': 'xinruimz-isv.isvjcloud.com',
|
||||
'Accept': 'application/x.jd-school-island.v1+json',
|
||||
@ -662,7 +676,7 @@ function getAuth() {
|
||||
'user-agent': UA,
|
||||
'Referer': 'https://xinruimz-isv.isvjcloud.com/logined_jd/',
|
||||
'Authorization': 'Bearer undefined',
|
||||
'Cookie': `IsvToken=${$.isvToken};`
|
||||
'Cookie': `IsvToken=${$.token2};`
|
||||
}
|
||||
}
|
||||
return new Promise(resolve => {
|
||||
|
Loading…
Reference in New Issue
Block a user