This commit is contained in:
Faker 2023-01-07 18:38:39 +08:00
parent b70e12f2ba
commit 74c1af896e
4 changed files with 51 additions and 134 deletions

View File

@ -281,13 +281,6 @@ if(DisableIndex!=-1){
console.log("检测到设定关闭京喜牧场查询");
EnableJxMC=false;
}
//京喜工厂
let EnableJxGC=true;
DisableIndex=strDisableList.findIndex((item) => item === "京喜工厂");
if(DisableIndex!=-1){
console.log("检测到设定关闭京喜工厂查询");
EnableJxGC=false;
}
// 京东工厂
let EnableJDGC=true;
@ -505,7 +498,6 @@ if(DisableIndex!=-1){
cash(), //极速金币
jdJxMCinfo(), //京喜牧场
bean(), //京豆查询
getJxFactory(), //京喜工厂
getDdFactoryInfo(), // 京东工厂
jdCash(), //领现金
GetJxBeaninfo(), //喜豆查询
@ -2249,132 +2241,6 @@ async function JxmcGetRequest() {
})
}
// 惊喜工厂信息查询
async function getJxFactory() {
if (!EnableJxGC)
return;
return new Promise(async resolve => {
let infoMsg = "";
let strTemp = "";
await $.get(jxTaskurl('userinfo/GetUserInfo', `pin=&sharePin=&shareType=&materialTuanPin=&materialTuanId=&source=`, '_time,materialTuanId,materialTuanPin,pin,sharePin,shareType,source,zone'), async(err, resp, data) => {
try {
if (err) {
$.jxFactoryInfo = "";
//console.log("jx工厂查询失败" + err)
} else {
if (safeGet(data)) {
data = JSON.parse(data);
if (data['ret'] === 0) {
data = data['data'];
$.unActive = true; //标记是否开启了京喜活动或者选购了商品进行生产
if (data.factoryList && data.productionList) {
const production = data.productionList[0];
const factory = data.factoryList[0];
//const productionStage = data.productionStage;
$.commodityDimId = production.commodityDimId;
// subTitle = data.user.pin;
await GetCommodityDetails(); //获取已选购的商品信息
infoMsg = `${$.jxProductName}(${((production.investedElectric / production.needElectric) * 100).toFixed(0)}%`;
if (production.investedElectric >= production.needElectric) {
if (production['exchangeStatus'] === 1) {
infoMsg = `${$.jxProductName}已可兑换`;
$.jxFactoryReceive = `${$.jxProductName}`;
}
if (production['exchangeStatus'] === 3) {
if (new Date().getHours() === 9) {
infoMsg = `兑换超时,请重选商品!`;
}
}
// await exchangeProNotify()
} else {
strTemp = `,${((production.needElectric - production.investedElectric) / (2 * 60 * 60 * 24)).toFixed(0)}天)`;
if (strTemp == ",0天)")
infoMsg += ",今天)";
else
infoMsg += strTemp;
}
if (production.status === 3) {
infoMsg = "商品已失效,请重选商品!";
}
} else {
$.unActive = false; //标记是否开启了京喜活动或者选购了商品进行生产
if (!data.factoryList) {
infoMsg = ""
// $.msg($.name, '【提示】', `京东账号${$.index}[${$.nickName}]京喜工厂活动未开始\n请手动去京东APP->游戏与互动->查看更多->京喜工厂 开启活动`);
} else if (data.factoryList && !data.productionList) {
infoMsg = ""
}
}
}
} else {
console.log(`GetUserInfo异常${JSON.stringify(data)}`)
}
}
$.jxFactoryInfo = infoMsg;
// console.log(infoMsg);
} catch (e) {
$.logErr(e, resp)
}
finally {
resolve();
}
})
})
}
// 惊喜的Taskurl
function jxTaskurl(functionId, body = '', stk) {
let url = `https://m.jingxi.com/dreamfactory/${functionId}?zone=dream_factory&${body}&sceneval=2&g_login_type=1&_time=${Date.now()}&_=${Date.now() + 2}&_ste=1`
url += `&h5st=${decrypt(Date.now(), stk, '', url)}`
if (stk) {
url += `&_stk=${encodeURIComponent(stk)}`;
}
return {
url,
headers: {
'Cookie': cookie,
'Host': 'm.jingxi.com',
'Accept': '*/*',
'Connection': 'keep-alive',
'User-Agent': functionId === 'AssistFriend' ? "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36" : 'jdpingou',
'Accept-Language': 'zh-cn',
'Referer': 'https://wqsd.jd.com/pingou/dream_factory/index.html',
'Accept-Encoding': 'gzip, deflate, br',
},
timeout: 10000
}
}
//惊喜查询当前生产的商品名称
function GetCommodityDetails() {
return new Promise(async resolve => {
// const url = `/dreamfactory/diminfo/GetCommodityDetails?zone=dream_factory&sceneval=2&g_login_type=1&commodityId=${$.commodityDimId}`;
$.get(jxTaskurl('diminfo/GetCommodityDetails', `commodityId=${$.commodityDimId}`, `_time,commodityId,zone`), (err, resp, data) => {
try {
if (err) {
console.log(`${JSON.stringify(err)}`)
console.log(`GetCommodityDetails API请求失败请检查网路重试`)
} else {
if (safeGet(data)) {
data = JSON.parse(data);
if (data['ret'] === 0) {
data = data['data'];
$.jxProductName = data['commodityList'][0].name;
} else {
console.log(`GetCommodityDetails异常${JSON.stringify(data)}`)
}
}
}
} catch (e) {
$.logErr(e, resp)
}
finally {
resolve();
}
})
})
}
// 东东工厂信息查询
async function getDdFactoryInfo() {
if (!EnableJDGC)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long