mirror of
https://github.com/qitoqito/psyduck.git
synced 2026-01-12 21:20:43 +08:00
finshop
This commit is contained in:
parent
2825edc8a4
commit
4d074db313
140
parse/jd/jd_task_finshop.js
Normal file
140
parse/jd/jd_task_finshop.js
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
import {Template} from '../../template.js'
|
||||||
|
import jsdom from "jsdom";
|
||||||
|
|
||||||
|
export class Main extends Template {
|
||||||
|
constructor() {
|
||||||
|
super()
|
||||||
|
this.profile = {
|
||||||
|
title: '京东财富号签到',
|
||||||
|
headers: {
|
||||||
|
referer: 'https://finshop.jd.com/'
|
||||||
|
},
|
||||||
|
sync: 1,
|
||||||
|
prompt: {
|
||||||
|
appId: '活动id'
|
||||||
|
},
|
||||||
|
crontab: 4,
|
||||||
|
verify: 1,
|
||||||
|
tempExpire: 3600
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async prepare() {
|
||||||
|
await this.field('appId')
|
||||||
|
let ua = this.userAgents().jd
|
||||||
|
let resourceLoader = new jsdom.ResourceLoader({
|
||||||
|
userAgent: ua,
|
||||||
|
"referer": "https://finshop.jd.com/",
|
||||||
|
});
|
||||||
|
let virtualConsole = new jsdom.VirtualConsole();
|
||||||
|
this.jsConfig = {
|
||||||
|
"url": "https://finshop.jd.com/",
|
||||||
|
"referer": "https://finshop.jd.com/",
|
||||||
|
"userAgent": ua,
|
||||||
|
runScripts: "dangerously",
|
||||||
|
resources: resourceLoader,
|
||||||
|
includeNodeLocations: true,
|
||||||
|
storageQuota: 10000000,
|
||||||
|
pretendToBeVisual: true,
|
||||||
|
virtualConsole
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async batch(p) {
|
||||||
|
p = this.getTemp(p.pid) || p
|
||||||
|
if (!p.orgName) {
|
||||||
|
let device = {
|
||||||
|
appId: p.appId,
|
||||||
|
deviceInfo: `{"jsToken":"","fp":"${this.md5(new Date().getTime().toString())}","sdkToken":"jdd016DZNHFZEX6ISWPRAZUKJDKGFIRQJ5MRXPZHLTK3ZIVKLBTD4SEZNDR6S${this.rand(10, 99)}JO2TLV${this.rand(10, 99)}HB5MV6JW52RVAZNXKEXXHGYDCX5MIJ7NSC4DY01234567","eid":"FQ7Z2DTGYZSJM5FKY${this.rand(10, 99)}JLAURRHP2UZHK2ID7554EMNWWNNSK3JBCTLTR45IOP3Z5K3YJHOG${this.rand(10, 99)}SJAOB${this.rand(10, 99)}KVS3RH7G2U","appType":1}`,
|
||||||
|
"modelPreviewType": "1"
|
||||||
|
}
|
||||||
|
let getHome = await this.curl({
|
||||||
|
'url': `https://ms.jr.jd.com/gw/generic/uc/h5/m/getHomePageHeadInfo`,
|
||||||
|
form: `reqData=${this.dumps(device)}`,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
if (this.haskey(getHome, 'resultData.data.orgName')) {
|
||||||
|
p.nodeId = getHome.resultData.data.orgNodeId
|
||||||
|
p.orgName = getHome.resultData.data.orgName
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
p.expired = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return p
|
||||||
|
}
|
||||||
|
|
||||||
|
async main(p) {
|
||||||
|
let user = p.data.user;
|
||||||
|
let context = p.context;
|
||||||
|
console.log(`正在签到:`, context.orgName || context.appId)
|
||||||
|
let a = new jsdom.JSDOM(`<body><script src="//gia.jd.com/m.html"></script> <script src="//gias.jd.com/js/m.js"></body>`, this.jsConfig)
|
||||||
|
await this.wait(2000)
|
||||||
|
try {
|
||||||
|
var riskJd = a.window.getJdEid();
|
||||||
|
} catch (e) {
|
||||||
|
let riskJd = {
|
||||||
|
"jsToken": "",
|
||||||
|
"fp": this.md5(new Date().getTime().toString()),
|
||||||
|
"sdkToken": `jdd016DZNHFZEX6ISWPRAZUKJDKGFIRQJ5MRXPZHLTK3ZIVKLBTD4SEZNDR6S${this.rand(10, 99)}JO2TLV${this.rand(10, 99)}HB5MV6JW52RVAZNXKEXXHGYDCX5MIJ7NSC4DY01234567`,
|
||||||
|
"eid": `FQ7Z2DTGYZSJM5FKY${this.rand(10, 99)}JLAURRHP2UZHK2ID7554EMNWWNNSK3JBCTLTR45IOP3Z5K3YJHOG${this.rand(10, 99)}SJAOB${this.rand(10, 99)}KVS3RH7G2U`,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let data = await this.getTemp(context.appId)
|
||||||
|
if (!data) {
|
||||||
|
let device2 = {
|
||||||
|
appId: p.appId,
|
||||||
|
"nodeId": p.nodeId,
|
||||||
|
"origin": "jindian",
|
||||||
|
deviceInfo: `{"jsToken":"","fp":"${this.md5(new Date().getTime().toString())}","sdkToken":"jdd016DZNHFZEX6ISWPRAZUKJDKGFIRQJ5MRXPZHLTK3ZIVKLBTD4SEZNDR6S${this.rand(10, 99)}JO2TLV${this.rand(10, 99)}HB5MV6JW52RVAZNXKEXXHGYDCX5MIJ7NSC4DY01234567","eid":"FQ7Z2DTGYZSJM5FKY${this.rand(10, 99)}JLAURRHP2UZHK2ID7554EMNWWNNSK3JBCTLTR45IOP3Z5K3YJHOG${this.rand(10, 99)}SJAOB${this.rand(10, 99)}KVS3RH7G2U","appType":1}`,
|
||||||
|
"isLoadMore": false, "pageNum": 1, "pageSize": 10, "channel": "5", "modelPreviewType": "1"
|
||||||
|
}
|
||||||
|
let list = await this.curl({
|
||||||
|
'url': `https://ms.jr.jd.com/gw2/generic/finshop/h5/m/selectJdActivityReceiveList`,
|
||||||
|
form: `reqData=${this.dumps(device2)}`,
|
||||||
|
cookie: this.tester()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
if (this.haskey(list, 'resultData.data.jdReceivedList')) {
|
||||||
|
data = list.resultData.data.jdReceivedList[0]
|
||||||
|
await this.setTemp(context.appId, data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (data) {
|
||||||
|
let sign = await this.curl({
|
||||||
|
'url': `https://ms.jr.jd.com/gw2/generic/finshop/h5/m/jdActivityTake`,
|
||||||
|
'form': `reqData=${this.dumps({
|
||||||
|
"appId": context.appId,
|
||||||
|
"nodeId": context.nodeId,
|
||||||
|
"origin": "jindian",
|
||||||
|
deviceInfo: this.dumps(riskJd),
|
||||||
|
"companyUserId": data.companyUserId,
|
||||||
|
"activityId": data.activityId,
|
||||||
|
"modelPreviewType": "1"
|
||||||
|
})}`,
|
||||||
|
user,
|
||||||
|
algo: {
|
||||||
|
expire: {
|
||||||
|
resultCode: 3
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
if (this.haskey(sign, 'resultData.data.amount')) {
|
||||||
|
p.msg(`京豆: ${sign.resultData.data.amount}`)
|
||||||
|
p.info.work = true
|
||||||
|
}
|
||||||
|
else if (this.haskey(sign, 'success') && this.haskey(sign, 'resultData.code', -1)) {
|
||||||
|
p.info.work = true
|
||||||
|
p.log("已签到")
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
p.log(sign)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
p.err("没有获取到activityId")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -7,7 +7,8 @@ export class Main extends Template {
|
|||||||
title: '京东互动整合',
|
title: '京东互动整合',
|
||||||
crontab: 4,
|
crontab: 4,
|
||||||
sync: 1,
|
sync: 1,
|
||||||
verify: 1
|
verify: 1,
|
||||||
|
task:1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,79 +63,117 @@ export class Main extends Template {
|
|||||||
p.log("任务完成...")
|
p.log("任务完成...")
|
||||||
}
|
}
|
||||||
case 'ORDER_MARK':
|
case 'ORDER_MARK':
|
||||||
|
case 'SUBSCRIBE_WITH_RECEIVE':
|
||||||
break
|
break
|
||||||
case 'BROWSE_CHANNEL':
|
case 'BROWSE_CHANNEL':
|
||||||
case 'BROWSE_PRODUCT':
|
case 'BROWSE_PRODUCT':
|
||||||
case 'FOLLOW_SHOP':
|
case 'FOLLOW_SHOP':
|
||||||
let apTaskDetail = await this.curl({
|
if (i.taskSourceUrl) {
|
||||||
'url': `https://api.m.jd.com/api?functionId=apTaskDetail`,
|
var doTask = await this.curl({
|
||||||
'form': `functionId=apTaskDetail&body={"taskType":"${i.taskType}","taskId":${i.id},"channel":4,"checkVersion":true,"linkId":"${context.linkId}","pipeExt":${this.dumps(i.pipeExt)}}&t=1738480907628&appid=activities_platform&client=ios&clientVersion=15.0.11&`,
|
'url': `https://api.m.jd.com/api?functionId=apsDoTask`,
|
||||||
user
|
'form': `functionId=apsDoTask&body={"taskType":"${i.taskType}","taskId":${i.id},"channel":4,"checkVersion":true,"linkId":"${context.linkId}","pipeExt":${this.dumps(i.pipeExt)},"taskInsert":false,"itemId":"${encodeURIComponent(i.taskSourceUrl)}"}&t=1738480908001&appid=activities_platform&client=ios&clientVersion=15.0.11`,
|
||||||
|
algo: {'appId': '54ed7'},
|
||||||
|
user
|
||||||
|
}
|
||||||
|
)
|
||||||
|
if (this.haskey(doTask, 'success')) {
|
||||||
|
p.log("任务完成")
|
||||||
}
|
}
|
||||||
)
|
else {
|
||||||
let taskItemList = this.haskey(apTaskDetail, 'data.taskItemList')
|
p.log("任务失败:", this.haskey(doTask, 'errMsg') || doTask)
|
||||||
if (taskItemList) {
|
}
|
||||||
for (let j in Array.from(Array(i.taskLimitTimes - i.taskDoTimes), (_val, index) => index)) {
|
if (i.canDrawAwardNum) {
|
||||||
if (taskItemList[j] && taskItemList[j].itemId) {
|
let award = await this.curl({
|
||||||
if (i.timeLimitPeriod) {
|
'url': `https://api.m.jd.com/api?functionId=apTaskDrawAward`,
|
||||||
let start = await this.curl({
|
'form': `functionId=apTaskDrawAward&body={"taskType":"${i.taskType}","taskId":${i.id},"channel":4,"checkVersion":true,"linkId":"${context.linkId}"}&t=1739360342034&appid=activities_platform&client=ios&clientVersion=15.0.11`,
|
||||||
'url': `https://api.m.jd.com/api?functionId=apStartTaskTime`,
|
user,
|
||||||
'form': `functionId=apStartTaskTime&body={"taskType":"${i.taskType}","taskId":${i.id},"channel":4,"checkVersion":true,"linkId":"${context.linkId}","pipeExt":${this.dumps({
|
algo: {
|
||||||
...i.pipeExt, ...taskItemList[j].pipeExt
|
appId: 'f0f3f'
|
||||||
})},"taskInsert":false,"itemId":"${encodeURIComponent(taskItemList[j].itemId)}"}&t=1738483884373&appid=activity_platform_se&client=ios&clientVersion=15.0.11&platform=3&loginType=2&loginWQBiz=wegame`,
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
if (this.haskey(award, 'data')) {
|
||||||
|
p.log(`抽奖次数+1`)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
p.err("抽奖领取失败")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
let apTaskDetail = await this.curl({
|
||||||
|
'url': `https://api.m.jd.com/api?functionId=apTaskDetail`,
|
||||||
|
'form': `functionId=apTaskDetail&body={"taskType":"${i.taskType}","taskId":${i.id},"channel":4,"checkVersion":true,"linkId":"${context.linkId}","pipeExt":${this.dumps(i.pipeExt)}}&t=1738480907628&appid=activities_platform&client=ios&clientVersion=15.0.11&`,
|
||||||
|
user
|
||||||
|
}
|
||||||
|
)
|
||||||
|
let taskItemList = this.haskey(apTaskDetail, 'data.taskItemList')
|
||||||
|
if (taskItemList) {
|
||||||
|
for (let j in Array.from(Array(i.taskLimitTimes - i.taskDoTimes), (_val, index) => index)) {
|
||||||
|
if (taskItemList[j] && taskItemList[j].itemId) {
|
||||||
|
if (i.timeLimitPeriod) {
|
||||||
|
let start = await this.curl({
|
||||||
|
'url': `https://api.m.jd.com/api?functionId=apStartTaskTime`,
|
||||||
|
'form': `functionId=apStartTaskTime&body={"taskType":"${i.taskType}","taskId":${i.id},"channel":4,"checkVersion":true,"linkId":"${context.linkId}","pipeExt":${this.dumps({
|
||||||
|
...i.pipeExt, ...taskItemList[j].pipeExt
|
||||||
|
})},"taskInsert":false,"itemId":"${encodeURIComponent(taskItemList[j].itemId)}"}&t=1738483884373&appid=activity_platform_se&client=ios&clientVersion=15.0.11&platform=3&loginType=2&loginWQBiz=wegame`,
|
||||||
|
user,
|
||||||
|
algo: {
|
||||||
|
appId: 'acb1e'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
if (this.haskey(start, 'code', 1)) {
|
||||||
|
p.log("失败了")
|
||||||
|
break
|
||||||
|
}
|
||||||
|
p.log(`等待${i.timeLimitPeriod}秒...`)
|
||||||
|
await this.wait(i.timeLimitPeriod * 1000)
|
||||||
|
var doTask = await this.curl({
|
||||||
|
'url': `https://api.m.jd.com/api?functionId=apDoLimitTimeTask`,
|
||||||
|
'form': `functionId=apDoLimitTimeTask&body={"linkId":"${context.linkId}"}&t=1738483906048&appid=activities_platform&client=ios&clientVersion=15.0.11&platform=3&loginType=2&loginWQBiz=wegame`,
|
||||||
user,
|
user,
|
||||||
algo: {
|
algo: {
|
||||||
appId: 'acb1e'
|
appId: 'ebecc'
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
)
|
|
||||||
if (this.haskey(start, 'code', 1)) {
|
|
||||||
p.log("失败了")
|
|
||||||
break
|
|
||||||
}
|
|
||||||
p.log(`等待${i.timeLimitPeriod}秒...`)
|
|
||||||
await this.wait(i.timeLimitPeriod * 1000)
|
|
||||||
var doTask = await this.curl({
|
|
||||||
'url': `https://api.m.jd.com/api?functionId=apDoLimitTimeTask`,
|
|
||||||
'form': `functionId=apDoLimitTimeTask&body={"linkId":"${context.linkId}"}&t=1738483906048&appid=activities_platform&client=ios&clientVersion=15.0.11&platform=3&loginType=2&loginWQBiz=wegame`,
|
|
||||||
user,
|
|
||||||
algo: {
|
|
||||||
appId: 'ebecc'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
var doTask = await this.curl({
|
|
||||||
'url': `https://api.m.jd.com/api?functionId=apsDoTask`,
|
|
||||||
'form': `functionId=apsDoTask&body={"taskType":"${i.taskType}","taskId":${i.id},"channel":4,"checkVersion":true,"linkId":"${context.linkId}","pipeExt":${this.dumps({
|
|
||||||
...i.pipeExt, ...taskItemList[j].pipeExt
|
|
||||||
})},"taskInsert":false,"itemId":"${encodeURIComponent(taskItemList[j].itemId)}"}&t=1738480908001&appid=activities_platform&client=ios&clientVersion=15.0.11`,
|
|
||||||
algo: {'appId': '54ed7'},
|
|
||||||
user
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
if (this.haskey(doTask, 'success')) {
|
|
||||||
p.log("任务完成", `[${parseInt(j) + 1}/${i.taskLimitTimes - i.taskDoTimes}]`)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
p.log("任务失败:", this.haskey(doTask, 'errMsg') || doTask)
|
|
||||||
}
|
|
||||||
if (i.canDrawAwardNum) {
|
|
||||||
let award = await this.curl({
|
|
||||||
'url': `https://api.m.jd.com/api?functionId=apTaskDrawAward`,
|
|
||||||
'form': `functionId=apTaskDrawAward&body={"taskType":"${i.taskType}","taskId":${i.id},"channel":4,"checkVersion":true,"linkId":"${context.linkId}"}&t=1739360342034&appid=activities_platform&client=ios&clientVersion=15.0.11`,
|
|
||||||
user
|
|
||||||
}
|
|
||||||
)
|
|
||||||
if (this.haskey(award, 'data')) {
|
|
||||||
p.log(`抽奖次数+1`)
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
p.err("抽奖领取失败")
|
var doTask = await this.curl({
|
||||||
|
'url': `https://api.m.jd.com/api?functionId=apsDoTask`,
|
||||||
|
'form': `functionId=apsDoTask&body={"taskType":"${i.taskType}","taskId":${i.id},"channel":4,"checkVersion":true,"linkId":"${context.linkId}","pipeExt":${this.dumps({
|
||||||
|
...i.pipeExt, ...taskItemList[j].pipeExt
|
||||||
|
})},"taskInsert":false,"itemId":"${encodeURIComponent(taskItemList[j].itemId)}"}&t=1738480908001&appid=activities_platform&client=ios&clientVersion=15.0.11`,
|
||||||
|
algo: {'appId': '54ed7'},
|
||||||
|
user
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
if (this.haskey(doTask, 'success')) {
|
||||||
|
p.log("任务完成", `[${parseInt(j) + 1}/${i.taskLimitTimes - i.taskDoTimes}]`)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
p.log("任务失败:", this.haskey(doTask, 'errMsg') || doTask)
|
||||||
|
}
|
||||||
|
if (i.canDrawAwardNum) {
|
||||||
|
let award = await this.curl({
|
||||||
|
'url': `https://api.m.jd.com/api?functionId=apTaskDrawAward`,
|
||||||
|
'form': `functionId=apTaskDrawAward&body={"taskType":"${i.taskType}","taskId":${i.id},"channel":4,"checkVersion":true,"linkId":"${context.linkId}"}&t=1739360342034&appid=activities_platform&client=ios&clientVersion=15.0.11`,
|
||||||
|
user,
|
||||||
|
algo: {
|
||||||
|
appId: 'f0f3f'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
if (this.haskey(award, 'data')) {
|
||||||
|
p.log(`抽奖次数+1`)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
p.err("抽奖领取失败")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await this.wait(3000)
|
||||||
}
|
}
|
||||||
await this.wait(3000)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -157,7 +196,10 @@ export class Main extends Template {
|
|||||||
let award = await this.curl({
|
let award = await this.curl({
|
||||||
'url': `https://api.m.jd.com/api?functionId=apTaskDrawAward`,
|
'url': `https://api.m.jd.com/api?functionId=apTaskDrawAward`,
|
||||||
'form': `functionId=apTaskDrawAward&body={"taskType":"${i.taskType}","taskId":${i.id},"channel":4,"checkVersion":true,"linkId":"${context.linkId}"}&t=1739360342034&appid=activities_platform&client=ios&clientVersion=15.0.11`,
|
'form': `functionId=apTaskDrawAward&body={"taskType":"${i.taskType}","taskId":${i.id},"channel":4,"checkVersion":true,"linkId":"${context.linkId}"}&t=1739360342034&appid=activities_platform&client=ios&clientVersion=15.0.11`,
|
||||||
user
|
user,
|
||||||
|
algo: {
|
||||||
|
appId: 'f0f3f'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
if (this.haskey(award, 'data')) {
|
if (this.haskey(award, 'data')) {
|
||||||
@ -173,6 +215,7 @@ export class Main extends Template {
|
|||||||
switch (i.taskType) {
|
switch (i.taskType) {
|
||||||
case'ORDER_MARK':
|
case'ORDER_MARK':
|
||||||
case 'SHARE_INVITE':
|
case 'SHARE_INVITE':
|
||||||
|
case 'SUBSCRIBE_WITH_RECEIVE':
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
isOk = 0
|
isOk = 0
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user