From fbd4bb560c8d591233604e3c4d6245d2057f3429 Mon Sep 17 00:00:00 2001 From: guyuexuan <2651919937@qq.com> Date: Fri, 8 Jan 2021 15:30:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=AC=E5=96=9C=E5=86=9C?= =?UTF-8?q?=E5=9C=BA=E4=BA=92=E5=8A=A9=E7=A0=81=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jd_get_share_code.js | 53 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-) 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()