mirror of
https://github.com/shufflewzc/faker2.git
synced 2025-04-23 02:48:44 +08:00
update
This commit is contained in:
parent
8525162c12
commit
dc8df1e28e
21
TS_JDHelloWorld.d.ts
vendored
Normal file
21
TS_JDHelloWorld.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
interface User {
|
||||
i: number;
|
||||
UserName: string;
|
||||
cookie: string;
|
||||
UserAgent: string;
|
||||
}
|
||||
declare class JDHelloWorld {
|
||||
scriptName: string;
|
||||
constructor(scriptName?: string);
|
||||
getCookie(check?: boolean): Promise<string[]>;
|
||||
checkCookie(cookie: string): Promise<boolean>;
|
||||
exceptCookie(filename?: string): any;
|
||||
get(url: string, headers?: any): Promise<unknown>;
|
||||
post(url: string, data: any, headers?: any): Promise<object>;
|
||||
wait(ms?: number): Promise<unknown>;
|
||||
o2s(obj: object, title?: string): void;
|
||||
run(son: {
|
||||
main: Function;
|
||||
}): Promise<void>;
|
||||
}
|
||||
export { User, JDHelloWorld };
|
1
TS_JDHelloWorld.js
Normal file
1
TS_JDHelloWorld.js
Normal file
File diff suppressed because one or more lines are too long
@ -5,10 +5,7 @@ import {existsSync, readFileSync} from "fs"
|
||||
import {sendNotify} from './sendNotify'
|
||||
|
||||
dotenv.config()
|
||||
|
||||
let fingerprint: string | number, token: string = '', enCryptMethodJD: any
|
||||
|
||||
const USER_AGENTS: Array<string> = [
|
||||
const USER_AGENTS_ARR: string[] = [
|
||||
"jdapp;android;10.0.2;10;network/wifi;Mozilla/5.0 (Linux; Android 10; ONEPLUS A5010 Build/QKQ1.191014.012; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36",
|
||||
"jdapp;iPhone;10.0.2;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",
|
||||
"jdapp;android;10.0.2;9;network/4g;Mozilla/5.0 (Linux; Android 9; Mi Note 3 Build/PKQ1.181007.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/045131 Mobile Safari/537.36",
|
||||
@ -47,20 +44,12 @@ const USER_AGENTS: Array<string> = [
|
||||
"jdapp;iPhone;10.0.2;14.1;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 14_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
|
||||
]
|
||||
|
||||
function TotalBean(cookie: string) {
|
||||
return {
|
||||
cookie: cookie,
|
||||
isLogin: true,
|
||||
nickName: ''
|
||||
}
|
||||
}
|
||||
|
||||
function getRandomNumberByRange(start: number, end: number) {
|
||||
end <= start && (end = start + 100)
|
||||
return Math.floor(Math.random() * (end - start) + start)
|
||||
}
|
||||
|
||||
let USER_AGENT = USER_AGENTS[getRandomNumberByRange(0, USER_AGENTS.length)]
|
||||
let USER_AGENT = USER_AGENTS_ARR[getRandomNumberByRange(0, USER_AGENTS_ARR.length)]
|
||||
|
||||
async function getBeanShareCode(cookie: string) {
|
||||
let {data}: any = await axios.post('https://api.m.jd.com/client.action',
|
||||
@ -98,14 +87,18 @@ async function getFarmShareCode(cookie: string) {
|
||||
return ''
|
||||
}
|
||||
|
||||
async function requireConfig(check: boolean = false): Promise<string[]> {
|
||||
async function getCookie(check: boolean = false): Promise<string[]> {
|
||||
let pwd: string = __dirname
|
||||
let cookiesArr: string[] = []
|
||||
const jdCookieNode = require('./jdCookie.js')
|
||||
let keys: string[] = Object.keys(jdCookieNode)
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
let cookie = jdCookieNode[keys[i]]
|
||||
if (!check) {
|
||||
cookiesArr.push(cookie)
|
||||
if (pwd.includes('/ql') && !pwd.includes('JDHelloWorld')) {
|
||||
} else {
|
||||
cookiesArr.push(cookie)
|
||||
}
|
||||
} else {
|
||||
if (await checkCookie(cookie)) {
|
||||
cookiesArr.push(cookie)
|
||||
@ -138,59 +131,12 @@ async function checkCookie(cookie: string) {
|
||||
}
|
||||
}
|
||||
|
||||
function wait(timeout: number) {
|
||||
function wait(ms: number) {
|
||||
return new Promise(resolve => {
|
||||
setTimeout(resolve, timeout)
|
||||
setTimeout(resolve, ms)
|
||||
})
|
||||
}
|
||||
|
||||
async function requestAlgo(appId: number = 10032) {
|
||||
fingerprint = generateFp()
|
||||
return new Promise<void>(async resolve => {
|
||||
let {data}: any = await axios.post('https://cactus.jd.com/request_algo?g_ty=ajax', {
|
||||
"version": "1.0",
|
||||
"fp": fingerprint,
|
||||
"appId": appId,
|
||||
"timestamp": Date.now(),
|
||||
"platform": "web",
|
||||
"expandParams": ""
|
||||
}, {
|
||||
"headers": {
|
||||
'Authority': 'cactus.jd.com',
|
||||
'Pragma': 'no-cache',
|
||||
'Cache-Control': 'no-cache',
|
||||
'Accept': 'application/json',
|
||||
'User-Agent': USER_AGENT,
|
||||
'Content-Type': 'application/json',
|
||||
'Origin': 'https://st.jingxi.com',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Referer': 'https://st.jingxi.com/',
|
||||
'Accept-Language': 'zh-CN,zh;q=0.9,zh-TW;q=0.8,en;q=0.7'
|
||||
},
|
||||
})
|
||||
if (data['status'] === 200) {
|
||||
token = data.data.result.tk
|
||||
let enCryptMethodJDString = data.data.result.algo
|
||||
if (enCryptMethodJDString) enCryptMethodJD = new Function(`return ${enCryptMethodJDString}`)()
|
||||
} else {
|
||||
console.log(`fp: ${fingerprint}`)
|
||||
console.log('request_algo 签名参数API请求失败:')
|
||||
}
|
||||
resolve()
|
||||
})
|
||||
}
|
||||
|
||||
function generateFp() {
|
||||
let e = "0123456789"
|
||||
let a = 13
|
||||
let i = ''
|
||||
for (; a--;)
|
||||
i += e[Math.random() * e.length | 0]
|
||||
return (i + Date.now()).slice(0, 16)
|
||||
}
|
||||
|
||||
function getJxToken(cookie: string, phoneId: string = '') {
|
||||
function generateStr(input: number) {
|
||||
let src = 'abcdefghijklmnopqrstuvwxyz1234567890'
|
||||
@ -289,7 +235,8 @@ async function getShareCodePool(key: string, num: number) {
|
||||
return shareCode
|
||||
}
|
||||
|
||||
/*async function wechat_app_msg(title: string, content: string, user: string) {
|
||||
/*
|
||||
async function wechat_app_msg(title: string, content: string, user: string) {
|
||||
let corpid: string = "", corpsecret: string = ""
|
||||
let {data: gettoken} = await axios.get(`https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=${corpid}&corpsecret=${corpsecret}`)
|
||||
let access_token: string = gettoken.access_token
|
||||
@ -308,11 +255,8 @@ async function getShareCodePool(key: string, num: number) {
|
||||
} else {
|
||||
console.log('企业微信应用消息发送失败', send)
|
||||
}
|
||||
}*/
|
||||
|
||||
function obj2str(obj: object) {
|
||||
return JSON.stringify(obj)
|
||||
}
|
||||
*/
|
||||
|
||||
async function getDevice() {
|
||||
let {data} = await axios.get('https://betahub.cn/api/apple/devices/iPhone', {
|
||||
@ -377,13 +321,11 @@ function post(url: string, prarms?: string | object, headers?: any): Promise<any
|
||||
|
||||
export default USER_AGENT
|
||||
export {
|
||||
TotalBean,
|
||||
getBeanShareCode,
|
||||
getFarmShareCode,
|
||||
requireConfig,
|
||||
getCookie,
|
||||
wait,
|
||||
getRandomNumberByRange,
|
||||
requestAlgo,
|
||||
getJxToken,
|
||||
exceptCookie,
|
||||
randomString,
|
||||
@ -392,8 +334,8 @@ export {
|
||||
getshareCodeHW,
|
||||
getShareCodePool,
|
||||
randomWord,
|
||||
obj2str,
|
||||
jdpingou,
|
||||
get,
|
||||
post
|
||||
post,
|
||||
USER_AGENTS_ARR
|
||||
}
|
||||
|
89
jd_bean_aggregation.cjs
Normal file
89
jd_bean_aggregation.cjs
Normal file
@ -0,0 +1,89 @@
|
||||
/**
|
||||
* select name, bean from bean_change where date=today and amount > 0 group by name order by amount desc
|
||||
*/
|
||||
|
||||
const {JDHelloWorld} = require("./TS_JDHelloWorld")
|
||||
const {getDate} = require("date-fns");
|
||||
const ConsoleGrid = require("console-grid");
|
||||
|
||||
class Aggregate_Bean extends JDHelloWorld {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
async init() {
|
||||
await this.run(new Aggregate_Bean())
|
||||
}
|
||||
|
||||
async main(user) {
|
||||
let p = 1, arr = [], aggregation = {}, flag = true, sum = 0, len = 0
|
||||
while (p && flag) {
|
||||
try {
|
||||
let res = await this.post('https://api.m.jd.com/client.action?functionId=getJingBeanBalanceDetail',
|
||||
`body=${encodeURIComponent(JSON.stringify({"pageSize": "20", "page": p.toString()}))}&appid=ld`, {
|
||||
'Host': 'api.m.jd.com',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'User-Agent': "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",
|
||||
'Cookie': user.cookie,
|
||||
})
|
||||
let today = getDate(new Date())
|
||||
// console.log(p, res['detailList'].length)
|
||||
for (let t of res['detailList']) {
|
||||
let amount = parseInt(t.amount), date = getDate(new Date(t.date))
|
||||
if (date !== today) {
|
||||
flag = false
|
||||
break
|
||||
}
|
||||
if (amount > 0) {
|
||||
sum += amount
|
||||
t['eventMassage'].length > len ? len = t['eventMassage'].length : null
|
||||
if (t['eventMassage'] in aggregation) {
|
||||
aggregation[t['eventMassage']] += amount
|
||||
} else {
|
||||
aggregation[t['eventMassage']] = amount
|
||||
}
|
||||
}
|
||||
}
|
||||
await this.wait(2000)
|
||||
if (p < 20) {
|
||||
p++
|
||||
} else {
|
||||
break
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('error', e)
|
||||
await this.wait(2000)
|
||||
break
|
||||
}
|
||||
}
|
||||
for (let k in aggregation) {
|
||||
arr.push({
|
||||
'name': k,
|
||||
'amount': aggregation[k]
|
||||
})
|
||||
}
|
||||
arr.sort((a, b) => {
|
||||
return b.amount - a.amount
|
||||
})
|
||||
arr = [...arr, {name: '合计', amount: sum}]
|
||||
const consoleGrid = new ConsoleGrid();
|
||||
const data = {
|
||||
columns: [{
|
||||
id: "name",
|
||||
name: `Name`,
|
||||
type: "string",
|
||||
maxWidth: len * 2 + 3,
|
||||
}, {
|
||||
id: "amount",
|
||||
type: "number",
|
||||
name: "Amount",
|
||||
minWidth: 5,
|
||||
align: "right"
|
||||
}],
|
||||
rows: arr
|
||||
};
|
||||
consoleGrid.render(data);
|
||||
}
|
||||
}
|
||||
|
||||
new Aggregate_Bean().init().then()
|
@ -283,6 +283,13 @@ if(DisableIndex!=-1){
|
||||
RemainMessage="";
|
||||
}
|
||||
|
||||
//汪汪赛跑
|
||||
let EnableJoyRun=true;
|
||||
DisableIndex=strDisableList.findIndex((item) => item === "汪汪赛跑");
|
||||
if(DisableIndex!=-1){
|
||||
console.log("检测到设定关闭汪汪赛跑查询");
|
||||
EnableJoyRun=false
|
||||
}
|
||||
|
||||
!(async() => {
|
||||
if (!cookiesArr[0]) {
|
||||
@ -344,6 +351,8 @@ if(DisableIndex!=-1){
|
||||
$.YunFeiTitle2="";
|
||||
$.YunFeiQuan2 = 0;
|
||||
$.YunFeiQuanEndTime2 = "";
|
||||
$.JoyRunningAmount = "";
|
||||
|
||||
TempBaipiao = "";
|
||||
strGuoqi="";
|
||||
console.log(`******开始查询【京东账号${$.index}】${$.nickName || $.UserName}*********`);
|
||||
@ -378,7 +387,8 @@ if(DisableIndex!=-1){
|
||||
getDdFactoryInfo(), // 京东工厂
|
||||
jdCash(), //领现金
|
||||
GetJxBeaninfo(), //喜豆查询
|
||||
GetPigPetInfo() //金融养猪
|
||||
GetPigPetInfo(), //金融养猪
|
||||
GetJoyRuninginfo() //汪汪赛跑
|
||||
])
|
||||
|
||||
await showMsg();
|
||||
@ -720,17 +730,23 @@ async function showMsg() {
|
||||
ReturnMessage += `【京东秒杀】${$.JdMsScore}币(≈${($.JdMsScore / 1000).toFixed(2)}元)\n`;
|
||||
}
|
||||
|
||||
if ($.joylevel || $.jdCash) {
|
||||
if ($.joylevel || $.jdCash || $.JoyRunningAmount) {
|
||||
ReturnMessage += `【其他信息】`;
|
||||
if ($.joylevel) {
|
||||
ReturnMessage += `汪汪:${$.joylevel}级`;
|
||||
if ($.jdCash) {
|
||||
ReturnMessage += ",";
|
||||
}
|
||||
}
|
||||
if ($.jdCash) {
|
||||
if ($.joylevel) {
|
||||
ReturnMessage += ",";
|
||||
}
|
||||
ReturnMessage += `领现金:${$.jdCash}元`;
|
||||
}
|
||||
if ($.JoyRunningAmount) {
|
||||
if ($.joylevel || $.jdCash) {
|
||||
ReturnMessage += ",";
|
||||
}
|
||||
ReturnMessage += `汪汪赛跑:${$.JoyRunningAmount}元`;
|
||||
}
|
||||
|
||||
ReturnMessage += `\n`;
|
||||
|
||||
@ -2482,7 +2498,57 @@ async function jxbean() {
|
||||
|
||||
}
|
||||
|
||||
function GetJoyRuninginfo() {
|
||||
if (!EnableJoyRun)
|
||||
return;
|
||||
|
||||
const headers = {
|
||||
"Accept": "application/json, text/plain, */*",
|
||||
"Accept-Encoding": "gzip, deflate, br",
|
||||
"Accept-Language": "zh-CN,zh-Hans;q=0.9",
|
||||
"Connection": "keep-alive",
|
||||
"Content-Length": "376",
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
"Cookie": cookie,
|
||||
"Host": "api.m.jd.com",
|
||||
"Origin": "https://joypark.jd.com",
|
||||
"Referer": "https://joypark.jd.com/",
|
||||
"User-Agent": $.UA
|
||||
}
|
||||
var DateToday = new Date();
|
||||
const body = {
|
||||
'linkId': 'L-sOanK_5RJCz7I314FpnQ',
|
||||
'isFromJoyPark':true,
|
||||
'joyLinkId':'LsQNxL7iWDlXUs6cFl-AAg'
|
||||
};
|
||||
const options = {
|
||||
url: `https://api.m.jd.com/?functionId=runningPageHome&body=${encodeURIComponent(JSON.stringify(body))}&t=${DateToday.getTime()}&appid=activities_platform&client=ios&clientVersion=3.8.12`,
|
||||
headers,
|
||||
}
|
||||
return new Promise(resolve => {
|
||||
$.get(options, (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
console.log(`${JSON.stringify(err)}`)
|
||||
console.log(`${$.name} API请求失败,请检查网路重试`)
|
||||
} else {
|
||||
if (data) {
|
||||
//console.log(data);
|
||||
data = JSON.parse(data);
|
||||
if (data.data.runningHomeInfo.prizeValue) {
|
||||
$.JoyRunningAmount=data.data.runningHomeInfo.prizeValue * 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp)
|
||||
}
|
||||
finally {
|
||||
resolve(data)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function randomString(e) {
|
||||
e = e || 32;
|
||||
|
73
jd_cash.ts
73
jd_cash.ts
@ -1,41 +1,65 @@
|
||||
import USER_AGENT, {post, requireConfig, wait} from './TS_USER_AGENTS'
|
||||
/**
|
||||
* 京东-领现金
|
||||
* 兼容panda api和本地sign
|
||||
*
|
||||
* 使用panda sign
|
||||
* export PANDA_TOKEN=""
|
||||
* 本地sign算法 import {getSign} from './test/sign'
|
||||
*/
|
||||
|
||||
import {User, JDHelloWorld} from "./TS_JDHelloWorld";
|
||||
import {getSign} from "./test/sign";
|
||||
|
||||
let cookie: string = '', res: any = '', data: any, UserName: string
|
||||
class CASH extends JDHelloWorld {
|
||||
cookie: string
|
||||
|
||||
!(async () => {
|
||||
let cookiesArr: string[] = await requireConfig()
|
||||
for (let [index, value] of Object.entries(cookiesArr)) {
|
||||
cookie = value
|
||||
UserName = decodeURIComponent(cookie.match(/pt_pin=([^;]*)/)![1])
|
||||
console.log(`\n开始【京东账号${index + 1}】${UserName}\n`)
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
res = await api('cash_homePage', {})
|
||||
async init() {
|
||||
await this.run(new CASH())
|
||||
}
|
||||
|
||||
async api(fn: string, body: object) {
|
||||
let sign = getSign(fn, body)
|
||||
return await this.post(`https://api.m.jd.com/client.action?functionId=${fn}`, sign, {
|
||||
'Host': 'api.m.jd.com',
|
||||
'Cookie': this.cookie,
|
||||
'user-agent': 'jdapp;',
|
||||
})
|
||||
}
|
||||
|
||||
async main(user: User) {
|
||||
this.cookie = user.cookie
|
||||
let res: any = await this.api('cash_homePage', {})
|
||||
if (res.data.result.signedStatus !== 1) {
|
||||
console.log('今日未签到')
|
||||
data = await api('cash_sign', {"remind": 0, "inviteCode": "", "type": 0, "breakReward": 0})
|
||||
await wait(1000)
|
||||
await this.api('cash_sign', {"remind": 0, "inviteCode": "", "type": 0, "breakReward": 0})
|
||||
await this.wait(1000)
|
||||
console.log('签到成功')
|
||||
} else {
|
||||
console.log('今日已签到')
|
||||
}
|
||||
res = await api('cash_homePage', {})
|
||||
|
||||
await wait(1000)
|
||||
let type: number[] = [2, 4, 31, 16, 3, 5, 17, 21]
|
||||
res = await this.api('cash_homePage', {})
|
||||
let type: number[] = [2, 4, 31, 16, 3, 5, 17, 21], data: any
|
||||
let otherTaskNum = res.data.result.taskInfos.filter(item => !type.includes(item.type)).length
|
||||
let taskNum = res.data.result.taskInfos.filter(item => type.includes(item.type)).length
|
||||
console.log(taskNum, otherTaskNum)
|
||||
|
||||
for (let i = 0; i < 10; i++) {
|
||||
res = await api('cash_homePage', {})
|
||||
res = await this.api('cash_homePage', {})
|
||||
if (res.data.result.taskInfos.filter(item => type.includes(item.type) && item.doTimes === item.times).length === taskNum) {
|
||||
console.log('任务全部完成')
|
||||
break
|
||||
}
|
||||
|
||||
for (let t of res?.data?.result?.taskInfos || []) {
|
||||
if (t.doTimes < t.times && t.type !== 7) {
|
||||
console.log(t.name)
|
||||
data = await api('cash_doTask', {"type": t.type, "taskInfo": t.desc})
|
||||
await wait(t.duration * 1000 || 1000)
|
||||
data = await this.api('cash_doTask', {"type": t.type, "taskInfo": t.desc})
|
||||
await this.wait(t.duration * 1000 || 1000)
|
||||
if (data.data.bizCode === 0) {
|
||||
console.log('任务完成', data.data.result.totalMoney ?? '')
|
||||
break
|
||||
@ -45,18 +69,9 @@ let cookie: string = '', res: any = '', data: any, UserName: string
|
||||
}
|
||||
}
|
||||
}
|
||||
await wait(2000)
|
||||
await this.wait(2000)
|
||||
}
|
||||
}
|
||||
})()
|
||||
|
||||
async function api(fn: string, body: object) {
|
||||
let sign = getSign(fn, body)
|
||||
return await post(`https://api.m.jd.com/client.action?functionId=${fn}`, sign, {
|
||||
'Host': 'api.m.jd.com',
|
||||
'Cookie': cookie,
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'user-agent': USER_AGENT,
|
||||
'referer': ''
|
||||
})
|
||||
}
|
||||
|
||||
new CASH().init().then().catch()
|
||||
|
12
jd_checkCookie.ts
Normal file
12
jd_checkCookie.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import {getCookie} from "./TS_USER_AGENTS"
|
||||
|
||||
let cookie: string = '', UserName: string
|
||||
|
||||
!(async () => {
|
||||
let cookiesArr: string[] = await getCookie(true)
|
||||
for (let [index, value] of cookiesArr.entries()) {
|
||||
cookie = value
|
||||
UserName = decodeURIComponent(cookie.match(/pt_pin=([^;]*)/)![1])
|
||||
console.log(index + 1, UserName)
|
||||
}
|
||||
})()
|
13
jd_dpqd.js
13
jd_dpqd.js
@ -25,36 +25,25 @@ let vender=''
|
||||
let num=0
|
||||
let shopname=''
|
||||
const token = [
|
||||
"80E78A5F090820E5B1754E17E1485D3F",
|
||||
"8C1D9B1D97AB75D1704609271FD48AD0",
|
||||
"416F5DC2398791BB1DA3C9A31532A89E",
|
||||
"87DC11A01AE814025159ECE32F5EECBF",
|
||||
"F6C427887883C4A567C69C0260606022",
|
||||
"7127A3861F6478043B1BF112803B9A25",
|
||||
"DF3524CB89302A7741B6FC1B9603D81A",
|
||||
"8622A6A8C1ECB4B2D45F07AE43397BFD",
|
||||
"F1092CD41D4038D73B676333C0B17644",
|
||||
"6A78B850246E31C35C135BC8A0FAF5ED",
|
||||
"CACEC89AD3A20309748FEC03B0B0C50C",
|
||||
"F0C24D7588D90922393B423C6623F31A",
|
||||
"D881655EDC90A9B4387ACFE495CA3F18",
|
||||
"A92870C9EB3853D7C2FF8E740FAA8BC1",
|
||||
"747D3ADCDD540C3830E4E7EADEA5B295",
|
||||
"ADFB1BB684350404A2CE4959D7D96A21",
|
||||
"3AF4B68A4BB3BD09D371B766E6A1B721",
|
||||
"273EC9E9CA27DFDD85478972A1A0ED6F",
|
||||
"9161017C0106A152D3DF09CD5F03CC2D",
|
||||
"3D2F9CF0C806133D3C64949F06CD4A80",
|
||||
"449CB9613C43D1EA70502B727335EAAD",
|
||||
"1A592F5C4560356C541825D39B4FA6B9",
|
||||
"5EC0711D1CF81232DA1B32BE7E4D14FE",
|
||||
"902F208E5868474EE70F3C40BB16F4A2",
|
||||
"CFE83CA731BB8B8395C1016BE7498F7A",
|
||||
"588ACF1F2E598BBAB860686B231FAB68",
|
||||
"351154FDCFF09CD4406A0A9D6FF8B216",
|
||||
"1DF38A60E4FCB9C461B7B68548C75EC1",
|
||||
"99B695DFEF69DD31BB78B58D61B9C6A2",
|
||||
"EBC07F65183699ABACF313CA67B444E4",
|
||||
"24463136297BD78C05F386EE283F3021",
|
||||
"FA7F19CBE89D642BAC78D23F78110620"
|
||||
]
|
||||
|
||||
|
63
jd_health.ts
Normal file
63
jd_health.ts
Normal file
@ -0,0 +1,63 @@
|
||||
import {User, JDHelloWorld} from "./TS_JDHelloWorld";
|
||||
|
||||
class TEST extends JDHelloWorld {
|
||||
user: User
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
async init() {
|
||||
await this.run(new TEST)
|
||||
}
|
||||
|
||||
async api(fn: string, body: object) {
|
||||
return await this.post('https://api.m.jd.com/', `functionId=${fn}&body=${encodeURIComponent(JSON.stringify(body))}&client=wh5&clientVersion=1.0.0&uuid=`, {
|
||||
'Host': 'api.m.jd.com',
|
||||
'Origin': 'https://h5.m.jd.com',
|
||||
'User-Agent': this.user.UserAgent,
|
||||
'Referer': 'https://h5.m.jd.com/',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': this.user.cookie
|
||||
})
|
||||
}
|
||||
|
||||
async main(user: User) {
|
||||
this.user = user
|
||||
let res: any = await this.api('jdhealth_getTaskDetail', {"buildingId": "", "taskId": "", "channelId": 1})
|
||||
try {
|
||||
for (let t of res.data.result.taskVos) {
|
||||
if (t.status === 1 || t.status === 3) {
|
||||
console.log(t.taskName)
|
||||
for (let tp of t.productInfoVos || t.followShopVo || t.shoppingActivityVos || []) {
|
||||
if (tp.status === 1) {
|
||||
console.log('\t', tp.skuName || tp.shopName || tp.title)
|
||||
if (t.taskName.includes('早睡打卡') && t.taskBeginTime < Date.now() && t.taskEndTime > Date.now()) {
|
||||
res = await this.api('jdhealth_collectScore', {"taskToken": tp.taskToken, "taskId": t.taskId, "actionType": 1})
|
||||
await this.wait(2000)
|
||||
console.log('\t', res.data.bizMsg)
|
||||
}
|
||||
if (t.waitDuration) {
|
||||
res = await this.api('jdhealth_collectScore', {"taskToken": tp.taskToken, "taskId": t.taskId, "actionType": 1})
|
||||
console.log('\t', res.data.bizMsg)
|
||||
await this.wait(t.waitDuration * 1000)
|
||||
}
|
||||
res = await this.api('jdhealth_collectScore', {"taskToken": tp.taskToken, "taskId": t.taskId, "actionType": 0})
|
||||
if (res.data.bizMsg.includes('做完')) {
|
||||
console.log(res.data.bizMsg)
|
||||
break
|
||||
} else {
|
||||
console.log(res.data.bizMsg, parseInt(res.data.result.score))
|
||||
await this.wait(1500)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('Error', e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
new TEST().init().then()
|
@ -149,7 +149,7 @@ async function api(fn: string, body: object) {
|
||||
|
||||
async function getLog() {
|
||||
if (!rabbitToken && !tg_id) {
|
||||
let data = await get(`https://api.jdsharecode.xyz/api/jlhb?pwd=${__dirname}&t=${Date.now()}`)
|
||||
let data = await get(`https://api.jdsharecode.xyz/api/jlhb`)
|
||||
if (data !== 1 && data !== '1') {
|
||||
return data
|
||||
} else {
|
||||
|
41
jd_joy_park.ts
Normal file
41
jd_joy_park.ts
Normal file
@ -0,0 +1,41 @@
|
||||
import {User, JDHelloWorld} from "./TS_JDHelloWorld";
|
||||
|
||||
class Joy_Park extends JDHelloWorld {
|
||||
user: User
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
async init() {
|
||||
await this.run(new Joy_Park())
|
||||
}
|
||||
|
||||
async api(fn: string, body: Object): Promise<object> {
|
||||
return await this.post('https://api.m.jd.com/', `functionId=${fn}&body=${JSON.stringify(body)}&_t=${Date.now()}&appid=activities_platform`, {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'User-Agent': this.user.UserAgent,
|
||||
'Host': 'api.m.jd.com',
|
||||
'Referer': 'https://joypark.jd.com/',
|
||||
'Origin': 'https://joypark.jd.com',
|
||||
'Cookie': this.user.cookie
|
||||
});
|
||||
}
|
||||
|
||||
async main(user: User) {
|
||||
this.user = user;
|
||||
let res: any = await this.api('apTaskList', {"linkId": "L-sOanK_5RJCz7I314FpnQ"});
|
||||
let t: any = res.data[2]
|
||||
for (let i = t.taskDoTimes; i < t.taskLimitTimes; i++) {
|
||||
let res: any = await this.api('apTaskTimeRecord', {"linkId": "L-sOanK_5RJCz7I314FpnQ", "taskId": t.id})
|
||||
console.log(res.success)
|
||||
await this.wait(31000)
|
||||
let url: any = "https://pro.m.jd.com/jdlite/active/3qRAXpNehcsUpToARD9ekP4g6Jhi/index.html?babelChannel=ttt6"
|
||||
await this.api('apDoTask', {"channel": "4", "checkVersion": true, "itemId": encodeURIComponent(url), "linkId": "L-sOanK_5RJCz7I314FpnQ", "taskId": t.id, "taskType": t.taskType})
|
||||
console.log(res.success)
|
||||
await this.wait(1000)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
new Joy_Park().init().then()
|
@ -1,63 +1,147 @@
|
||||
/**
|
||||
* 汪汪乐园-跑步+组队
|
||||
* 默认翻倍到0.04红包结束
|
||||
* export JD_JOY_PARK_RUN_ASSETS="0.04"
|
||||
* cron: 20 * * * *
|
||||
* export FP_448DE="" // url: runningMyPrize => h5st.split(';')[1]
|
||||
* export FP_B6AC3="" // url: runningOpenBox => h5st.split(';')[1]
|
||||
*/
|
||||
|
||||
import {get, post, requireConfig, wait} from './TS_USER_AGENTS'
|
||||
import {H5ST} from "./utils/h5st"
|
||||
import {existsSync, readFileSync} from "fs";
|
||||
import {getDate} from "date-fns";
|
||||
import {JDHelloWorld, User} from "./TS_JDHelloWorld";
|
||||
|
||||
let cookie: string = '', res: any = '', UserName: string = ''
|
||||
let assets: number = 0.04, captainId: string = '', h5stTool: H5ST = new H5ST('b6ac3', 'jdltapp;', '1804945295425750')
|
||||
class Joy_Park_Run extends JDHelloWorld {
|
||||
teamTool: H5ST
|
||||
apiTool: H5ST
|
||||
user: User
|
||||
captainId: string | number
|
||||
|
||||
!(async () => {
|
||||
let cookiesArr: string[] = await requireConfig()
|
||||
let account: { pt_pin: string, joy_park_run: number }[] = []
|
||||
if (existsSync('./utils/account.json')) {
|
||||
try {
|
||||
account = JSON.parse(readFileSync('./utils/account.json').toString())
|
||||
} catch (e) {
|
||||
console.log('./utils/account.json 加载出错')
|
||||
}
|
||||
constructor() {
|
||||
super()
|
||||
}
|
||||
|
||||
for (let [index, value] of cookiesArr.entries()) {
|
||||
cookie = value
|
||||
UserName = decodeURIComponent(cookie.match(/pt_pin=([^;]*)/)![1])
|
||||
console.log(`\n开始【京东账号${index + 1}】${UserName}\n`)
|
||||
async init() {
|
||||
await this.run(new Joy_Park_Run())
|
||||
}
|
||||
|
||||
assets = parseFloat(process.env.JD_JOY_PARK_RUN_ASSETS || '0.04')
|
||||
for (let user of account) {
|
||||
if (user.pt_pin === encodeURIComponent(UserName) && user.joy_park_run) {
|
||||
console.log('自定义终点', user.joy_park_run)
|
||||
assets = parseFloat(user.joy_park_run.toString())
|
||||
break
|
||||
}
|
||||
}
|
||||
// 秒转时分秒
|
||||
secondsToMinutes(seconds: number) {
|
||||
let minutes: number = Math.floor(seconds / 60)
|
||||
let second: number = Math.floor(seconds % 60)
|
||||
return `${minutes}分${second}秒`
|
||||
}
|
||||
|
||||
// 小数加法
|
||||
add(num1: number, num2: number) {
|
||||
let r1: number, r2: number
|
||||
try {
|
||||
res = await team('runningMyPrize', {"linkId": "L-sOanK_5RJCz7I314FpnQ", "pageSize": 20, "time": null, "ids": null})
|
||||
let sum: number = 0
|
||||
for (let t of res.data.detailVos) {
|
||||
r1 = num1.toString().split('.')[1].length
|
||||
} catch (e) {
|
||||
r1 = 0
|
||||
}
|
||||
try {
|
||||
r2 = num2.toString().split('.')[1].length
|
||||
} catch (e) {
|
||||
r2 = 0
|
||||
}
|
||||
let m: number = Math.pow(10, Math.max(r1, r2))
|
||||
return (num1 * m + num2 * m) / m
|
||||
}
|
||||
|
||||
async team(fn: string, body: object) {
|
||||
let timestamp: number = Date.now(), h5st: string
|
||||
h5st = this.teamTool.__genH5st({
|
||||
appid: "activities_platform",
|
||||
body: JSON.stringify(body),
|
||||
client: "ios",
|
||||
clientVersion: "3.1.0",
|
||||
functionId: fn,
|
||||
t: timestamp.toString()
|
||||
})
|
||||
return await this.get(`https://api.m.jd.com/?functionId=${fn}&body=${encodeURIComponent(JSON.stringify(body))}&t=${timestamp}&appid=activities_platform&client=ios&clientVersion=3.1.0&cthr=1&h5st=${h5st}`, {
|
||||
'Host': 'api.m.jd.com',
|
||||
'User-Agent': 'jdltapp;',
|
||||
'Origin': 'https://h5platform.jd.com',
|
||||
'X-Requested-With': 'com.jd.jdlite',
|
||||
'Referer': 'https://h5platform.jd.com/',
|
||||
'Cookie': this.user.cookie
|
||||
})
|
||||
}
|
||||
|
||||
async api(fn: string, body: object) {
|
||||
let timestamp: number = Date.now(), h5st: string = ''
|
||||
if (fn === 'runningOpenBox') {
|
||||
h5st = this.apiTool.__genH5st({
|
||||
appid: "activities_platform",
|
||||
body: JSON.stringify(body),
|
||||
client: "ios",
|
||||
clientVersion: "3.1.0",
|
||||
functionId: fn,
|
||||
t: timestamp.toString()
|
||||
})
|
||||
}
|
||||
let params: string = `functionId=${fn}&body=${JSON.stringify(body)}&t=${timestamp}&appid=activities_platform&client=ios&clientVersion=3.1.0&cthr=1`
|
||||
h5st && (params += `&h5st=${h5st}`)
|
||||
return await this.post('https://api.m.jd.com/', params, {
|
||||
'authority': 'api.m.jd.com',
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'cookie': this.user.cookie,
|
||||
'origin': 'https://h5platform.jd.com',
|
||||
'referer': 'https://h5platform.jd.com/',
|
||||
'user-agent': 'jdltapp;iPhone;3.1.0;'
|
||||
})
|
||||
}
|
||||
|
||||
async runningPageHome() {
|
||||
return this.get(`https://api.m.jd.com/?functionId=runningPageHome&body=%7B%22linkId%22:%22L-sOanK_5RJCz7I314FpnQ%22,%22isFromJoyPark%22:true,%22joyLinkId%22:%22LsQNxL7iWDlXUs6cFl-AAg%22%7D&t=${Date.now()}&appid=activities_platform&client=ios&clientVersion=3.1.0`, {
|
||||
'Host': 'api.m.jd.com',
|
||||
'Origin': 'https://h5platform.jd.com',
|
||||
'User-Agent': 'jdltapp;',
|
||||
'Referer': 'https://h5platform.jd.com/',
|
||||
'Cookie': this.user.cookie
|
||||
})
|
||||
}
|
||||
|
||||
async main(user: User) {
|
||||
this.user = user
|
||||
let assets: number = parseFloat(process.env.JD_JOY_PARK_RUN_ASSETS || '0.08')
|
||||
let rewardAmount: number = 0
|
||||
try {
|
||||
this.teamTool = new H5ST('448de', 'jdltapp;', process.env.FP_448DE || '')
|
||||
await this.teamTool.__genAlgo()
|
||||
let res: any = await this.team('runningMyPrize', {"linkId": "L-sOanK_5RJCz7I314FpnQ", "pageSize": 20, "time": null, "ids": null})
|
||||
let sum: number = 0, success: number = 0
|
||||
rewardAmount = res.data.rewardAmount
|
||||
if (res.data.runningCashStatus.currentEndTime && res.data.runningCashStatus.status === 0) {
|
||||
console.log('可提现', rewardAmount)
|
||||
res = await this.api('runningPrizeDraw', {"linkId": "L-sOanK_5RJCz7I314FpnQ", "type": 2})
|
||||
await this.wait(2000)
|
||||
console.log(res.data.message)
|
||||
}
|
||||
|
||||
for (let t of res?.data?.detailVos || []) {
|
||||
if (getDate(new Date(t.createTime)) === new Date().getDate()) {
|
||||
sum = add(sum, t.amount)
|
||||
sum = this.add(sum, t.amount)
|
||||
success++
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
console.log('今日收益', sum)
|
||||
|
||||
await h5stTool.__genAlgo()
|
||||
res = await team('runningTeamInfo', {"linkId": "L-sOanK_5RJCz7I314FpnQ"})
|
||||
if (!captainId && res.data.members.length === 0) {
|
||||
console.log('组队ID不存在,开始创建组队')
|
||||
captainId = res.data.captainId
|
||||
} else if (captainId && res.data.members.length === 0) {
|
||||
console.log('成功', success)
|
||||
console.log('收益', parseFloat(sum.toFixed(2)))
|
||||
res = await this.team('runningTeamInfo', {"linkId": "L-sOanK_5RJCz7I314FpnQ"})
|
||||
if (!this.captainId) {
|
||||
if (res.data.members.length === 0) {
|
||||
console.log('成为队长')
|
||||
this.captainId = res.data.captainId
|
||||
} else if (res.data.members.length !== 6) {
|
||||
console.log('队伍未满', res.data.members.length)
|
||||
this.captainId = res.data.captainId
|
||||
} else {
|
||||
console.log('队伍已满')
|
||||
}
|
||||
} else if (this.captainId && res.data.members.length === 0) {
|
||||
console.log('已有组队ID,未加入队伍')
|
||||
res = await team('runningJoinTeam', {"linkId": "L-sOanK_5RJCz7I314FpnQ", "captainId": captainId})
|
||||
res = await this.team('runningJoinTeam', {"linkId": "L-sOanK_5RJCz7I314FpnQ", "captainId": this.captainId})
|
||||
if (res.code === 0) {
|
||||
console.log('组队成功')
|
||||
for (let member of res.data.members) {
|
||||
@ -68,131 +152,70 @@ let assets: number = 0.04, captainId: string = '', h5stTool: H5ST = new H5ST('b6
|
||||
}
|
||||
if (res.data.members.length === 6) {
|
||||
console.log('队伍已满')
|
||||
captainId = ''
|
||||
this.captainId = ''
|
||||
}
|
||||
} else {
|
||||
this.o2s(res, '组队失败')
|
||||
}
|
||||
} else {
|
||||
console.log('已组队', res.data.members.length)
|
||||
console.log('战队收益', res.data.teamSumPrize)
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('组队 Error', e)
|
||||
}
|
||||
|
||||
try {
|
||||
res = await runningPageHome()
|
||||
this.apiTool = new H5ST('b6ac3', 'jdltapp;', process.env.FP_B6AC3 || '')
|
||||
await this.apiTool.__genAlgo()
|
||||
res = await this.runningPageHome()
|
||||
console.log('🧧', res.data.runningHomeInfo.prizeValue)
|
||||
await wait(2000)
|
||||
console.log('💊', res.data.runningHomeInfo.energy)
|
||||
await this.wait(2000)
|
||||
|
||||
console.log('能量恢复中', secondsToMinutes(res.data.runningHomeInfo.nextRunningTime / 1000), '能量棒', res.data.runningHomeInfo.energy)
|
||||
console.log('⏳', this.secondsToMinutes(res.data.runningHomeInfo.nextRunningTime / 1000))
|
||||
if (res.data.runningHomeInfo.nextRunningTime && res.data.runningHomeInfo.nextRunningTime / 1000 < 300) {
|
||||
await wait(res.data.runningHomeInfo.nextRunningTime)
|
||||
res = await runningPageHome()
|
||||
console.log('能量恢复中', secondsToMinutes(res.data.runningHomeInfo.nextRunningTime / 1000), '能量棒', res.data.runningHomeInfo.energy)
|
||||
await wait(1000)
|
||||
console.log('⏳')
|
||||
await this.wait(res.data.runningHomeInfo.nextRunningTime + 3000)
|
||||
res = await this.runningPageHome()
|
||||
await this.wait(1000)
|
||||
} else if (res.data.runningHomeInfo.nextRunningTime && res.data.runningHomeInfo.nextRunningTime / 1000 > 3000 && res.data.runningHomeInfo.energy !== 0) {
|
||||
console.log('💉')
|
||||
res = await this.api('runningUseEnergyBar', {"linkId": "L-sOanK_5RJCz7I314FpnQ"})
|
||||
console.log(res.errMsg)
|
||||
res = await this.runningPageHome()
|
||||
await this.wait(1000)
|
||||
}
|
||||
|
||||
if (!res.data.runningHomeInfo.nextRunningTime) {
|
||||
console.log('终点目标', assets)
|
||||
for (let i = 0; i < 10; i++) {
|
||||
res = await api('runningOpenBox', {"linkId": "L-sOanK_5RJCz7I314FpnQ"})
|
||||
res = await this.api('runningOpenBox', {"linkId": "L-sOanK_5RJCz7I314FpnQ"})
|
||||
if (parseFloat(res.data.assets) >= assets) {
|
||||
let assets: number = parseFloat(res.data.assets)
|
||||
res = await api('runningPreserveAssets', {"linkId": "L-sOanK_5RJCz7I314FpnQ"})
|
||||
res = await this.api('runningPreserveAssets', {"linkId": "L-sOanK_5RJCz7I314FpnQ"})
|
||||
console.log('领取成功', assets)
|
||||
break
|
||||
} else {
|
||||
if (res.data.doubleSuccess) {
|
||||
console.log('翻倍成功', parseFloat(res.data.assets))
|
||||
await wait(5000)
|
||||
await this.wait(5000)
|
||||
} else if (!res.data.doubleSuccess && !res.data.runningHomeInfo.runningFinish) {
|
||||
console.log('开始跑步', parseFloat(res.data.assets))
|
||||
await wait(5000)
|
||||
await this.wait(5000)
|
||||
} else {
|
||||
console.log('翻倍失败')
|
||||
break
|
||||
}
|
||||
}
|
||||
await wait(5000)
|
||||
await this.wait(5000)
|
||||
}
|
||||
}
|
||||
|
||||
res = await runningPageHome()
|
||||
res = await this.runningPageHome()
|
||||
console.log('🧧', res.data.runningHomeInfo.prizeValue)
|
||||
await wait(2000)
|
||||
await this.wait(2000)
|
||||
} catch (e) {
|
||||
console.log('跑步 Error', e)
|
||||
console.log('Error', e)
|
||||
await this.wait(3000)
|
||||
}
|
||||
}
|
||||
})()
|
||||
|
||||
async function api(fn: string, body: object) {
|
||||
let timestamp: number = Date.now(), h5st: string = ''
|
||||
if (fn === 'runningOpenBox') {
|
||||
h5st = h5stTool.__genH5st({
|
||||
appid: "activities_platform",
|
||||
body: JSON.stringify(body),
|
||||
client: "ios",
|
||||
clientVersion: "3.1.0",
|
||||
functionId: "runningOpenBox",
|
||||
t: timestamp.toString()
|
||||
})
|
||||
}
|
||||
let params: string = `functionId=${fn}&body=${JSON.stringify(body)}&t=${timestamp}&appid=activities_platform&client=ios&clientVersion=3.1.0&cthr=1`
|
||||
h5st && (params += `&h5st=${h5st}`)
|
||||
return await post('https://api.m.jd.com/', params, {
|
||||
'authority': 'api.m.jd.com',
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'cookie': cookie,
|
||||
'origin': 'https://h5platform.jd.com',
|
||||
'referer': 'https://h5platform.jd.com/',
|
||||
'user-agent': 'jdltapp;'
|
||||
})
|
||||
}
|
||||
|
||||
async function runningPageHome() {
|
||||
return get(`https://api.m.jd.com/?functionId=runningPageHome&body=%7B%22linkId%22:%22L-sOanK_5RJCz7I314FpnQ%22,%22isFromJoyPark%22:true,%22joyLinkId%22:%22LsQNxL7iWDlXUs6cFl-AAg%22%7D&t=${Date.now()}&appid=activities_platform&client=ios&clientVersion=3.1.0`, {
|
||||
'Host': 'api.m.jd.com',
|
||||
'Origin': 'https://h5platform.jd.com',
|
||||
'User-Agent': 'jdltapp;',
|
||||
'Referer': 'https://h5platform.jd.com/',
|
||||
'Cookie': cookie
|
||||
})
|
||||
}
|
||||
|
||||
async function team(fn: string, body: object) {
|
||||
let timestamp: number = Date.now()
|
||||
let h5st: string = ''
|
||||
return await get(`https://api.m.jd.com/?functionId=${fn}&body=${encodeURIComponent(JSON.stringify(body))}&t=${timestamp}&appid=activities_platform&client=ios&clientVersion=3.1.0&cthr=1&h5st=${h5st}`, {
|
||||
'Host': 'api.m.jd.com',
|
||||
'User-Agent': 'jdltapp;',
|
||||
'Origin': 'https://h5platform.jd.com',
|
||||
'X-Requested-With': 'com.jd.jdlite',
|
||||
'Referer': 'https://h5platform.jd.com/',
|
||||
'Cookie': cookie
|
||||
})
|
||||
}
|
||||
|
||||
// 秒转时分秒
|
||||
function secondsToMinutes(seconds: number) {
|
||||
let minutes: number = Math.floor(seconds / 60)
|
||||
let second: number = Math.floor(seconds % 60)
|
||||
return `${minutes}分${second}秒`
|
||||
}
|
||||
|
||||
// 小数加法
|
||||
function add(num1: number, num2: number) {
|
||||
let r1: number, r2: number
|
||||
try {
|
||||
r1 = num1.toString().split('.')[1].length
|
||||
} catch (e) {
|
||||
r1 = 0
|
||||
}
|
||||
try {
|
||||
r2 = num2.toString().split('.')[1].length
|
||||
} catch (e) {
|
||||
r2 = 0
|
||||
}
|
||||
let m: number = Math.pow(10, Math.max(r1, r2))
|
||||
return (num1 * m + num2 * m) / m
|
||||
}
|
||||
new Joy_Park_Run().init().then()
|
||||
|
54
jd_queryRedpacket.ts
Normal file
54
jd_queryRedpacket.ts
Normal file
@ -0,0 +1,54 @@
|
||||
import {JDHelloWorld, User} from "./TS_JDHelloWorld";
|
||||
|
||||
class Jd_queryRedpacket extends JDHelloWorld {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
async init() {
|
||||
await this.run(new Jd_queryRedpacket())
|
||||
}
|
||||
|
||||
async main(user: User) {
|
||||
let res: any = await this.get(`https://m.jingxi.com/user/info/QueryUserRedEnvelopesV2?type=1&orgFlag=JD_PinGou_New&page=1&cashRedType=1&redBalanceFlag=1&channel=1&_=${Date.now()}&sceneval=2&g_login_type=1&g_ty=ls`, {
|
||||
'Host': 'm.jingxi.com',
|
||||
'Referer': 'https://st.jingxi.com/my/redpacket.shtml',
|
||||
"Cookie": user.cookie,
|
||||
'User-Agent': user.UserAgent
|
||||
})
|
||||
let day: number = new Date().getDay(), jdRed: number = 0, jdRedExp: number = 0
|
||||
for (let j of res.data.useRedInfo?.redList || []) {
|
||||
if (j.orgLimitStr.includes('京喜')) {
|
||||
} else if (j.activityName.includes('极速版')) {
|
||||
} else if (j.orgLimitStr.includes('京东健康')) {
|
||||
} else {
|
||||
jdRed = add(jdRed, j.balance)
|
||||
if (new Date(j.endTime * 1000).getDay() === day)
|
||||
jdRedExp = add(jdRedExp, j.balance)
|
||||
}
|
||||
}
|
||||
console.log(jdRed, ' 今日过期:', jdRedExp)
|
||||
let msg = `【账号】 ${user.UserName}\n京东红包 ${jdRed}\n今日过期 ${jdRedExp}\n\n`
|
||||
return {
|
||||
msg: msg
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
new Jd_queryRedpacket().init().then().catch()
|
||||
|
||||
function add(arg1: number, arg2: number) {
|
||||
let r1, r2, m
|
||||
try {
|
||||
r1 = arg1.toString().split('.')[1].length
|
||||
} catch (e) {
|
||||
r1 = 0
|
||||
}
|
||||
try {
|
||||
r2 = arg2.toString().split('.')[1].length
|
||||
} catch (e) {
|
||||
r2 = 0
|
||||
}
|
||||
m = Math.pow(10, Math.max(r1, r2))
|
||||
return parseFloat(((arg1 * m + arg2 * m) / m).toFixed(2))
|
||||
}
|
@ -1,21 +1,23 @@
|
||||
/**
|
||||
* 微信小程序签到红包
|
||||
* FP_9A38A
|
||||
* cron: 8 0 * * *
|
||||
*/
|
||||
|
||||
import {sendNotify} from './sendNotify'
|
||||
import {post, requireConfig, wait} from './TS_USER_AGENTS'
|
||||
import {H5ST} from "./utils/h5st"
|
||||
import {User, JDHelloWorld} from "./TS_JDHelloWorld";
|
||||
|
||||
let cookie: string = '', res: any = '', UserName: string, msg: string = '', h5stTool: H5ST = new H5ST("9a38a", 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15F79 MicroMessenger/8.0.15(0x18000f2e) NetType/WIFI Language/zh_CN', "6468223550974529");
|
||||
class Wechat_sign extends JDHelloWorld {
|
||||
constructor() {
|
||||
super("微信小程序签到红包");
|
||||
}
|
||||
|
||||
!(async () => {
|
||||
let cookiesArr: string[] = await requireConfig()
|
||||
for (let [index, value] of cookiesArr.entries()) {
|
||||
cookie = value
|
||||
UserName = decodeURIComponent(cookie.match(/pt_pin=([^;]*)/)![1])
|
||||
console.log(`\n开始【京东账号${index + 1}】${UserName}\n`)
|
||||
async init() {
|
||||
await this.run(new Wechat_sign())
|
||||
}
|
||||
|
||||
async main(user: User) {
|
||||
let h5stTool = new H5ST("9a38a", 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15F79 MicroMessenger/8.0.15(0x18000f2e) NetType/WIFI Language/zh_CN', process.env.FP_9A38A || "");
|
||||
await h5stTool.__genAlgo()
|
||||
let timestamp: number = Date.now()
|
||||
let h5st: string = h5stTool.__genH5st({
|
||||
@ -26,18 +28,19 @@ let cookie: string = '', res: any = '', UserName: string, msg: string = '', h5st
|
||||
functionId: 'SignComponent_doSignTask',
|
||||
t: timestamp.toString(),
|
||||
})
|
||||
res = await post(`https://api.m.jd.com/signTask/doSignTask?functionId=SignComponent_doSignTask&appid=hot_channel&body={"activityId":"10002"}&client=android&clientVersion=7.16.250&t=${timestamp}&h5st=${h5st}`, '', {
|
||||
let res: any = await this.post(`https://api.m.jd.com/signTask/doSignTask?functionId=SignComponent_doSignTask&appid=hot_channel&body={"activityId":"10002"}&client=android&clientVersion=7.16.250&t=${timestamp}&h5st=${h5st}`, '', {
|
||||
'content-type': 'application/json',
|
||||
'user-agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15F79 MicroMessenger/8.0.15(0x18000f2e) NetType/WIFI Language/zh_CN',
|
||||
'referer': 'https://servicewechat.com/wx91d27dbf599dff74/581/page-frame.html',
|
||||
'cookie': cookie
|
||||
'cookie': user.cookie
|
||||
})
|
||||
if (res.data) {
|
||||
console.log('已签到', res.data.signDays, '天,奖励', res.data.rewardValue, '元')
|
||||
msg += `【京东账号${index + 1}】 ${UserName}\n已签到 ${res.data.signDays}天\n奖励 ${res.data.rewardValue}元\n\n`
|
||||
} else
|
||||
return {msg: `【京东账号${user.i + 1}】 ${user.UserName}\n已签到 ${res.data.signDays}天\n奖励 ${res.data.rewardValue}元\n\n`}
|
||||
} else {
|
||||
console.log(res.message)
|
||||
await wait(3000)
|
||||
}
|
||||
}
|
||||
await sendNotify('微信小程序签到红包', msg)
|
||||
})()
|
||||
}
|
||||
|
||||
new Wechat_sign().init().then()
|
77
jd_wish.js
77
jd_wish.js
@ -5,17 +5,17 @@
|
||||
===============Quantumultx===============
|
||||
[task_local]
|
||||
#众筹许愿池
|
||||
40 0,2 * * * https://raw.githubusercontent.com/222222/sync/jd_scripts/jd_wish.js, tag=众筹许愿池, img-url=https://raw.githubusercontent.com/Orz-3/mini/master/Color/jd.png, enabled=true
|
||||
40 0,2 * * * https://raw.githubusercontent.com/shufflewzc/faker2/main/jd_wish.js, tag=众筹许愿池, img-url=https://raw.githubusercontent.com/Orz-3/mini/master/Color/jd.png, enabled=true
|
||||
|
||||
================Loon==============
|
||||
[Script]
|
||||
cron "40 0,2 * * *" script-path=https://raw.githubusercontent.com/222222/sync/jd_scripts/jd_wish.js,tag=众筹许愿池
|
||||
cron "40 0,2 * * *" script-path=https://raw.githubusercontent.com/shufflewzc/faker2/main/jd_wish.js,tag=众筹许愿池
|
||||
|
||||
===============Surge=================
|
||||
众筹许愿池 = type=cron,cronexp="40 0,2 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/222222/sync/jd_scripts/jd_wish.js
|
||||
众筹许愿池 = type=cron,cronexp="40 0,2 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/shufflewzc/faker2/main/jd_wish.js
|
||||
|
||||
============小火箭=========
|
||||
众筹许愿池 = type=cron,script-path=https://raw.githubusercontent.com/222222/sync/jd_scripts/jd_wish.js, cronexpr="40 0,2 * * *", timeout=3600, enable=true
|
||||
众筹许愿池 = type=cron,script-path=https://raw.githubusercontent.com/shufflewzc/faker2/main/jd_wish.js, cronexpr="40 0,2 * * *", timeout=3600, enable=true
|
||||
*/
|
||||
const $ = new Env('众筹许愿池');
|
||||
const notify = $.isNode() ? require('./sendNotify') : '';
|
||||
@ -72,12 +72,7 @@ if ($.isNode()) {
|
||||
if ($.isNode()) await notify.sendNotify($.name, allMessage);
|
||||
$.msg($.name, '', allMessage)
|
||||
}
|
||||
let res = await getAuthorShareCode('https://raw.githubusercontent.com/222222/11111128/master/shareCodes/11111127')
|
||||
if (!res) {
|
||||
$.http.get({url: 'https://purge.jsdelivr.net/gh/222222/11111128@master/shareCodes/11111127'}).then((resp) => {}).catch((e) => console.log('刷新CDN异常', e));
|
||||
await $.wait(1000)
|
||||
res = await getAuthorShareCode('https://cdn.jsdelivr.net/gh/222222/11111128@master/shareCodes/11111127')
|
||||
}
|
||||
let res = await getAuthorShareCode('https://gitee.com/KingRan521/JD-Scripts/raw/master/shareCodes/wish.json')
|
||||
$.shareCode = [...$.shareCode, ...(res || [])]
|
||||
for (let i = 0; i < cookiesArr.length; i++) {
|
||||
if (cookiesArr[i]) {
|
||||
@ -136,7 +131,6 @@ async function jd_wish() {
|
||||
await interact_template_getLotteryResult()
|
||||
await $.wait(2000)
|
||||
}
|
||||
if (message) allMessage += `京东账号${$.index} ${$.nickName || $.UserName}\n${appName}\n${message}${$.index !== cookiesArr.length ? '\n\n' : ''}`
|
||||
|
||||
} catch (e) {
|
||||
$.logErr(e)
|
||||
@ -145,7 +139,8 @@ async function jd_wish() {
|
||||
|
||||
async function healthyDay_getHomeData(type = true) {
|
||||
return new Promise(async resolve => {
|
||||
$.post(taskUrl('healthyDay_getHomeData', {"appId":appId,"taskToken":"","channelId":1}), async (err, resp, data) => {
|
||||
// console.log(taskUrl('healthyDay_getHomeData', { "appId": appId, "taskToken": "", "channelId": 1 }));
|
||||
$.post(taskUrl('healthyDay_getHomeData', { "appId": appId, "taskToken": "", "channelId": 1 }), async (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
console.log(`${JSON.stringify(err)}`)
|
||||
@ -153,47 +148,69 @@ async function healthyDay_getHomeData(type = true) {
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
data = JSON.parse(data);
|
||||
// console.log(data);
|
||||
if (type) {
|
||||
for (let key of Object.keys(data.data.result.taskVos).reverse()) {
|
||||
let vo = data.data.result.taskVos[key]
|
||||
if (vo.status !== 2 && vo.status !== 0) {
|
||||
if (vo.status !== 2) {
|
||||
if (vo.taskType === 13 || vo.taskType === 12) {
|
||||
console.log(`签到`)
|
||||
await harmony_collectScore({"appId":appId,"taskToken":vo.simpleRecordInfoVo.taskToken,"taskId":vo.taskId,"actionType":"0"}, vo.taskType)
|
||||
await harmony_collectScore({ "appId": appId, "taskToken": vo.simpleRecordInfoVo.taskToken, "taskId": vo.taskId, "actionType": "0" }, vo.taskType)
|
||||
} else if (vo.taskType === 1) {
|
||||
$.complete = false;
|
||||
for (let key of Object.keys(vo.followShopVo)) {
|
||||
let followShopVo = vo.followShopVo[key]
|
||||
if (followShopVo.status !== 2) {
|
||||
console.log(`【${followShopVo.shopName}】${vo.subTitleName}`)
|
||||
await harmony_collectScore({"appId":appId,"taskToken":followShopVo.taskToken,"taskId":vo.taskId,"actionType":"0"})
|
||||
if ($.complete) break;
|
||||
await harmony_collectScore({ "appId": appId, "taskToken": followShopVo.taskToken, "taskId": vo.taskId, "actionType": "0" })
|
||||
}
|
||||
}
|
||||
} else if (vo.taskType === 8) {
|
||||
$.complete = false;
|
||||
} else if (vo.taskType === 5) {
|
||||
for (let key of Object.keys(vo.browseShopVo)) {
|
||||
let browseShopVo = vo.browseShopVo[key]
|
||||
if (browseShopVo.status !== 2) {
|
||||
console.log(`【${browseShopVo.skuName}】${vo.subTitleName}`)
|
||||
await harmony_collectScore({ "appId": appId, "taskToken": browseShopVo.taskToken, "taskId": vo.taskId, "actionType": "0" })
|
||||
}
|
||||
}
|
||||
} else if (vo.taskType === 15) {
|
||||
for (let key of Object.keys(vo.productInfoVos)) {
|
||||
let productInfoVos = vo.productInfoVos[key]
|
||||
if (productInfoVos.status !== 2) {
|
||||
console.log(`【${productInfoVos.skuName}】${vo.subTitleName}`)
|
||||
await harmony_collectScore({"appId":appId,"taskToken":productInfoVos.taskToken,"taskId":vo.taskId,"actionType":"1"})
|
||||
await $.wait(vo.waitDuration * 1000)
|
||||
await harmony_collectScore({"appId":appId,"taskToken":productInfoVos.taskToken,"taskId":vo.taskId,"actionType":"0"})
|
||||
if ($.complete) break;
|
||||
await harmony_collectScore({ "appId": appId, "taskToken": productInfoVos.taskToken, "taskId": vo.taskId, "actionType": "0" })
|
||||
}
|
||||
}
|
||||
} else if (vo.taskType === 3) {
|
||||
for (let key of Object.keys(vo.shoppingActivityVos)) {
|
||||
let shoppingActivityVos = vo.shoppingActivityVos[key]
|
||||
if (shoppingActivityVos.status !== 2) {
|
||||
console.log(`【${vo.subTitleName}】`)
|
||||
await harmony_collectScore({ "appId": appId, "taskToken": shoppingActivityVos.taskToken, "taskId": vo.taskId, "actionType": "0" })
|
||||
}
|
||||
}
|
||||
} else if (vo.taskType === 8) {
|
||||
for (let key of Object.keys(vo.productInfoVos)) {
|
||||
let productInfoVos = vo.productInfoVos[key]
|
||||
if (productInfoVos.status !== 2) {
|
||||
console.log(`【${productInfoVos.skuName}】${vo.subTitleName}`)
|
||||
await harmony_collectScore({ "appId": appId, "taskToken": productInfoVos.taskToken, "taskId": vo.taskId, "actionType": "1" })
|
||||
await $.wait(vo.waitDuration * 1000)
|
||||
await harmony_collectScore({ "appId": appId, "taskToken": productInfoVos.taskToken, "taskId": vo.taskId, "actionType": "0" })
|
||||
}
|
||||
}
|
||||
} else if (vo.taskType === 27 && vo.taskId === 18) {
|
||||
console.log(`【${vo.subTitleName}】`)
|
||||
await harmony_collectScore({ "appId": appId, "taskToken": vo.productInfoVos[0].taskToken, "taskId": vo.taskId, "actionType": "0" })
|
||||
} else if (vo.taskType === 9 || vo.taskType === 26) {
|
||||
$.complete = false;
|
||||
for (let key of Object.keys(vo.shoppingActivityVos)) {
|
||||
let shoppingActivityVos = vo.shoppingActivityVos[key]
|
||||
if (shoppingActivityVos.status !== 2) {
|
||||
console.log(`【${shoppingActivityVos.title}】${vo.subTitleName}`)
|
||||
if (vo.taskType === 9) {
|
||||
await harmony_collectScore({"appId":appId,"taskToken":shoppingActivityVos.taskToken,"taskId":vo.taskId,"actionType":"1"})
|
||||
await harmony_collectScore({ "appId": appId, "taskToken": shoppingActivityVos.taskToken, "taskId": vo.taskId, "actionType": "1" })
|
||||
await $.wait(vo.waitDuration * 1000)
|
||||
}
|
||||
await harmony_collectScore({"appId":appId,"taskToken":shoppingActivityVos.taskToken,"taskId":vo.taskId,"actionType":"0"})
|
||||
if ($.complete) break;
|
||||
await harmony_collectScore({ "appId": appId, "taskToken": shoppingActivityVos.taskToken, "taskId": vo.taskId, "actionType": "0" })
|
||||
}
|
||||
}
|
||||
} else if (vo.taskType === 14) {
|
||||
@ -234,7 +251,7 @@ function harmony_collectScore(body = {}, taskType = '') {
|
||||
if (data && data.data && data.data.bizCode === 0) {
|
||||
if (taskType === 13) {
|
||||
console.log(`签到成功:获得${data.data.result.score}金币\n`)
|
||||
} else if (body.taskId == 6) {
|
||||
} else if (body.taskId == 5) {
|
||||
console.log(`助力成功:您的好友获得${data.data.result.score}金币\n`)
|
||||
} else {
|
||||
console.log(`完成任务:获得${data.data.result.score}金币\n`)
|
||||
@ -242,13 +259,12 @@ function harmony_collectScore(body = {}, taskType = '') {
|
||||
} else {
|
||||
if (taskType === 13) {
|
||||
console.log(`签到失败:${data.data.bizMsg}\n`)
|
||||
} else if (body.taskId == 6) {
|
||||
} else if (body.taskId == 5) {
|
||||
console.log(`助力失败:${data.data.bizMsg || data.msg}\n`)
|
||||
if (data.code === -30001 || (data.data && data.data.bizCode === 108)) $.canHelp = false
|
||||
if (data.data.bizCode === 103) $.delcode = true
|
||||
} else {
|
||||
console.log(body.actionType === "0" ? `完成任务失败:${data.data.bizMsg}\n` : data.data.bizMsg)
|
||||
if (data.data.bizMsg === "任务已完成") $.complete = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -261,6 +277,7 @@ function harmony_collectScore(body = {}, taskType = '') {
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function interact_template_getLotteryResult() {
|
||||
return new Promise(resolve => {
|
||||
$.post(taskUrl('interact_template_getLotteryResult', {"appId":appId}), (err, resp, data) => {
|
||||
|
40
jd_zjd.ts
40
jd_zjd.ts
@ -1,16 +1,18 @@
|
||||
/**
|
||||
* v0.2
|
||||
* const $ = new Env('赚喜豆-TS版');
|
||||
* cron: 15,30,45 0 * * *
|
||||
* CK1 优先助力HW.ts
|
||||
* 修改自HW大佬,默认开团前7,需要请自行修改
|
||||
* 修改自HW大佬,纯内部助力,定时请自行修改,频繁跑火爆黑IP
|
||||
* 修改自HW大佬,建议使用原作者版本,衰仔,明白了吗?
|
||||
*/
|
||||
|
||||
import axios from "axios";
|
||||
import {zjdInit, zjdH5st} from "./utils/jd_zjd_tool.js";
|
||||
import {o2s, wait, requireConfig, getshareCodeHW} from "./TS_USER_AGENTS";
|
||||
import {zjdInit, zjdH5st} from "./function/zjdtool.js";
|
||||
import {o2s, wait, requireConfig} from "./function/TS_USER_AGENTS";
|
||||
import {SHA256} from "crypto-js";
|
||||
|
||||
let cookie: string = '', res: any = '', UserName: string
|
||||
let shareCodeSelf: Tuan[] = [], shareCode: Tuan[] = [], shareCodeHW: any = []
|
||||
let shareCodeSelf: Tuan[] = [], shareCode: Tuan[] = []
|
||||
|
||||
interface Tuan {
|
||||
activityIdEncrypted: string, // id
|
||||
@ -19,11 +21,13 @@ interface Tuan {
|
||||
}
|
||||
|
||||
!(async () => {
|
||||
let cookiesArr: string[] = await requireConfig()
|
||||
let cookiesArr: string[] = await requireConfig(false)
|
||||
for (let [index, value] of cookiesArr.entries()) {
|
||||
try {
|
||||
if(index < 7){
|
||||
try {
|
||||
await zjdInit()
|
||||
cookie = value
|
||||
|
||||
UserName = decodeURIComponent(cookie.match(/pt_pin=([^;]*)/)![1])
|
||||
console.log(`\n开始【京东账号${index + 1}】${UserName}\n`)
|
||||
|
||||
@ -73,33 +77,26 @@ interface Tuan {
|
||||
} else if (!res.data.canStartNewAssist) {
|
||||
console.log('不可开团')
|
||||
}
|
||||
await wait(1000)
|
||||
} catch (e) {
|
||||
continue
|
||||
}
|
||||
await wait(1000)
|
||||
}
|
||||
}
|
||||
|
||||
o2s(shareCodeSelf)
|
||||
await wait(2000)
|
||||
|
||||
console.log('内部助力:', shareCodeSelf)
|
||||
for (let [index, value] of cookiesArr.entries()) {
|
||||
if (shareCodeHW.length === 0) {
|
||||
shareCodeHW = await getshareCodeHW('zjd');
|
||||
}
|
||||
shareCode = index === 0
|
||||
? Array.from(new Set([...shareCodeHW, ...shareCodeSelf]))
|
||||
: Array.from(new Set([...shareCodeSelf, ...shareCodeHW]))
|
||||
|
||||
cookie = value
|
||||
try {
|
||||
cookie = value
|
||||
UserName = decodeURIComponent(cookie.match(/pt_pin=([^;]*)/)![1])
|
||||
console.log(`\n开始【京东账号${index + 1}】${UserName}\n`)
|
||||
shareCode = Array.from(new Set([...shareCodeSelf]))
|
||||
|
||||
await zjdInit()
|
||||
for (let code of shareCode) {
|
||||
try {
|
||||
console.log(`账号${index + 1} ${UserName} 去助力 ${code.assistedPinEncrypted.replace('\n', '')}`)
|
||||
res = await api('vvipclub_distributeBean_assist', {"activityIdEncrypted": code.activityIdEncrypted, "assistStartRecordId": code.assistStartRecordId, "assistedPinEncrypted": code.assistedPinEncrypted, "channel": "FISSION_BEAN", "launchChannel": "undefined"})
|
||||
|
||||
if (res.resultCode === '9200008') {
|
||||
console.log('不能助力自己')
|
||||
} else if (res.resultCode === '2400203' || res.resultCode === '90000014') {
|
||||
@ -121,6 +118,9 @@ interface Tuan {
|
||||
await wait(2000)
|
||||
}
|
||||
await wait(2000)
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
})()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user