mirror of
https://github.com/qitoqito/psyduck.git
synced 2026-01-12 21:02:12 +08:00
73 lines
2.3 KiB
JavaScript
73 lines
2.3 KiB
JavaScript
import {Template} from '../../template.js'
|
|
|
|
export class Main extends Template {
|
|
constructor() {
|
|
super()
|
|
this.profile = {
|
|
title: "京东天天领豆",
|
|
crontab: 4,
|
|
sync: 1,
|
|
prompt: {
|
|
activityId: '活动id1|id2'
|
|
},
|
|
delay: 800,
|
|
interval: 2000,
|
|
verify: 1,
|
|
headers: {
|
|
referer: 'https://pro.m.jd.com/mall/active/3Q5H8xmBy4GyPT8xUgqwYYnAa2ns/index.html'
|
|
}
|
|
}
|
|
}
|
|
|
|
async prepare() {
|
|
await this.field('activityId')
|
|
}
|
|
|
|
async main(p) {
|
|
let user = p.data.user
|
|
let context = p.context
|
|
let algo = context.algo || {}
|
|
let sign = await this.curl({
|
|
'url': `https://api.m.jd.com/api`,
|
|
'form': `functionId=bean_deliverySign_sign&appid=signed_wh5_ihub&body={"activityId":"${context.activityId}"}&rfs=0000&client=apple&uuid=&build=169743&clientVersion=15.0.25&d_model=&osVersion=15.1.53`,
|
|
user,
|
|
algo: {
|
|
...{
|
|
expire: {
|
|
'data.bizCode': -102
|
|
},
|
|
appId: '987dd'
|
|
}, ...algo
|
|
}
|
|
}
|
|
)
|
|
let bizCode = this.haskey(sign, 'data.bizCode')
|
|
if (this.haskey(sign, 'data.result.value')) {
|
|
p.info.work = true
|
|
// p.msg(`京豆: ${sign.data.result.value}`)
|
|
p.award(sign.data.result.value, 'bean')
|
|
}
|
|
else if (bizCode == -2002) {
|
|
p.info.work = true
|
|
p.log("您已经签到过了")
|
|
}
|
|
else {
|
|
p.log(sign)
|
|
}
|
|
if (context.award) {
|
|
let s = await this.curl({
|
|
'form': `functionId=bean_deliverySign_continue_award&appid=signed_wh5_ihub&body={"activityId":"${context.activityId}"}&rfs=0000&client=apple&uuid=&build=169743&clientVersion=15.1.53&d_model=&osVersion=15.1.1`,
|
|
algo: {
|
|
appId: '0cc57'
|
|
},
|
|
user
|
|
}
|
|
)
|
|
if (this.haskey(s, 'data.result.value')) {
|
|
p.award(s.data.result.value, 'bean')
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|