-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathjd_88hb.ts
136 lines (136 loc) · 5.45 KB
/
jd_88hb.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
// /**
// * 京喜->领88元红包
// * CK1 HW.ts -> 内部
// * CK2-n 内部 -> HW.ts
// * cron: 5 0,6,16 * * *
// */
//
// import axios from "axios"
// import {requestAlgo, geth5st} from "./utils/V3";
// import {requireConfig, wait, getshareCodeHW, randomString, randomWord, o2s} from "./TS_USER_AGENTS"
//
// const token = require('./utils/jd_jxmc.js').token
//
// let cookie: string = '', res: any = '', UserName: string, UA: string = ''
// let shareCodesSelf: string[] = [], shareCodes: string[] = [], shareCodesHW: string[] = [], jxToken: any, data: any
//
// !(async () => {
// let cookiesArr: any = 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`)
// jxToken = await token(cookie)
// await requestAlgo('e395f')
// res = await api('GetUserInfo', 'activeId', {activeId: '529439'})
// o2s(res)
// await wait(2000)
//
// let strUserPin: string = res.Data.strUserPin, dwHelpedTimes: number = res.Data.dwHelpedTimes
// console.log('收到助力:', dwHelpedTimes)
// console.log('助力码:', strUserPin)
// shareCodesSelf.push(strUserPin)
//
// res = await api('JoinActive', 'phoneid,stepreward_jstoken,strPin,timestamp', {phoneid: jxToken.phoneid, stepreward_jstoken: jxToken.farm_jstoken, strPin: '', timestamp: jxToken.timestamp})
// res.iRet === 0 ? console.log('JoinActive: 成功') : console.log('JoinActive:', res.sErrMsg)
// await wait(2000)
// }
//
// console.log('内部助力码:', shareCodesSelf)
//
// for (let [index, value] of cookiesArr.entries()) {
// await requestAlgo('e395f')
// cookie = value
// jxToken = await token(cookie)
// UserName = decodeURIComponent(cookie.match(/pt_pin=([^;]*)/)![1])
// res = await api('GetUserInfo', 'activeId', {activeId: '529439'})
// await wait(1000)
// let strUserPin: string = res.Data.strUserPin
//
// if (shareCodesHW.length === 0) {
// shareCodesHW = await getshareCodeHW('88hb')
// }
// if (index === 0) {
// shareCodes = Array.from(new Set([...shareCodesHW, ...shareCodesSelf]))
// } else {
// shareCodes = Array.from(new Set([...shareCodesSelf, ...shareCodesHW]))
// }
// for (let code of shareCodes) {
// if (code !== strUserPin) {
// console.log(`账号 ${UserName} 去助力 ${code}`)
// res = await api('EnrollFriend', 'phoneid,stepreward_jstoken,strPin,timestamp', {
// phoneid: jxToken.phoneid,
// stepreward_jstoken: jxToken.farm_jstoken,
// strPin: code,
// timestamp: jxToken.timestamp
// })
// if (res.iRet === 0) {
// console.log('成功')
// } else if (res.iRet === 2015) {
// console.log('上限')
// break
// } else if (res.iRet === 2016) {
// console.log('火爆')
// break
// } else {
// console.log('其他错误:', res)
// }
// await wait(5000)
// }
// }
// }
//
// // 拆红包
// for (let [index, value] of cookiesArr.entries()) {
// await requestAlgo('e395f')
// cookie = value
// UserName = decodeURIComponent(cookie.match(/pt_pin=([^;]*)/)![1])
// jxToken = await token(cookie)
// console.log(`\n开始【京东账号${index + 1}】${UserName} 拆红包\n`)
//
// res = await api('GetUserInfo', 'activeId', {activeId: '529439'})
// let dwHelpedTimes: number = res.Data.dwHelpedTimes
// await wait(2000)
//
// for (let t of res.Data.gradeConfig) {
// if (dwHelpedTimes >= t.dwHelpTimes && t.dwIsHasDraw === 1) {
// res = await api('DoGradeDraw', 'grade', {grade: t.dwGrade})
// if (res.iRet === 0)
// console.log(`等级${t.dwGrade}红包打开成功`)
// else {
// console.log('其他错误', res.sErrMsg ?? JSON.stringify(res))
// break
// }
// await wait(15000)
// } else {
// console.log(`等级${t.dwGrade}红包已打开`)
// }
// }
// }
// })()
//
// async function api(fn: string, stk: string, params?: object) {
// let timestamp: number = Date.now()
// let url: string = `https://m.jingxi.com/cubeactive/steprewardv3/${fn}?activeId=529439&_stk=${stk}&_ste=1&userDraw=0&publishFlag=1&channel=7&_t=${timestamp}&_=${timestamp}&sceneval=2&g_login_type=1&callback=jsonpCBK${randomWord()}&g_ty=ls`
// UA = `jdpingou;iPhone;4.13.0;14.4.2;${randomString(40)};network/wifi;model/iPhone10,2;appBuild/100609;supportApplePay/1;hasUPPay/0;pushNoticeIsOpen/1;hasOCPay/0;supportBestPay/0;session/${Math.random() * 98 + 1};pap/JA2019_3111789;brand/apple;supportJDSHWK/1;Mozilla/5.0 (iPhone; CPU iPhone OS 14_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148`
// let t: { key: string, value: string } [] = []
// for (let [key, value] of Object.entries(params)) {
// t.push({key, value})
// url += `&${key}=${value}`
// }
// let h5st = geth5st(t, 'e395f')
// url += `&h5st=${encodeURIComponent(h5st)}`
// try {
// let {data}: any = await axios.get(url, {
// headers: {
// 'Host': 'm.jingxi.com',
// 'User-Agent': UA,
// 'Referer': 'https://st.jingxi.com/sns/202106/29/signinhb_new/index.html',
// 'Cookie': cookie
// }
// })
// return JSON.parse(data.match(/jsonpCBK.?\((.*)/)![1])
// } catch (e: any) {
// return {}
// }
// }