diff --git a/jd_get_share_code.js b/jd_get_share_code.js index 8a6e1ed..6ed9977 100644 --- a/jd_get_share_code.js +++ b/jd_get_share_code.js @@ -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=×tamp=&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()