mirror of
https://github.com/qitoqito/psyduck.git
synced 2026-01-12 04:30:42 +08:00
Create jd_task_yaoyiyao.js
This commit is contained in:
parent
e584d42d34
commit
655c3eda91
50
parse/jd/jd_task_yaoyiyao.js
Normal file
50
parse/jd/jd_task_yaoyiyao.js
Normal file
@ -0,0 +1,50 @@
|
||||
import {Template} from '../../template.js'
|
||||
|
||||
export class Main extends Template {
|
||||
constructor() {
|
||||
super()
|
||||
this.profile = {
|
||||
title: '京东摇一摇',
|
||||
prompt: {
|
||||
linkId: '活动linkId'
|
||||
},
|
||||
sync: 1,
|
||||
verify: 1
|
||||
}
|
||||
}
|
||||
|
||||
async prepare() {
|
||||
await this.field('linkId')
|
||||
}
|
||||
|
||||
async main(p) {
|
||||
let user = p.data.user;
|
||||
let context = p.context;
|
||||
for (let i = 0; i<20; i++) {
|
||||
let s = await this.curl({
|
||||
'url': `https://api.m.jd.com/?functionId=superRedBagDraw&body={"linkId":"${context.linkId}"}&appid=activities_platform`,
|
||||
user,
|
||||
algo: {
|
||||
'appId': '6e8d7',
|
||||
expire: {
|
||||
'data.isLogin': false
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
if (this.haskey(s, 'data.prizeDrawVo')) {
|
||||
p.log(`抽奖获得: ${s.data.prizeDrawVo.prizeDesc} ${s.data.prizeDrawVo.amount}`)
|
||||
}
|
||||
else {
|
||||
if (this.haskey(s, 'code', 20005)) {
|
||||
p.context.jump = true
|
||||
this.log("场次已过期");
|
||||
return
|
||||
}
|
||||
p.log('什么也没有')
|
||||
}
|
||||
await this.wait(1000)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user