From ff187da5a64bc64cacbe5a714e39c73c9a38b7ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=AF=E8=BE=BE=E9=B8=AD?= Date: Tue, 3 Jun 2025 14:40:16 +0800 Subject: [PATCH] Update jd_task_superMarket.js --- parse/jd/jd_task_superMarket.js | 342 +++++++++++++++++--------------- 1 file changed, 178 insertions(+), 164 deletions(-) diff --git a/parse/jd/jd_task_superMarket.js b/parse/jd/jd_task_superMarket.js index 5d85864..0f60118 100644 --- a/parse/jd/jd_task_superMarket.js +++ b/parse/jd/jd_task_superMarket.js @@ -20,192 +20,206 @@ export class Main extends Template { this.dict[user] = itemId } } + this.algo.bill = function() { + } } async main(p) { let user = p.data.user; let context = p.context; - if (this.turnCount == 0) { - var html = await this.curl({ - 'url': `https://pro.m.jd.com/mall/active/${context.id}/index.html?stath=20&navh=44&babelChannel=ttt1&tttparams=zZ1qguleyJnTGF0IjozOS45NjEwNTQsInVuX2FyZWEiOiIxXzI4MDBfNTU4MzhfMCIsImRMYXQiOiIiLCJwcnN0YXRlIjoiMCIsImFkZHJlc3NJZCI6IjUzODg3NDg3NyIsImxhdCI6IiIsInBvc0xhdCI6MzkuOTYxMDU0LCJwb3NMbmciOjExNi4zMjIwNjEsImdwc19hcmVhIjoiMF8wXzBfMCIsImxuZyI6IiIsInVlbXBzIjoiMC0wLTAiLCJnTG5nIjoxMTYuMzIyMDYxLCJtb2RlbCI6ImlQaG9uZTEzLDMiLCJkTG5nIjoiIn70=`, - user, - referer: 'https://pro.m.jd.com/mall/active/3nh7HzSjYemGqAHSbktTrf8rrH8M/index.html' + let status = 0 + let isOk + await this.curl({ + 'url': `https://api.m.jd.com/atop_channel_newcomer_interactive_info`, + 'form': `appid=jd-super-market&t=1748874023489&functionId=atop_channel_newcomer_interactive_info&client=m&body={"babelChannel":"ttt32","isJdApp":"1","isWx":"0"}`, + user, + algo: { + appId: '35fa0', + refresh: true } - ) - let react = this.jsonParse(this.match([/__react_data__\s*=\s*(.*?)\s*;\n+/,], html)) - let signToken = this.match(/"signToken"\s*:\s*"(\w+)"/, html) - let status = 0 - let isOk - if (signToken) { - let sign = await this.curl({ - 'url': `https://api.m.jd.com/atop_channel_sign_in`, - 'form': `appid=jd-super-market&t=1713230766545&functionId=atop_channel_sign_in&client=m&uuid=de21c6604748f97dd3977153e51a47f4efdb9a47&body={"signToken":"${signToken}","channelFollowStatus":1,"bizCode":"cn_retail_jdsupermarket","scenario":"sign","babelChannel":"ttt1","isJdApp":"1","isWx":"0"}`, - user, - algo: { - appId: 'b8fc7', - expire: { - "code": "11001" + } + ) + let info = await this.curl({ + 'url': `https://api.m.jd.com/atop_channel_interactive_info`, + 'form': `appid=jd-super-market&t=1748855058331&functionId=atop_channel_interactive_info&client=m&body={"bizCode":"cn_retail_jdsupermarket","scenario":"sign","babelChannel":"ttt32","isJdApp":"1","isWx":"0"}`, + user, + algo: { + appId: '33c74' + } + } + ) + let items = this.haskey(info, 'data.floorData.items') + if (!items) { + p.err("没有获取到数据") + } + for (let i of items) { + status = 0 + if (i.completionFlag) { + status = 1 + p.log(`任务已经完成: ${i.assignmentName}`) + if (i.assignmentName.includes('邀请')) { + isOk = 1 + } + } + else { + p.log(`正在运行: ${i.assignmentName}`) + let extraType = i.ext.extraType + if (i.assignmentName.includes('邀请')) { + status = 1 + isOk = 0 + if (this.haskey(i, 'ext.assistTaskDetail.itemId')) { + await this.setTemp(user, i.ext.assistTaskDetail.itemId, 86400000) + } + let users = Object.keys(this.dict) + if (users) { + let itemId = '' + let u = users[this.n % users.length] + this.n++ + if (u == user) { + u = users[this.n % users.length] + } + itemId = this.dict[u] + let help = await this.curl({ + 'form': `appid=jd-super-market&t=1742122986378&functionId=atop_channel_complete_task&client=m&body={"bizCode":"cn_retail_jdsupermarket","scenario":"sign","assignmentType":"${i.assignmentType}","encryptAssignmentId":"${i.encryptAssignmentId}","itemId":"${itemId}","assistFlag":true,"babelChannel":"ttt1","isJdApp":"0","isWx":"1"}`, + user, + algo: { + appId: '51113' + } } + ) + let subCode = this.haskey(help, 'data.subCode') + if (subCode == '104') { + p.log("您已经助力过了") + isOk = 1 + } + else if (subCode == '0') { + p.log("助力成功") + isOk = 1 + } + if (subCode == '109') { + p.log("不能自己给自己助力") } } - ) - if (this.haskey(sign, 'success')) { - status = 1 - p.log(`签到成功`) - for (let i of sign.data.rewards) { - p.log(`获得: ${i.rewardDesc}`) + else { + isOk = 1 } } - else if (this.haskey(sign, "code", "14013")) { - p.log(`您今天已经签过到了`) - status = 1 + else if (this.haskey(i, `ext.${i.ext.extraType}`)) { + let extra = i.ext[extraType] + try { + for (let j of extra.slice(0, i.assignmentTimesLimit)) { + if (['shoppingActivity', 'productsInfo', 'browseShop'].includes(extraType)) { + let d = await this.curl({ + 'form': `appid=jd-super-market&body=${this.dumps( + { + "bizCode": "cn_retail_jdsupermarket", + "scenario": "sign", + "assignmentType": i.assignmentType, + "encryptAssignmentId": i.encryptAssignmentId, + "itemId": j.itemId || j.advId, + "actionType": 1, + "babelChannel": "ttt1", + "isJdApp": "0", + "isWx": "1" + } + )}&sign=11&t=1653132222710&client=m&functionId=atop_channel_complete_task`, + user, + algo: { + appId: '51113', + } + } + ) + let msg = this.haskey(d, ['data.msg', 'message']) || "'" + p.log(msg) + if (msg.includes('火爆')) { + return + } + await this.wait((i.ext.waitDuration || 0) * 1000 + 500) + } + let s = await this.curl({ + 'form': `appid=jd-super-market&body=${this.dumps( + { + "bizCode": "cn_retail_jdsupermarket", + "scenario": "sign", + "assignmentType": i.assignmentType, + "encryptAssignmentId": i.encryptAssignmentId, + "itemId": j.itemId || j.advId, + "babelChannel": "ttt1", + "isJdApp": "0", + "isWx": "0" + } + )}&sign=11&t=1653132222710&client=m&functionId=atop_channel_complete_task`, + user, algo: { + appId: '51113', + }, + } + ) + let message = this.haskey(s, ['data.msg', 'message']) || "" + p.log(i.assignmentName, this.haskey(s, 'data.msg') || this.haskey(s, 'message')) + if (this.haskey(s, 'message', '风险等级未通过')) { + return + } + if (message.includes("火爆")) { + break + } + if (this.haskey(s, 'data.doTaskRewardsInfo.successRewards')) { + for (let kkk in s.data.doTaskRewardsInfo.successRewards) { + for (let kkkk of s.data.doTaskRewardsInfo.successRewards[kkk]) { + p.log(`获得:`, kkkk.quantity, kkkk.rewardName) + } + } + status = 1 + } + await this.wait(1000) + } + } catch (e) { + p.log(e) + } } else { - p.log(this.haskey(sign, 'message') || sign) } } - var data = {} - if (this.haskey(react, 'activityData.floorList')) { - data = react.activityData + } + let calendar = await this.curl({ + 'url': `https://api.m.jd.com/atop_channel_sign_calendar`, + 'form': `appid=jd-super-market&t=1748931681904&functionId=atop_channel_sign_calendar&client=m&body={"bizCode":"cn_retail_jdsupermarket","scenario":"sign","babelChannel":"ttt32","isJdApp":"1","isWx":"0"}&clientVersion=15.1.50`, + user } - for (let ii in data) { - if (ii == 'floorList') { - for (let jj of data[ii]) { - if (jj.providerData && this.haskey(jj, 'providerData.data.floorData.name') == '汪贝任务楼层') { - let floor = jj.providerData.data.floorData - for (let i of floor.items) { - status = 0 - if (i.completionFlag) { - status = 1 - p.log(`任务已经完成: ${i.assignmentName}`) - if (i.assignmentName.includes('邀请')) { - isOk = 1 - } - } - else { - p.log(`正在运行: ${i.assignmentName}`) - let extraType = i.ext.extraType - if (i.assignmentName.includes('邀请')) { - status = 1 - isOk = 0 - if (this.haskey(i, 'ext.assistTaskDetail.itemId')) { - await this.setTemp(user, i.ext.assistTaskDetail.itemId, 86400000) - } - let users = Object.keys(this.dict) - if (users) { - let itemId = '' - let u = users[this.n % users.length] - this.n++ - if (u == user) { - u = users[this.n % users.length] - } - itemId = this.dict[u] - let help = await this.curl({ - 'form': `appid=jd-super-market&t=1742122986378&functionId=atop_channel_complete_task&client=m&body={"bizCode":"cn_retail_jdsupermarket","scenario":"sign","assignmentType":"${i.assignmentType}","encryptAssignmentId":"${i.encryptAssignmentId}","itemId":"${itemId}","assistFlag":true,"babelChannel":"ttt1","isJdApp":"1","isWx":"0"}`, - user, - algo: { - appId: '51113' - } - } - ) - let subCode = this.haskey(help, 'data.subCode') - if (subCode == '104') { - p.log("您已经助力过了") - isOk = 1 - } - else if (subCode == '0') { - p.log("助力成功") - isOk = 1 - } - if (subCode == '109') { - p.log("不能自己给自己助力") - } - } - else { - isOk = 1 - } - } - else if (this.haskey(i, `ext.${i.ext.extraType}`)) { - let extra = i.ext[extraType] - try { - for (let j of extra.slice(0, i.assignmentTimesLimit)) { - if (['shoppingActivity', 'productsInfo', 'browseShop'].includes(extraType)) { - let d = await this.curl({ - 'url': `https://api.m.jd.com/client.action`, - 'form': `appid=jd-super-market&body=${this.dumps( - { - "bizCode": "cn_retail_jdsupermarket", - "scenario": "sign", - "assignmentType": i.assignmentType, - "encryptAssignmentId": i.encryptAssignmentId, - "itemId": j.itemId || j.advId, - "actionType": 1, - "babelChannel": "ttt1", - "isJdApp": "0", - "isWx": "0" - } - )}&sign=11&t=1653132222710&client=m&functionId=atop_channel_complete_task`, - user, - algo: { - appId: '51113' - }, - // ciphers: 'TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384' - } - ) - p.log(this.haskey(d, 'data.msg') || this.haskey(d, 'message')) - await this.wait((i.ext.waitDuration || 0) * 1000 + 500) - } - let s = await this.curl({ - 'url': `https://api.m.jd.com/client.action`, - 'form': `appid=jd-super-market&body=${this.dumps( - { - "bizCode": "cn_retail_jdsupermarket", - "scenario": "sign", - "assignmentType": i.assignmentType, - "encryptAssignmentId": i.encryptAssignmentId, - "itemId": j.itemId || j.advId, - "babelChannel": "ttt1", - "isJdApp": "0", - "isWx": "0" - } - )}&sign=11&t=1653132222710&client=m&functionId=atop_channel_complete_task`, - user, algo: { - appId: '51113' - }, - } - ) - p.log(i.assignmentName, this.haskey(s, 'data.msg') || this.haskey(s, 'message')) - if (this.haskey(s, 'message', '风险等级未通过')) { - return - } - if (this.haskey(s, 'message', '活动太火爆了')) { - break - } - if (this.haskey(s, 'data.doTaskRewardsInfo.successRewards')) { - for (let kkk in s.data.doTaskRewardsInfo.successRewards) { - for (let kkkk of s.data.doTaskRewardsInfo.successRewards[kkk]) { - p.log(`获得:`, kkkk.quantity, kkkk.rewardName) - } - } - status = 1 - } - await this.wait(1000) - } - } catch (e) { - p.log(e) - } - } - else { - } + ) + if (this.haskey(calendar, 'data.floorData.items')) { + for (let i of calendar.data.floorData.items) { + if (i.signToken) { + let sign = await this.curl({ + 'url': `https://api.m.jd.com/atop_channel_sign_in`, + 'form': `appid=jd-super-market&t=1713230766545&functionId=atop_channel_sign_in&client=m&body={"signToken":"${i.signToken}","channelFollowStatus":1,"bizCode":"cn_retail_jdsupermarket","scenario":"sign","babelChannel":"ttt1","isJdApp":"1","isWx":"0"}`, + user, + algo: { + appId: 'b8fc7', + expire: { + "code": "11001" } } } + ) + if (this.haskey(sign, 'success')) { + status = 1 + p.log(`签到成功`) + for (let i of sign.data.rewards) { + p.log(`获得: ${i.rewardDesc}`) + } + } + else if (this.haskey(sign, "code", "14013")) { + p.log(`您今天已经签过到了`) + status = 1 + } + else { + p.log(this.haskey(sign, 'message') || sign) } } } - if (status) { - p.info.work = true - } + } + if (status) { + p.info.work = true } } }