forked from Toulu-debug/enen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jd_car.ts
53 lines (47 loc) · 1.71 KB
/
jd_car.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
/**
* 京东-汽车-签到
* cron: 15 1 * * *
*/
import {post, requireConfig, wait} from './TS_USER_AGENTS'
let cookie: string = '', res: any = '', UserName: string
!(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`)
try {
res = await post('https://api.m.jd.com/client.action', 'functionId=signBeanIndex&appid=ld', {
"Content-Type": "application/x-www-form-urlencoded",
'Host': 'api.m.jd.com',
'Origin': 'https://api.m.jd.com',
'Referer': 'https://api.m.jd.com',
'Cookie': cookie
})
console.log(res.data?.dailyAward?.title || res.data?.continuityAward?.title)
console.log('获得京豆', res.data?.dailyAward?.beanAward?.beanCount * 1 || res.data?.continuityAward?.beanAward?.beanCount * 1)
await wait(2000)
// res = await cgame()
// console.log('获得京豆', res.data.beanNum)
} catch (e) {
console.log(e)
}
}
})()
/*async function cgame() {
let {data} = await axios.post('https://cgame-stadium.jd.com/api/v1/sign', '', {
headers: {
'Connection': 'keep-alive',
'Accept-Encoding': 'gzip, deflate, br',
'Content-Type': 'application/json',
'Origin': 'https://pro.m.jd.com',
'ActivityId': '7c51826be9f241c1ad9733df34d242c5',
'Host': 'cgame-stadium.jd.com',
'Referer': 'https://pro.m.jd.com/mall/active/dj6us2JJRLMMBb4iDaSK4wxvBMt/index.html',
'Accept-Language': 'zh-cn',
'Accept': 'application/json',
'Cookie': cookie
}
})
return data
}*/