mirror of
https://github.com/shufflewzc/faker2.git
synced 2025-04-23 02:48:44 +08:00
update
This commit is contained in:
parent
bf06cbb307
commit
b88fd522e4
@ -20,7 +20,7 @@ cron "2 0-23/4 * * *" script-path=jd_cash.js,tag=签到领现金
|
|||||||
============小火箭=========
|
============小火箭=========
|
||||||
签到领现金 = type=cron,script-path=jd_cash.js, cronexpr="2 0-23/4 * * *", timeout=3600, enable=true
|
签到领现金 = type=cron,script-path=jd_cash.js, cronexpr="2 0-23/4 * * *", timeout=3600, enable=true
|
||||||
*/
|
*/
|
||||||
const $ = new Env('签到领现金潘达接口版');
|
const $ = new Env('签到领现金_Panda');
|
||||||
const notify = $.isNode() ? require('./sendNotify') : '';
|
const notify = $.isNode() ? require('./sendNotify') : '';
|
||||||
//Node.js用户请在jdCookie.js处填写京东ck;
|
//Node.js用户请在jdCookie.js处填写京东ck;
|
||||||
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
|
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
|
||||||
@ -41,6 +41,13 @@ if ($.isNode()) {
|
|||||||
}
|
}
|
||||||
const JD_API_HOST = 'https://api.m.jd.com/client.action';
|
const JD_API_HOST = 'https://api.m.jd.com/client.action';
|
||||||
let allMessage = '';
|
let allMessage = '';
|
||||||
|
let jdPandaToken = '';
|
||||||
|
jdPandaToken = $.isNode() ? (process.env.gua_cleancart_PandaToken ? process.env.gua_cleancart_PandaToken : `${jdPandaToken}`) : ($.getdata('gua_cleancart_PandaToken') ? $.getdata('gua_cleancart_PandaToken') : `${jdPandaToken}`);
|
||||||
|
if (!jdPandaToken) {
|
||||||
|
console.log('请填写Panda获取的Token,变量是gua_cleancart_PandaToken');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
!(async () => {
|
!(async () => {
|
||||||
if (!cookiesArr[0]) {
|
if (!cookiesArr[0]) {
|
||||||
$.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
|
$.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
|
||||||
@ -115,7 +122,7 @@ async function appindex(info=false) {
|
|||||||
}
|
}
|
||||||
$.signMoney = data.data.result.totalMoney;
|
$.signMoney = data.data.result.totalMoney;
|
||||||
// console.log(`您的助力码为${data.data.result.invitedCode}`)
|
// console.log(`您的助力码为${data.data.result.invitedCode}`)
|
||||||
console.log(`\n【京东账号${$.index}(${$.UserName})的${$.name}好友互助码】${data.data.result.invitedCode}\n`);
|
console.log(`\n【京东账号${$.index}(${$.UserName})的好友互助码】${data.data.result.invitedCode}\n`);
|
||||||
let helpInfo = {
|
let helpInfo = {
|
||||||
'inviteCode': data.data.result.invitedCode,
|
'inviteCode': data.data.result.invitedCode,
|
||||||
'shareDate': data.data.result.shareDate
|
'shareDate': data.data.result.shareDate
|
||||||
@ -282,13 +289,26 @@ function getSignfromPanda(functionId, body) {
|
|||||||
'Accept': '*/*',
|
'Accept': '*/*',
|
||||||
"accept-encoding": "gzip, deflate, br",
|
"accept-encoding": "gzip, deflate, br",
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
|
'Authorization': 'Bearer ' + jdPandaToken
|
||||||
},
|
},
|
||||||
timeout: 30000
|
timeout: 30000
|
||||||
}
|
}
|
||||||
$.post(url, async(err, resp, data) => {
|
$.post(url, async(err, resp, data) => {
|
||||||
try {
|
try {
|
||||||
data = JSON.parse(data);
|
data = JSON.parse(data);
|
||||||
strsign=data.data.sign;
|
|
||||||
|
if (data && data.code == 200) {
|
||||||
|
lnrequesttimes = data.request_times;
|
||||||
|
console.log("连接Panda服务成功,当前Token使用次数为" + lnrequesttimes);
|
||||||
|
if (data.data.sign)
|
||||||
|
strsign = data.data.sign || '';
|
||||||
|
if (strsign != '')
|
||||||
|
resolve(strsign);
|
||||||
|
else
|
||||||
|
console.log("签名获取失败,可能Token使用次数上限或被封.");
|
||||||
|
} else {
|
||||||
|
console.log("签名获取失败.");
|
||||||
|
}
|
||||||
|
|
||||||
}catch (e) {
|
}catch (e) {
|
||||||
$.logErr(e, resp);
|
$.logErr(e, resp);
|
@ -1,12 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
清空购物车
|
清空购物车_Panda接口专用版
|
||||||
更新时间:2021-10-27
|
更新时间:2021-10-27
|
||||||
因其他脚本会加入商品到购物车,故此脚本用来清空购物车
|
因其他脚本会加入商品到购物车,故此脚本用来清空购物车
|
||||||
包括预售
|
包括预售
|
||||||
需要算法支持
|
需要算法支持
|
||||||
默认:不执行 如需要请添加环境变量
|
默认:不执行 如需要请添加环境变量
|
||||||
gua_cleancart_Run="true"
|
gua_cleancart_Run="true"
|
||||||
gua_cleancart_SignUrl="" # 算法url
|
gua_cleancart_PandaToken="" # PanDaToken
|
||||||
|
|
||||||
——————————————
|
——————————————
|
||||||
1.@&@ 前面加数字 指定账号pin
|
1.@&@ 前面加数字 指定账号pin
|
||||||
@ -35,12 +35,12 @@ pin3@&@不清空👉该pin不清空
|
|||||||
防止没指定的账号购物车全清空
|
防止没指定的账号购物车全清空
|
||||||
|
|
||||||
*/
|
*/
|
||||||
let jdSignUrl = '' // 算法url
|
let jdSignUrl = 'https://api.jds.codes/jd/sign'
|
||||||
|
let jdPandaToken = ''
|
||||||
let cleancartRun = 'false'
|
let cleancartRun = 'false'
|
||||||
let cleancartProducts = ''
|
let cleancartProducts = ''
|
||||||
let isSignError = false;
|
let lnrequesttimes=0
|
||||||
|
const $ = new Env('清空购物车_Panda');
|
||||||
const $ = new Env('清空购物车');
|
|
||||||
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
|
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
|
||||||
const notify = $.isNode() ? require('./sendNotify') : '';
|
const notify = $.isNode() ? require('./sendNotify') : '';
|
||||||
//IOS等用户直接用NobyDa的jd cookie
|
//IOS等用户直接用NobyDa的jd cookie
|
||||||
@ -57,12 +57,16 @@ if ($.isNode()) {
|
|||||||
|
|
||||||
message = ''
|
message = ''
|
||||||
|
|
||||||
jdSignUrl = $.isNode() ? (process.env.gua_cleancart_SignUrl ? process.env.gua_cleancart_SignUrl : `${jdSignUrl}`) : ($.getdata('gua_cleancart_SignUrl') ? $.getdata('gua_cleancart_SignUrl') : `${jdSignUrl}`);
|
jdPandaToken = $.isNode() ? (process.env.gua_cleancart_PandaToken ? process.env.gua_cleancart_PandaToken : `${jdPandaToken}`) : ($.getdata('gua_cleancart_PandaToken') ? $.getdata('gua_cleancart_PandaToken') : `${jdPandaToken}`);
|
||||||
|
|
||||||
cleancartRun = $.isNode() ? (process.env.gua_cleancart_Run ? process.env.gua_cleancart_Run : `${cleancartRun}`) : ($.getdata('gua_cleancart_Run') ? $.getdata('gua_cleancart_Run') : `${cleancartRun}`);
|
cleancartRun = $.isNode() ? (process.env.gua_cleancart_Run ? process.env.gua_cleancart_Run : `${cleancartRun}`) : ($.getdata('gua_cleancart_Run') ? $.getdata('gua_cleancart_Run') : `${cleancartRun}`);
|
||||||
|
|
||||||
cleancartProducts = $.isNode() ? (process.env.gua_cleancart_products ? process.env.gua_cleancart_products : `${cleancartProducts}`) : ($.getdata('gua_cleancart_products') ? $.getdata('gua_cleancart_products') : `${cleancartProducts}`);
|
cleancartProducts = $.isNode() ? (process.env.gua_cleancart_products ? process.env.gua_cleancart_products : `${cleancartProducts}`) : ($.getdata('gua_cleancart_products') ? $.getdata('gua_cleancart_products') : `${cleancartProducts}`);
|
||||||
|
|
||||||
|
if (!jdPandaToken) {
|
||||||
|
console.log('请填写Panda获取的Token,变量是gua_cleancart_PandaToken');
|
||||||
|
return;
|
||||||
|
}
|
||||||
let productsArr = []
|
let productsArr = []
|
||||||
let cleancartProductsAll = []
|
let cleancartProductsAll = []
|
||||||
for (let i of cleancartProducts && cleancartProducts.split('|-|')) {
|
for (let i of cleancartProducts && cleancartProducts.split('|-|')) {
|
||||||
@ -92,6 +96,9 @@ for (let i in productsArr) {
|
|||||||
console.log('脚本停止\n请添加环境变量[gua_cleancart_products]\n清空商品\n内容规则看脚本文件')
|
console.log('脚本停止\n请添加环境变量[gua_cleancart_products]\n清空商品\n内容规则看脚本文件')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if(jdSignUrl.indexOf("://jd.smiek.tk/") > -1) {
|
||||||
|
return
|
||||||
|
}
|
||||||
$.out = false
|
$.out = false
|
||||||
for (let i = 0; i < cookiesArr.length; i++) {
|
for (let i = 0; i < cookiesArr.length; i++) {
|
||||||
cookie = cookiesArr[i];
|
cookie = cookiesArr[i];
|
||||||
@ -123,25 +130,7 @@ async function run(){
|
|||||||
try{
|
try{
|
||||||
let msg = ''
|
let msg = ''
|
||||||
let signBody = `{"homeWishListUserFlag":"1","userType":"0","updateTag":true,"showPlusEntry":"2","hitNewUIStatus":"1","cvhv":"049591","cartuuid":"hjudwgohxzVu96krv/T6Hg==","adid":""}`
|
let signBody = `{"homeWishListUserFlag":"1","userType":"0","updateTag":true,"showPlusEntry":"2","hitNewUIStatus":"1","cvhv":"049591","cartuuid":"hjudwgohxzVu96krv/T6Hg==","adid":""}`
|
||||||
let body = await GetjdSign('cartClearQuery', signBody)
|
let body = await jdSign('cartClearQuery', signBody)
|
||||||
if (isSignError) {
|
|
||||||
console.log(`Sign获取失败,等待2秒后再次尝试...`)
|
|
||||||
await $.wait(2 * 1000);
|
|
||||||
isSignError = false;
|
|
||||||
body = await GetjdSign('cartClearQuery', signBody);
|
|
||||||
}
|
|
||||||
if (isSignError) {
|
|
||||||
console.log(`Sign获取失败,等待2秒后再次尝试...`)
|
|
||||||
await $.wait(2 * 1000);
|
|
||||||
isSignError = false;
|
|
||||||
body = await GetjdSign('cartClearQuery', signBody);
|
|
||||||
}
|
|
||||||
if (isSignError) {
|
|
||||||
console.log(`Sign获取失败,等待2秒后再次尝试...`)
|
|
||||||
await $.wait(2 * 1000);
|
|
||||||
isSignError = false;
|
|
||||||
body = await GetjdSign('cartClearQuery', signBody);
|
|
||||||
}
|
|
||||||
if($.out) return
|
if($.out) return
|
||||||
if(!body){
|
if(!body){
|
||||||
console.log('获取不到算法')
|
console.log('获取不到算法')
|
||||||
@ -189,27 +178,7 @@ async function run(){
|
|||||||
msg += `清空${operNum}件商品|没有找到要清空的商品\n`
|
msg += `清空${operNum}件商品|没有找到要清空的商品\n`
|
||||||
}else{
|
}else{
|
||||||
let clearBody = `{"homeWishListUserFlag":"1","userType":"0","updateTag":false,"showPlusEntry":"2","hitNewUIStatus":"1","cvhv":"049591","cartuuid":"hjudwgohxzVu96krv/T6Hg==","operations":${$.toStr(operations,operations)},"adid":"","coord_type":"0"}`
|
let clearBody = `{"homeWishListUserFlag":"1","userType":"0","updateTag":false,"showPlusEntry":"2","hitNewUIStatus":"1","cvhv":"049591","cartuuid":"hjudwgohxzVu96krv/T6Hg==","operations":${$.toStr(operations,operations)},"adid":"","coord_type":"0"}`
|
||||||
isSignError = false;
|
clearBody = await jdSign('cartClearRemove', clearBody)
|
||||||
clearBody = await GetjdSign('cartClearRemove', clearBody);
|
|
||||||
if (isSignError) {
|
|
||||||
console.log(`Sign获取失败,等待2秒后再次尝试...`)
|
|
||||||
await $.wait(2 * 1000);
|
|
||||||
isSignError = false;
|
|
||||||
clearBody = await GetjdSign('cartClearRemove', clearBody);
|
|
||||||
}
|
|
||||||
if (isSignError) {
|
|
||||||
console.log(`Sign获取失败,等待2秒后再次尝试...`)
|
|
||||||
await $.wait(2 * 1000);
|
|
||||||
isSignError = false;
|
|
||||||
clearBody = await GetjdSign('cartClearRemove', clearBody);
|
|
||||||
}
|
|
||||||
if (isSignError) {
|
|
||||||
console.log(`Sign获取失败,等待2秒后再次尝试...`)
|
|
||||||
await $.wait(2 * 1000);
|
|
||||||
isSignError = false;
|
|
||||||
clearBody = await GetjdSign('cartClearRemove', clearBody);
|
|
||||||
}
|
|
||||||
|
|
||||||
if($.out) return
|
if($.out) return
|
||||||
if(!clearBody){
|
if(!clearBody){
|
||||||
console.log('获取不到算法')
|
console.log('获取不到算法')
|
||||||
@ -295,37 +264,61 @@ function jdApi(functionId,body) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function GetjdSign(functionid, body) {
|
function jdSign(fn, body) {
|
||||||
return new Promise(async resolve => {
|
let sign = '';
|
||||||
let data = {
|
let flag = false;
|
||||||
"functionId": functionid,
|
|
||||||
"body": body,
|
|
||||||
"client": "apple",
|
|
||||||
"clientVersion": "10.1.0"
|
|
||||||
}
|
|
||||||
let HostArr = ['jdsign.cf', 'signer.nz.lu']
|
|
||||||
let Host = HostArr[Math.floor((Math.random() * HostArr.length))]
|
|
||||||
let options = {
|
|
||||||
url: `https://cdn.nz.lu/ddo`,
|
|
||||||
body: JSON.stringify(data),
|
|
||||||
headers: {
|
|
||||||
Host,
|
|
||||||
"User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1 Edg/87.0.4280.88"
|
|
||||||
},
|
|
||||||
timeout: 15000
|
|
||||||
}
|
|
||||||
$.post(options, (err, resp, data) => {
|
|
||||||
try {
|
try {
|
||||||
if (err) {
|
const fs = require('fs');
|
||||||
console.log(`${JSON.stringify(err)}`);
|
if (fs.existsSync('./gua_encryption_sign.js')) {
|
||||||
isSignError = true;
|
const encryptionSign = require('./gua_encryption_sign');
|
||||||
//console.log(`${$.name} getSign API请求失败,请检查网路重试`)
|
sign = encryptionSign.getSign(fn, body)
|
||||||
} else {}
|
} else {
|
||||||
|
flag = true
|
||||||
|
}
|
||||||
|
sign = sign.data && sign.data.sign && sign.data.sign || ''
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
$.logErr(e, resp)
|
flag = true
|
||||||
|
}
|
||||||
|
if (!flag)
|
||||||
|
return sign
|
||||||
|
if (!jdSignUrl.match(/^https?:\/\//)) {
|
||||||
|
console.log('请填写算法url')
|
||||||
|
$.out = true
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
let url = {
|
||||||
|
url: jdSignUrl,
|
||||||
|
body: `{"fn":"${fn}","body":${body}}`,
|
||||||
|
followRedirect: false,
|
||||||
|
headers: {
|
||||||
|
'Accept': '*/*',
|
||||||
|
"accept-encoding": "gzip, deflate, br",
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'Authorization': 'Bearer ' + jdPandaToken
|
||||||
|
},
|
||||||
|
timeout: 30000
|
||||||
|
}
|
||||||
|
$.post(url, async(err, resp, data) => {
|
||||||
|
try {
|
||||||
|
data = JSON.parse(data);
|
||||||
|
if (data && data.code == 200) {
|
||||||
|
lnrequesttimes = data.request_times;
|
||||||
|
console.log("连接Panda服务成功,当前Token使用次数为" + lnrequesttimes);
|
||||||
|
if (data.data.sign)
|
||||||
|
sign = data.data.sign || '';
|
||||||
|
if (sign != '')
|
||||||
|
resolve(sign);
|
||||||
|
else
|
||||||
|
console.log("签名获取失败,可能Token使用次数上限或被封.");
|
||||||
|
} else {
|
||||||
|
console.log("签名获取失败.");
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
$.logErr(e, resp);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
resolve(data);
|
resolve('')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
Loading…
Reference in New Issue
Block a user