代码拉取完成,页面将自动刷新
/**
* 京东-汽车-签到
* cron: 15 1 * * *
*/
import axios from 'axios'
import {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 api()
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 api() {
let {data} = await axios.post('https://api.m.jd.com/client.action', 'functionId=signBeanIndex&appid=ld', {
headers: {
"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
}
})
return data
}
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
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。