Dylan 2 years ago
parent
commit
ec7189cd6b
3 changed files with 54 additions and 34 deletions
  1. +2
    -2
      TS_USER_AGENTS.ts
  2. +4
    -5
      function/h5st.ts
  3. +48
    -27
      jd_joy_park_run.ts

+ 2
- 2
TS_USER_AGENTS.ts View File

@ -120,8 +120,8 @@ async function requireConfig(check: boolean = false): Promise<string[]> {
return cookiesArr
}
async function checkCookie(cookie) {
await wait(1000)
async function checkCookie(cookie: string) {
await wait(3000)
try {
let {data}: any = await axios.get(`https://api.m.jd.com/client.action?functionId=GetJDUserInfoUnion&appid=jd-cphdeveloper-m&body=${encodeURIComponent(JSON.stringify({"orgFlag": "JD_PinGou_New", "callSource": "mainorder", "channel": 4, "isHomewhite": 0, "sceneval": 2}))}&loginType=2&_=${Date.now()}&sceneval=2&g_login_type=1&callback=GetJDUserInfoUnion&g_ty=ls`, {
headers: {


+ 4
- 5
function/h5st.ts View File

@ -1,7 +1,6 @@
import axios from "axios"
import {format} from "date-fns"
const CryptoJS = require("crypto-js")
import * as CryptoJS from 'crypto-js'
class H5ST {
tk: string;
@ -51,7 +50,7 @@ class H5ST {
this.enc = data.data.result.algo.match(/algo\.(.*)\(/)[1]
}
__genKey(tk, fp, ts, ai, algo) {
__genKey(tk: string, fp: string, ts: string, ai: string, algo: object) {
let str = `${tk}${fp}${ts}${ai}${this.rd}`;
return algo[this.enc](str, tk)
}
@ -59,8 +58,8 @@ class H5ST {
__genH5st(body: object) {
let y = this.__genKey(this.tk, this.fp, this.timestamp, this.appId, CryptoJS).toString(CryptoJS.enc.Hex)
let s = ''
for (let i in body) {
i === 'body' ? s += `${i}:${CryptoJS.SHA256(body[i]).toString(CryptoJS.enc.Hex)}&` : s += `${i}:${body[i]}&`
for (let key of Object.keys(body)) {
key === 'body' ? s += `${key}:${CryptoJS.SHA256(body[key]).toString(CryptoJS.enc.Hex)}&` : s += `${key}:${body[key]}&`
}
s = s.slice(0, -1)
s = CryptoJS.HmacSHA256(s, y).toString(CryptoJS.enc.Hex)


+ 48
- 27
jd_joy_park_run.ts View File

@ -1,18 +1,18 @@
/**
-+
0.04,
export JD_JOY_PARK_RUN_ASSETS="0.04"
0.08,
export JD_JOY_PARK_RUN_ASSETS="0.08"
32 * * * * jd_joy_park_run.ts
new Env('极速版汪汪赛跑')
**/
import {get, post, requireConfig, wait} from './TS_USER_AGENTS'
import {get, post, o2s, requireConfig, wait} from './TS_USER_AGENTS'
import {H5ST} from "./function/h5st"
import {existsSync, readFileSync} from "fs";
import {getDate} from "date-fns";
let cookie: string = '', res: any = '', UserName: string = ''
let assets: number = 0.04, captainId: string = '', h5stTool: H5ST = new H5ST('b6ac3', 'jdltapp;', '1804945295425750')
let cookie: string = '', res: any = '', UserName: string = '', fp_448de: string = '' || process.env.FP_448DE, fp_b6ac3: string = '' || process.env.FP_B6AC3
let assets: number = 0, captainId: string = '', h5stTool: H5ST = null
!(async () => {
let cookiesArr: string[] = await requireConfig()
@ -24,32 +24,44 @@ let assets: number = 0.04, captainId: string = '', h5stTool: H5ST = new H5ST('b6
UserName = decodeURIComponent(cookie.match(/pt_pin=([^;]*)/)![1])
console.log(`\n开始【京东账号${index + 1}${UserName}\n`)
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
}
}
assets = parseFloat(process.env.JD_JOY_PARK_RUN_ASSETS || '0.08')
let rewardAmount: number = 0
try {
h5stTool = new H5ST('448de', 'jdltapp;', fp_448de)
await h5stTool.__genAlgo()
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) {
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 api('runningPrizeDraw', {"linkId": "L-sOanK_5RJCz7I314FpnQ", "type": 2})
await 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)
} else {
break
}
}
console.log('今日收益', sum)
console.log('成功', success)
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
if (!captainId) {
if (res.data.members.length === 0) {
console.log('成为队长')
captainId = res.data.captainId
} else if (res.data.members.length !== 6) {
console.log('队伍未满', res.data.members.length)
captainId = res.data.captainId
} else {
console.log('队伍已满')
}
} else if (captainId && res.data.members.length === 0) {
console.log('已有组队ID,未加入队伍')
res = await team('runningJoinTeam', {"linkId": "L-sOanK_5RJCz7I314FpnQ", "captainId": captainId})
@ -65,16 +77,17 @@ let assets: number = 0.04, captainId: string = '', h5stTool: H5ST = new H5ST('b6
console.log('队伍已满')
captainId = ''
}
} else {
o2s(res, '组队失败')
}
} else {
console.log('已组队', res.data.members.length)
console.log('战队收益', res.data.teamSumPrize)
}
} catch (e) {
console.log('组队 Error', e)
}
try {
h5stTool = new H5ST('b6ac3', 'jdltapp;', fp_b6ac3)
await h5stTool.__genAlgo()
res = await runningPageHome()
console.log('🧧', res.data.runningHomeInfo.prizeValue)
await wait(2000)
@ -116,7 +129,8 @@ let assets: number = 0.04, captainId: string = '', h5stTool: H5ST = new H5ST('b6
console.log('🧧', res.data.runningHomeInfo.prizeValue)
await wait(2000)
} catch (e) {
console.log('跑步 Error', e)
console.log('Error', e)
await wait(3000)
}
}
})()
@ -156,8 +170,15 @@ async function runningPageHome() {
}
async function team(fn: string, body: object) {
let timestamp: number = Date.now()
let h5st: string = ''
let timestamp: number = Date.now(), h5st: string
h5st = h5stTool.__genH5st({
appid: "activities_platform",
body: JSON.stringify(body),
client: "ios",
clientVersion: "3.1.0",
functionId: fn,
t: timestamp.toString()
})
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;',


Loading…
Cancel
Save