MCPcopy Create free account
hub / github.com/Semporia/Scripts / getJxNc

Function getJxNc

jd_get_share_code.js:173–229  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

171}
172
173function getJxNc(){
174 const JXNC_API_HOST = "https://wq.jd.com/";
175
176 function JXNC_taskurl(function_path, body) {
177 return {
178 url: `${JXNC_API_HOST}cubeactive/farm/${function_path}?${body}&farm_jstoken=&phoneid=&timestamp=&sceneval=2&g_login_type=1&_=${Date.now()}&g_ty=ls`,
179 headers: {
180 Cookie: cookie,
181 Accept: `*/*`,
182 Connection: `keep-alive`,
183 Referer: `https://st.jingxi.com/pingou/dream_factory/index.html`,
184 'Accept-Encoding': `gzip, deflate, br`,
185 Host: `wq.jd.com`,
186 'Accept-Language': `zh-cn`,
187 "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1")
188 },
189 };
190 }
191
192 return new Promise(resolve => {
193 $.get(
194 JXNC_taskurl('query', `type=1`),
195 async (err, resp, data) => {
196 try {
197 if (err) {
198 console.log(`${JSON.stringify(err)}`);
199 console.log(`京喜农场 API请求失败,请检查网路重试`);
200 } else {
201 data = data.match(/try\{Query\(([\s\S]*)\)\;\}catch\(e\)\{\}/)[1];
202 if (safeGet(data)) {
203 data = JSON.parse(data);
204 if (data["ret"] === 0) {
205 if (data.active) {
206 let shareCodeJson = {
207 'smp': data.smp,
208 'active': data.active,
209 'joinnum': data.joinnum,
210 };
211 console.log(`注意:京喜农场 种植种子发生变化的时候,互助码也会变!!`);
212 console.log(`【京东账号${$.index}(${$.UserName})京喜农场】` + JSON.stringify(shareCodeJson));
213 } else {
214 console.log(`【京东账号${$.index}(${$.UserName})京喜农场】未选择种子,请先去京喜农场选择种子`);
215 }
216 }
217 } else {
218 console.log(`京喜农场返回值解析异常:${JSON.stringify(data)}`);
219 }
220 }
221 } catch (e) {
222 $.logErr(e, resp);
223 } finally {
224 resolve()
225 }
226 }
227 );
228 })
229}
230

Callers 1

getShareCodeFunction · 0.85

Calls 5

JXNC_taskurlFunction · 0.85
safeGetFunction · 0.70
getMethod · 0.45
logMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected