Update jd_task_newUnique.js

This commit is contained in:
可达鸭 2025-06-24 14:49:27 +08:00
parent 2c2cb2fb39
commit 8db5f87549

View File

@ -11,45 +11,72 @@ export class Main extends Template {
},
help: 'main',
verify: true,
readme: '如果出现无数据,可能当前主号是黑号,无法获取到数据,请自行设置help为白号pin'
sync: 1,
tempKey: 8640000000,
turn: 2
}
}
async middle() {
if (this._shareCode.length) {
this.tempContext = this.compact(this._shareCode[0], ['roundId', 'startTime',
'endTime', 'title'])
}
if (this.turnCount == 1) {
if (this.tempContext) {
this.tempContext.task = this.profile.help
this.shareCode(this.tempContext)
}
else {
this.jump = true
}
}
}
async prepare() {
for (let user of this.help.slice(0, 3)) {
let html = await this.curl({
'url': `https://pro.m.jd.com/mall/active/4Va8jNzzHPqgTUhxwiTn9PHyVZCB/index.html?utm_medium=tuiguang&tttparams=zZ1qguleyJnTGF0IjozOS45NjEwNTQsInVuX2FyZWEiOiIxXzI4MDBfNTU4MzhfMCIsImRMYXQiOiIiLCJwcnN0YXRlIjoiMCIsImFkZHJlc3NJZCI6IjUzODg3NDg3NyIsImxhdCI6IiIsInBvc0xhdCI6MzkuOTYxMDU0LCJwb3NMbmciOjExNi4zMjIwNjEsImdwc19hcmVhIjoiMF8wXzBfMCIsImxuZyI6IiIsInVlbXBzIjoiMC0wLTAiLCJnTG5nIjoxMTYuMzIyMDYxLCJtb2RlbCI6ImlQaG9uZTEzLDMiLCJkTG5nIjoiIn70=&utm_source=kong&cu=true`,
user
}
)
let data = []
for (let content of this.matchAll(/<script>([^\<]+)<\/script>/g, html)) {
if (content && content.includes('__react_data__')) {
var window = {}
eval(content)
for (let i of this.haskey(window, '__react_data__.activityData.floorList')) {
if (i.template == "SsrCodeTemplate") {
data = i
}
}
}
}
if (this.haskey(data, 'providerData.data.result')) {
let result = data.providerData.data.result
if (this.haskey(result, 'roundConfig.roundId')) {
this.code = result.skuList
let startTime = new Date(result.roundConfig.roundStartTime).getTime() / 1000;
let endTime = new Date(result.roundConfig.roundEndTime).getTime() / 1000;
this.shareCode({
"roundId": result.roundConfig.roundId,
startTime,
endTime,
title: result.roundConfig.currAwardReserve.title
})
}
break
for (let user of this.help) {
let itemId = await this.getTemp(user)
if (itemId) {
this.inviter.push({
user,
itemId
})
}
}
// for (let user of this.help.slice(0, 3)) {
// let html = await this.curl({
// 'url': `https://pro.m.jd.com/mall/active/4Va8jNzzHPqgTUhxwiTn9PHyVZCB/index.html?utm_medium=tuiguang&tttparams=zZ1qguleyJnTGF0IjozOS45NjEwNTQsInVuX2FyZWEiOiIxXzI4MDBfNTU4MzhfMCIsImRMYXQiOiIiLCJwcnN0YXRlIjoiMCIsImFkZHJlc3NJZCI6IjUzODg3NDg3NyIsImxhdCI6IiIsInBvc0xhdCI6MzkuOTYxMDU0LCJwb3NMbmciOjExNi4zMjIwNjEsImdwc19hcmVhIjoiMF8wXzBfMCIsImxuZyI6IiIsInVlbXBzIjoiMC0wLTAiLCJnTG5nIjoxMTYuMzIyMDYxLCJtb2RlbCI6ImlQaG9uZTEzLDMiLCJkTG5nIjoiIn70=&utm_source=kong&cu=true`,
// user
// }
// )
// let data = []
// for (let content of this.matchAll(/<script>([^\<]+)<\/script>/g, html)) {
// if (content && content.includes('__react_data__')) {
// var window = {}
// eval(content)
// for (let i of this.haskey(window, '__react_data__.activityData.floorList')) {
// if (i.template == "SsrCodeTemplate") {
// data = i
// }
// }
// }
// }
// if (this.haskey(data, 'providerData.data.result')) {
// let result = data.providerData.data.result
// if (this.haskey(result, 'roundConfig.roundId')) {
// this.code = result.skuList
// let startTime = new Date(result.roundConfig.roundStartTime).getTime() / 1000;
// let endTime = new Date(result.roundConfig.roundEndTime).getTime() / 1000;
// this.shareCode({
// "roundId": result.roundConfig.roundId,
// startTime,
// endTime,
// title: result.roundConfig.currAwardReserve.title
// })
// }
// break
// }
// }
}
async main(p) {
@ -60,8 +87,27 @@ export class Main extends Template {
user
}
)
let data = []
for (let content of this.matchAll(/<script>([^\<]+)<\/script>/g, html)) {
if (content && content.includes('__react_data__')) {
var window = {}
eval(content)
for (let i of this.haskey(window, '__react_data__.activityData.floorList')) {
if (i.template == "SsrCodeTemplate") {
data = i
}
}
}
}
let code = []
if (this.haskey(data, 'providerData.data.result')) {
let result = data.providerData.data.result
if (this.haskey(result, 'roundConfig.roundId')) {
code = result.skuList
}
}
let list = await this.curl({
'form': `functionId=newunique_task_panel&appid=signed_wh5&body={"channelId":"3","roundId":"NUE_9c438cbe"}&client=android&clientVersion=13.2.9`,
'form': `functionId=newunique_task_panel&appid=signed_wh5&body={"channelId":"3","roundId":"${context.roundId}"}&client=android&clientVersion=13.2.9`,
user,
algo: {
appId: 'ba62b'
@ -70,7 +116,7 @@ export class Main extends Template {
)
if (this.haskey(list, "data.bizCode", -1001)) {
p.log("活动太火爆")
p.info.work = true
p.info.complete = true
return
}
let status = 1
@ -88,13 +134,39 @@ export class Main extends Template {
status = 1
}
else if (extraType == 'assistTaskDetail') {
if (this.help.includes(user)) {
await this.setTemp(user, extra.itemId)
}
if (this.inviter) {
let cc = this.inviter[this.n % this.inviter.length]
this.n++
if (cc.user == user) {
cc = this.inviter[this.n % this.inviter.length]
}
p.log("正在助力:", cc.user)
let doIt = await this.curl({
'form': `functionId=newunique_do_task&appid=signed_wh5&body={"channelId":"3","roundId":"${context.roundId}","itemId":"${cc.itemId}","assignmentId":"${i.encryptAssignmentId}","tType":"1"}&eu=8366530373630343&fv=2346134393666303&client=ios&clientVersion=13.2.9`,
user,
algo: {
appId: 'ba62b'
}
}
)
if (this.haskey(doIt, 'data.result.score')) {
status = 1
p.log("助力成功:", doIt.data.result.score)
}
else {
p.log(this.haskey(doIt, 'data.bizMsg') || doIt)
}
}
status = 1
}
else if (['shoppingActivity', 'productsInfo', 'browseShop', 'addCart', 'followShop', 'followChannel'].includes(extraType)) {
p.log("正在运行:", i.assignmentName)
for (let j of extra) {
let doIt = await this.curl({
'form': `functionId=newunique_do_task&appid=signed_wh5&body={"channelId":"3","roundId":"NUE_9c438cbe","itemId":"${j.itemId}","assignmentId":"${i.encryptAssignmentId}","actionType":1,"jumpUrl":"${encodeURIComponent(j.url)}"}&eu=8366530373630343&fv=2346134393666303&client=ios&clientVersion=13.2.9`,
'form': `functionId=newunique_do_task&appid=signed_wh5&body={"channelId":"3","roundId":"${context.roundId}","itemId":"${j.itemId}","assignmentId":"${i.encryptAssignmentId}","actionType":1,"jumpUrl":"${encodeURIComponent(j.url)}"}&eu=8366530373630343&fv=2346134393666303&client=ios&clientVersion=13.2.9`,
user,
algo: {
appId: 'ba62b'
@ -112,7 +184,7 @@ export class Main extends Template {
}
else {
let reward = await this.curl({
'form': `functionId=newunique_do_task&appid=signed_wh5&body={"channelId":"3","roundId":"NUE_9c438cbe","itemId":"${j.itemId}","assignmentId":"${i.encryptAssignmentId}","actionType":0,"jumpUrl":"${encodeURIComponent(j.url)}"}&eu=8366530373630343&fv=2346134393666303&client=ios&clientVersion=13.2.9`,
'form': `functionId=newunique_do_task&appid=signed_wh5&body={"channelId":"3","roundId":"${context.roundId}","itemId":"${j.itemId}","assignmentId":"${i.encryptAssignmentId}","actionType":0,"jumpUrl":"${encodeURIComponent(j.url)}"}&eu=8366530373630343&fv=2346134393666303&client=ios&clientVersion=13.2.9`,
user,
algo: {
appId: 'ba62b'
@ -140,9 +212,19 @@ export class Main extends Template {
}
}
}
if (this.code) {
let code = this.random(this.code, 2)
if (code) {
let ary = []
for (let i of code) {
if (i.voteInfo.status) {
ary.push(i)
}
}
if (ary.length<2) {
let ranCode = this.random(code, 2 - ary.length)
ary = [...ary, ...ranCode]
}
for (let _ of this.range(0, 1)) {
let i = code[_]
p.log("正在投票:", i.name)
let pop = await this.curl({
'form': `functionId=newunique_popup&appid=signed_wh5&body={"channelId":"3","skuId":"${i.skuId}","roundId":"${context.roundId}"}&client=ios&clientVersion=15.0.80`,
@ -153,8 +235,10 @@ export class Main extends Template {
}
)
let count = this.haskey(pop, 'data.result.myVotes')
let len = Math.min(count, 10)
for (let _ of this.range(0, len)) {
if (_ == 0) {
count = parseInt(count / 2)
}
for (let _ of this.range(1, count)) {
let vote = await this.curl({
'form': `functionId=newunique_vote&appid=signed_wh5&body={"channelId":"3","roundId":"${context.roundId}","skuId":"${i.skuId}"}&client=ios&clientVersion=15.1.53`,
user,