forked from Toulu-debug/enen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jd_speed_wabao.ts
176 lines (159 loc) · 5.64 KB
/
jd_speed_wabao.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
/**
* 极速版-挖宝
* cron: 2 0,1,6 * * *
* export FP_CE6C2=""
* CK1 优先助力 HW.ts
* TODO 提现
*/
import {User, JDHelloWorld} from "./TS_JDHelloWorld"
import {H5ST} from "./utils/h5st";
interface INVITE {
inviter: string,
inviteCode: string
}
class Jd_speed_wabao extends JDHelloWorld {
cookie: string
h5stTool: H5ST
sharecode: INVITE[] = []
shareCodesSelf: INVITE[] = []
constructor() {
super();
}
async init() {
await this.run(this)
}
async api(fn: string, body: object) {
let timestamp: number = Date.now()
let h5st: string = this.h5stTool.__genH5st({
appid: 'activities_platform',
body: JSON.stringify(body),
client: 'H5',
clientVersion: '1.0.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=H5&clientVersion=1.0.0&h5st=${h5st}`, {
'Host': 'api.m.jd.com',
'Origin': 'https://bnzf.jd.com',
'User-Agent': `jdltapp;`,
'Referer': 'https://bnzf.jd.com/',
'Cookie': this.cookie
})
}
async main(user: User) {
this.cookie = user.cookie
this.h5stTool = new H5ST("ce6c2", "jdltapp;", process.env.FP_CE6C2 ?? "9929056438203725")
await this.h5stTool.__genAlgo()
let res: any, data: any
try {
res = await this.api('happyDigHome', {"linkId": "pTTvJeSTrpthgk9ASBVGsw"})
console.log('助力码', res.data.markedPin, res.data.inviteCode)
this.shareCodesSelf.push({inviter: res.data.markedPin, inviteCode: res.data.inviteCode})
res = await this.api('apTaskList', {"linkId": "pTTvJeSTrpthgk9ASBVGsw"})
await this.wait(1000)
for (let t of res.data) {
if (t.taskType === 'BROWSE_CHANNEL' && t.taskDoTimes === 0 && t.taskLimitTimes === 1) {
console.log(t.taskShowTitle)
data = await this.api('apDoTask', {"linkId": "pTTvJeSTrpthgk9ASBVGsw", "taskType": "BROWSE_CHANNEL", "taskId": t.id, "channel": 4, "itemId": encodeURIComponent(t.taskSourceUrl), "checkVersion": false})
await this.wait(1000)
if (data.success) {
console.log('任务完成')
} else {
this.o2s(data, '任务失败')
}
}
}
} catch (e) {
console.log('error', e)
}
}
async help(users: User[]) {
console.log('内部助力')
this.o2s(this.shareCodesSelf)
let res: any, shareCodesHW: any = [], shareCodes: any
for (let user of users) {
this.cookie = user.cookie
console.log(`\n开始【京东账号${user.index + 1}】${user.UserName}\n`)
try {
await this.h5stTool.__genAlgo()
if (shareCodesHW.length === 0) {
shareCodesHW = await this.getshareCodeHW('fcwb')
}
if (user.index === 0) {
shareCodes = [...shareCodesHW, ...this.shareCodesSelf]
} else {
shareCodes = [...this.shareCodesSelf, ...shareCodesHW]
}
for (let code of shareCodes) {
console.log(`账号${user.index + 1} ${user.UserName} 去助力 ${code.inviteCode}`)
res = await this.api('happyDigHelp', {"linkId": "pTTvJeSTrpthgk9ASBVGsw", "inviter": code.inviter, "inviteCode": code.inviteCode})
if (res.code === 0) {
console.log('助力成功')
await this.wait(2000)
break
} else if (res.code === 16144) {
console.log('上限')
await this.wait(2000)
break
} else {
console.log(res.code, res.errMsg)
await this.wait(2000)
}
}
} catch (e) {
console.log('error', e)
}
}
for (let user of users) {
this.cookie = user.cookie
console.log(`\n开始【京东账号${user.index + 1}】${user.UserName}\n`)
await this.h5stTool.__genAlgo()
res = await this.api('happyDigHome', {"linkId": "pTTvJeSTrpthgk9ASBVGsw"})
let blood: number = res.data.blood, gameOver: boolean = false
if (blood <= 1) gameOver = true
console.log('❤️', blood)
for (let round = 1; round < 4; round++) {
if (gameOver) break
for (let i = 0; i < 4; i++) {
try {
if (gameOver) {
console.log('能量剩余1,跳过 A')
break
}
for (let j = 0; j < 4; j++) {
if (gameOver) {
console.log('能量剩余1,跳过 B')
break
}
res = await this.api('happyDigDo', {"round": round, "rowIdx": i, "colIdx": j, "linkId": "pTTvJeSTrpthgk9ASBVGsw"})
if (res.data.chunk.type === 1) {
console.log('👎')
} else if (res.data.chunk.type === 2) {
console.log('🧧', parseFloat(res.data.chunk.value))
} else if (res.data.chunk.type === 3) {
console.log('💰', parseFloat(res.data.chunk.value))
} else if (res.data.chunk.type === 4) {
console.log('💣')
} else {
this.o2s(res, '🤔️')
}
await this.wait(3000)
res = await this.api('happyDigHome', {"linkId": "pTTvJeSTrpthgk9ASBVGsw"})
console.log('❤️', res.data.blood)
if (res.data.blood === 1) {
gameOver = true
console.log('能量剩余1,退出')
break
}
await this.wait(2000)
}
} catch (e) {
console.log('error', e)
gameOver = true
}
}
}
}
}
}
new Jd_speed_wabao().init().then()