From 72ccbd52ccd295996ffb3f45672540162239d955 Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Sat, 28 Nov 2020 16:23:34 +0800 Subject: [PATCH] update --- jd_dreamFactory.js | 57 +++++++++++++++++++++++++++++++++++++++++++--- jd_jdfactory.js | 2 +- 2 files changed, 55 insertions(+), 4 deletions(-) diff --git a/jd_dreamFactory.js b/jd_dreamFactory.js index 628bfc30..217f7895 100644 --- a/jd_dreamFactory.js +++ b/jd_dreamFactory.js @@ -84,6 +84,7 @@ if ($.isNode()) { async function jdDreamFactory() { await userInfo(); + await JoinTuan(); await helpFriends(); if (!$.unActive) return await getUserElectricity(); @@ -584,7 +585,57 @@ function getFactoryIdByPin(pin) { }) }) } - +//开团API +function CreateTuan() { + return new Promise((resolve) => { + $.get(taskurl('tuan/CreateTuan', `activeId=${escape('ilOin38J30PcT9xnWbx9lw==')}&isOpenApp=1&_time=${Date.now()}&_=${Date.now()}`), (err, resp, data) => { + try { + if (err) { + console.log(`${JSON.stringify(err)}`) + console.log(`${$.name} API请求失败,请检查网路重试`); + } else { + if (safeGet(data)) { + data = JSON.parse(data); + if (data['ret'] === 0) { + console.log(`开团成功tuanId为\n${data.data['tuanId']}`); + } else { + console.log(`异常:${JSON.stringify(data)}`); + } + } + } + } catch (e) { + $.logErr(e, resp) + } finally { + resolve(); + } + }) + }) +} +function JoinTuan() { + return new Promise((resolve) => { + $.get(taskurl('tuan/JoinTuan', `activeId=${escape('ilOin38J30PcT9xnWbx9lw==')}&tuanId=${escape('QvqM7GtgQQJUO8jaz1CYBA==')}&isOpenApp=1&_time=${Date.now()}&_=${Date.now()}`), (err, resp, data) => { + try { + if (err) { + console.log(`${JSON.stringify(err)}`) + console.log(`${$.name} API请求失败,请检查网路重试`); + } else { + if (safeGet(data)) { + data = JSON.parse(data); + if (data['ret'] === 0) { + console.log(`参团成功\n${data.data['tuanId']}`); + } else { + console.log(`参团成功异常:${JSON.stringify(data)}`); + } + } + } + } catch (e) { + $.logErr(e, resp) + } finally { + resolve(); + } + }) + }) +} async function showMsg() { return new Promise(async resolve => { let ctrTemp; @@ -616,7 +667,7 @@ function readShareCode() { console.log(`${$.name} API请求失败,请检查网路重试`) } else { if (data) { - console.log(`随机取个${randomCount}码放到您固定的互助码后面`) + console.log(`随机取${randomCount}个码放到您固定的互助码后面`) data = JSON.parse(data); } } @@ -729,7 +780,7 @@ function taskurl(functionId, body = '') { 'Host': 'm.jingxi.com', 'Accept': '*/*', 'Connection': 'keep-alive', - 'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0"), + 'User-Agent': 'jdpingou;iPhone;3.14.4;14.0;ae75259f6ca8378672006fc41079cd8c90c53be8;network/wifi;model/iPhone10,2;appBuild/100351;ADID/00000000-0000-0000-0000-000000000000;supportApplePay/1;hasUPPay/0;pushNoticeIsOpen/1;hasOCPay/0;supportBestPay/0;session/62;pap/JA2015_311210;brand/apple;supportJDSHWK/1;Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148', 'Accept-Language': 'zh-cn', 'Referer': 'https://wqsd.jd.com/pingou/dream_factory/index.html', 'Accept-Encoding': 'gzip, deflate, br', diff --git a/jd_jdfactory.js b/jd_jdfactory.js index 0dc70aa0..79dcddad 100644 --- a/jd_jdfactory.js +++ b/jd_jdfactory.js @@ -585,7 +585,7 @@ function readShareCode() { console.log(`${$.name} API请求失败,请检查网路重试`) } else { if (data) { - console.log(`随机取个${randomCount}码放到您固定的互助码后面`) + console.log(`随机取${randomCount}个码放到您固定的互助码后面`) data = JSON.parse(data); } }