增加京喜农场互助码获取

This commit is contained in:
guyuexuan
2021-01-08 15:30:28 +08:00
parent b0a0812ce3
commit 491e7d121e

View File

@@ -244,7 +244,7 @@ function getJxFactory(){
try {
if (err) {
console.log(`${JSON.stringify(err)}`);
console.log(`喜工厂 API请求失败请检查网路重试`);
console.log(`喜工厂 API请求失败请检查网路重试`);
} else {
if (safeGet(data)) {
data = JSON.parse(data);
@@ -262,7 +262,7 @@ function getJxFactory(){
$.commodityDimId = production.commodityDimId;
$.encryptPin = data.user.encryptPin;
// subTitle = data.user.pin;
console.log(`【账号${$.index}${$.nickName || $.UserName}喜工厂】${data.user.encryptPin}`);
console.log(`【账号${$.index}${$.nickName || $.UserName}喜工厂】${data.user.encryptPin}`);
}
} else {
$.unActive = false; //标记是否开启了京喜活动或者选购了商品进行生产
@@ -289,6 +289,54 @@ function getJxFactory(){
);
})
}
function getJxNc(){
const JXNC_API_HOST = "https://wq.jd.com/";
function JXNC_taskurl(function_path, body) {
return {
url: `${JXNC_API_HOST}cubeactive/farm/${function_path}?${body}&farm_jstoken=&phoneid=&timestamp=&sceneval=2&g_login_type=1&_=${Date.now()}&g_ty=ls`,
headers: {
Cookie: cookie,
Accept: `*/*`,
Connection: `keep-alive`,
Referer: `https://st.jingxi.com/pingou/dream_factory/index.html`,
'Accept-Encoding': `gzip, deflate, br`,
Host: `wq.jd.com`,
'Accept-Language': `zh-cn`,
},
};
}
return new Promise(resolve => {
$.get(
JXNC_taskurl('query', `type=1`),
async (err, resp, data) => {
try {
if (err) {
console.log(`${JSON.stringify(err)}`);
console.log(`京喜农场 API请求失败请检查网路重试`);
} else {
data = data.match(/try\{Query\(([\s\S]*)\)\;\}catch\(e\)\{\}/)[1];
if (safeGet(data)) {
data = JSON.parse(data);
if (data["ret"] === 0) {
console.log(`【账号${$.index}${$.nickName || $.UserName})京喜农场】${data["smp"]}`);
}
} else {
console.log(`京喜农场返回值解析异常:${JSON.stringify(data)}`);
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve()
}
}
);
})
}
function getJdPet(){
const JDPet_API_HOST = "https://api.m.jd.com/client.action";
@@ -600,6 +648,7 @@ async function getShareCode() {
console.log(`======账号${$.index}开始======`)
await getJdFactory()
await getJxFactory()
await getJxNc()
await getJdPet()
await getPlantBean()
await getJDFruit()