From a26417f97dbdd8fa9663bc4dc74f2f7bb4491b0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=AF=E8=BE=BE=E9=B8=AD?= Date: Wed, 5 Mar 2025 22:33:13 +0800 Subject: [PATCH] . --- parse/jd/jd_task_farmNew.js | 2 +- parse/jd/jd_task_joyPark.js | 699 ++++++++++++++++++++++++++++++++++ parse/jd/jd_task_smLottery.js | 57 +++ qlCreate.js | 6 +- 4 files changed, 760 insertions(+), 4 deletions(-) create mode 100644 parse/jd/jd_task_joyPark.js create mode 100644 parse/jd/jd_task_smLottery.js diff --git a/parse/jd/jd_task_farmNew.js b/parse/jd/jd_task_farmNew.js index 3e42e32..7b2fc9a 100644 --- a/parse/jd/jd_task_farmNew.js +++ b/parse/jd/jd_task_farmNew.js @@ -51,7 +51,7 @@ export class Main extends Template { } else if (this.turnCount == 1) { this.shareCode({ - task: 'main' + task: 'help' }) } } diff --git a/parse/jd/jd_task_joyPark.js b/parse/jd/jd_task_joyPark.js new file mode 100644 index 0000000..66e4868 --- /dev/null +++ b/parse/jd/jd_task_joyPark.js @@ -0,0 +1,699 @@ +import {Template} from '../../template.js' + +export class Main extends Template { + constructor() { + super() + this.profile = { + title: '京东汪汪庄园', + crontab: 3, + delay: 500, + keyExpire: 12000, + prompt: { + merge: '1 # 执行购买与合成任务', + }, + } + } + + async prepare() { + let linkId = "99DZNpaCTAv8f4TuKXr0Ew" + this.shareCode({linkId}) + } + + async main(p) { + let user = p.data.user; + let context = p.context; + this.dict[user] = {} + await this.baseInfo(p) + await this.joyList(p) + // p.log("获取数据中...", this.dict[user]) + await this.shopList(p) + await this.two(p) + let list = await this.curl({ + 'url': `https://api.m.jd.com/`, + 'form': `functionId=apTaskList&body={"linkId":"${context.linkId}"}&t=1741137369937&appid=activities_platform&client=ios&clientVersion=15.0.25`, + user + }) + for (let i of this.haskey(list, 'data')) { + if (i.taskDoTimes != i.taskLimitTimes) { + let ok = 0 + for (let j = 0; j0) { + joys = joys.reverse() + let min = Math.min(joys.length, this.dict[user].unlock) + for (let i = 0; i1) { + let list = this.dict[user].joy[i] + let spl = this.slice(list, 2) + for (let k = 0; k0) { + await this.baseInfo(p) + await this.joyList(p) + } + if (joy["25"] && joy["26"] && joy["27"] && joy["28"] && joy["29"] && joy["25"].length>0 && joy["26"].length>0 && joy["27"].length>0 && joy["28"].length>0 && joy["29"].length>0) { + for (let i = 21; i<25; i++) { + if ((joy["25"].length + joy["26"].length + joy["27"].length + joy["28"].length + joy["29"].length)>5) { + break + } + if (!this.haskey(joy, `${i}.0`)) { + // if (this.dict[user].joy && (this.dict[user].joy[i] && this.dict[user].joy[i].length == 0) || !this.dict[user].joy[i]) { + let joyInfo = this.dict[user].shop[i] + if (joyInfo && this.dict[user].coin>0 && joyInfo.consume>0 && joyInfo.consume9) { + p.log("不能再养狗子了...") + break + } + let buy = await this.curl({ + 'url': `https://api.m.jd.com/`, + 'form': `functionId=joyBuy&body={"level":${i},"linkId":"${context.linkId}"}&t=1741137369937&appid=activities_platform&client=ios&clientVersion=15.0.25`, + user, + algo: { + 'appId': 'ffb36' + } + }) + await this.baseInfo(p) + await this.joyList(p) + await this.shopList(p) + if (this.haskey(buy, 'data')) { + // p.log(`购买等级${i}的狗子成功...`, this.dict[user].joy[i]) + p.log(`购买等级${i}的狗子成功...`, JSON.stringify(this.dict[user].joy)) + } + else { + p.log(`购买等级${i}的狗子失败...`) + break + } + } + else { + p.log(`没有足够的金币可以购买等级${i}的狗子...`) + break + } + } + } + if (joy["21"] && joy["22"] && joy["23"] && joy["24"] && joy["21"].length>0 && joy["22"].length>0 && joy["23"].length>0 && joy["24"].length>0) { + for (let i = 21; i<22; i++) { + let joyInfo = this.dict[user].shop[i] + if (joyInfo && this.dict[user].coin>0 && joyInfo.consume>0 && joyInfo.consume9) { + p.log("不能再养狗子了...") + break + } + let buy = await this.curl({ + 'url': `https://api.m.jd.com/`, + 'form': `functionId=joyBuy&body={"level":${i},"linkId":"${context.linkId}"}&t=1741137369937&appid=activities_platform&client=ios&clientVersion=15.0.25`, + user, + algo: { + 'appId': 'ffb36' + } + }) + await this.baseInfo(p) + await this.joyList(p) + await this.shopList(p) + if (this.haskey(buy, 'data')) { + // p.log(`购买等级${i}的狗子成功...`, this.dict[user].joy[i]) + p.log(`购买等级${i}的狗子成功...`, JSON.stringify(this.dict[user].joy)) + } + else { + p.log(`购买等级${i}的狗子失败...`) + break + } + } + else { + p.log(`没有足够的金币可以购买等级${i}的狗子...`) + break + } + } + for (let i in this.dict[user].joy) { + if (this.dict[user].joy[i] && this.dict[user].joy[i].length>1 && this.dict[user].joy[i].length % 2 == 0) { + let list = this.dict[user].joy[i] + let spl = this.slice(list, 2) + for (let k of spl) { + let kk = k.sort() + let merge = await this.curl({ + 'url': `https://api.m.jd.com/?functionId=joyMergeGet&body={"joyOneId":${kk[0]},"joyTwoId":${kk[1]},"linkId":"${context.linkId}"}&t=1741137369937&appid=activities_platform&client=ios&clientVersion=15.0.25`, + user, + algo: { + 'appId': 'c3beb' + } + }) + if (this.haskey(merge, 'data.joyPrizeVO.prizeName')) { + let prizeType = merge.data.joyPrizeVO.prizeType + if (prizeType == 2) { + p.msg(`红包: ${merge.data.joyPrizeVO.prizeName}`) + } + else if (prizeType == 3) { + p.msg(`京豆: ${merge.data.joyPrizeVO.prizeName}`) + } + else if (prizeType == 4) { + p.msg(`现金: ${merge.data.joyPrizeVO.prizeName}`) + } + else { + p.log(`升级奖励: ${merge.data.joyPrizeVO.prizeName}`) + } + } + await this.baseInfo(p) + await this.joyList(p) + // p.log(`合成等级${parseInt(i) + 1}的狗子成功...`, this.dict[user].joy[parseInt(i) + 1]) + p.log(`合成等级${parseInt(i) + 1}的狗子成功...`, JSON.stringify(this.dict[user].joy)) + } + } + } + } + } + else { + for (let i in this.dict[user].joy) { + if (this.dict[user].joy[i] && this.dict[user].joy[i].length>1 && this.dict[user].joy[i].length % 2 == 0) { + let list = this.dict[user].joy[i] + let spl = this.slice(list, 2) + for (let k of spl) { + let kk = k.sort() + let merge = await this.curl({ + 'url': `https://api.m.jd.com/?functionId=joyMergeGet&body={"joyOneId":${kk[0]},"joyTwoId":${kk[1]},"linkId":"${context.linkId}"}&t=1741137369937&appid=activities_platform&client=ios&clientVersion=15.0.25`, + user, + algo: { + 'appId': 'c3beb' + } + }) + if (this.haskey(merge, 'data.joyPrizeVO.prizeName')) { + let prizeType = merge.data.joyPrizeVO.prizeType + if (prizeType == 2) { + p.msg(`红包: ${merge.data.joyPrizeVO.prizeName}`) + } + else if (prizeType == 3) { + p.msg(`京豆: ${merge.data.joyPrizeVO.prizeName}`) + } + else if (prizeType == 4) { + p.msg(`现金: ${merge.data.joyPrizeVO.prizeName}`) + } + else { + p.log(`升级奖励: ${merge.data.joyPrizeVO.prizeName}`) + } + } + await this.baseInfo(p) + await this.joyList(p) + // p.log(`合成等级${parseInt(i) + 1}的狗子成功...`, this.dict[user].joy[parseInt(i) + 1]) + p.log(`合成等级${parseInt(i) + 1}的狗子成功...`, JSON.stringify(this.dict[user].joy)) + } + } + } + for (let i in this.dict[user].joy) { + if (this.dict[user].joy[i] && this.dict[user].joy[i].length % 2 == 1 && i0 && joyInfo.consume>0 && joyInfo.consume9) { + p.log("不能再养狗子了...") + break + } + let buy = await this.curl({ + 'url': `https://api.m.jd.com/`, + 'form': `functionId=joyBuy&body={"level":${i},"linkId":"${context.linkId}"}&t=1741137369937&appid=activities_platform&client=ios&clientVersion=15.0.25`, + user, + algo: { + 'appId': 'ffb36' + } + }) + if (this.haskey(buy, 'data')) { + await this.shopList(p) + // p.log(`购买等级${i}的狗子成功...`, this.dict[user].joy[i]) + p.log(`购买等级${i}的狗子成功...`, JSON.stringify(this.dict[user].joy)) + // 此处为了防止有低等级狗子合并购买逻辑混乱 + let list = this.dict[user].joy[i] + if (list && list.length>1) { + let spl = this.slice(list, 2) + for (let k of spl) { + let kk = k.sort() + let merge = await this.curl({ + 'url': `https://api.m.jd.com/?functionId=joyMergeGet&body={"joyOneId":${kk[0]},"joyTwoId":${kk[1]},"linkId":"${context.linkId}"}&t=1741137369937&appid=activities_platform&client=ios&clientVersion=15.0.25`, + user, + algo: { + 'appId': 'c3beb' + } + }) + if (this.haskey(merge, 'data.joyPrizeVO.prizeName')) { + let prizeType = merge.data.joyPrizeVO.prizeType + if (prizeType == 2) { + p.msg(`红包: ${merge.data.joyPrizeVO.prizeName}`) + } + else if (prizeType == 3) { + p.msg(`京豆: ${merge.data.joyPrizeVO.prizeName}`) + } + else if (prizeType == 4) { + p.msg(`现金: ${merge.data.joyPrizeVO.prizeName}`) + } + else { + p.log(`升级奖励: ${merge.data.joyPrizeVO.prizeName}`) + } + } + p.log(`合成等级${parseInt(i) + 1}的狗子成功...`, JSON.stringify(this.dict[user].joy)) + } + } + await this.baseInfo(p) + await this.joyList(p) + } + else { + p.log(`购买等级${i}的狗子失败...`) + } + } + else { + p.log(`没有足够的金币可以购买等级${i}的狗子...`) + } + } + } + } + } + + async two(p) { + let user = p.data.user + let context = p.context + if (this.profile.merge) { + await this.one(p) + let joy = this.dict[user].joy || {} + for (let i = 0; i<30; i++) { + if (this.dict[user].coin>this.dict[user].buyCoin) { + if (this.dict[user].number>9) { + p.log("不能再养狗子了...") + break + } + let i = this.dict[user].buyLevel + let buy = await this.curl({ + 'url': `https://api.m.jd.com/`, + 'form': `functionId=joyBuy&body={"level":${i},"linkId":"${context.linkId}"}&t=1741137369937&appid=activities_platform&client=ios&clientVersion=15.0.25`, + user, + algo: { + 'appId': 'ffb36' + } + }) + await this.baseInfo(p) + await this.joyList(p) + await this.shopList(p) + if (this.haskey(buy, 'data')) { + // p.log(`购买等级${i}的狗子成功...`, this.dict[user].joy[i]) + p.log(`购买等级${i}的狗子成功...`, JSON.stringify(this.dict[user].joy)) + } + else { + p.log(`购买等级${i}的狗子失败...`) + break + } + } + else { + p.log(this.dict[user].buyLevel ? `购买等级${this.dict[user].buyLevel}的牛牛金币不足...` : '金币不足...') + break + } + await this.one(p) + } + } + } + + async shopList(p) { + let user = p.data.user + let context = p.context + let s = await this.curl({ + 'url': `https://api.m.jd.com/api?functionId=gameShopList`, + 'form': `functionId=gameShopList&body={"linkId":"${context.linkId}"}&t=1741137369938&appid=activities_platform&client=ios&clientVersion=15.0.25`, + user, + algo: { + expire: { + code: 1000 + } + } + } + ) + let data = this.haskey(s, 'data') + if (data) { + let obj = { + shop: this.column(data, '', 'userLevel') + } + this.dict[user] = { + ...this.dict[user], + ...obj + } + return obj + } + else { + return {} + } + } + + async joyList(p) { + let user = p.data.user + let context = p.context + var joyList = await this.curl({ + 'url': `https://api.m.jd.com/api?functionId=joyList`, + 'form': `functionId=joyList&body={"linkId":"${context.linkId}"}&t=1741137369938&appid=activities_platform&client=ios&clientVersion=15.0.25`, + user, + algo: { + 'appId': 'e18ed' + } + }) + if (this.haskey(joyList, 'data')) { + let number = joyList.data.joyNumber + var joy = {} + for (let i of joyList.data.activityJoyList) { + joy[i.level] = joy[i.level] || [] + joy[i.level].push(i.id) + } + if (this.haskey(joyList, 'data.workJoyInfoList')) { + for (let i of joyList.data.workJoyInfoList) { + if (this.haskey(i, 'joyDTO.id')) { + let move = await this.curl({ + 'url': 'https://api.m.jd.com/', + 'form': `functionId=joyMove&body={"joyId":${i.joyDTO.id},"location":0,"linkId":"${context.linkId}"}&t=1741137369938&appid=activities_platform&client=ios&clientVersion=15.0.25`, + user, + algo: { + 'appId': '50788' + } + }) + if (this.haskey(move, 'success')) { + joy[i.joyDTO.level] = joy[i.joyDTO.level] || [] + joy[i.joyDTO.level].push(i.joyDTO.id) + } + } + } + } + let list = Object.keys(joy).map(d => parseInt(d)) + let min = Math.min(...list) + let max = Math.max(...list) + for (let i = min; i d.unlock).length + let obj = { + joy, + number, + min, + unlock + } + this.dict[user] = { + ...this.dict[user], + ...obj + } + return obj + } + else { + let obj = { + joy: {} + } + this.dict[user] = { + ...this.dict[user], + ...obj + } + return obj + } + } + + async baseInfo(p) { + let user = p.data.user + let context = p.context + this.dict[user] = {} + let baseInfo = await this.curl({ + 'url': `https://api.m.jd.com/api?functionId=joyBaseInfo`, + 'form': `functionId=joyBaseInfo&body={"taskId":"","inviteType":"","inviterPin":"","linkId":"${context.linkId}"}&t=1741137369937&appid=activities_platform&client=ios&clientVersion=15.0.25`, + user, algo: { + appId: "4abce", + expire: { + code: 1000 + } + } + } + ) + if (this.haskey(baseInfo, 'errMsg', 'blackfail')) { + p.log("狗子在小黑屋里面...") + p.info.jump = true + return { + error: 1 + } + } + var data = this.haskey(baseInfo, 'data') + if (this.haskey(baseInfo, 'data.level') == 1 && !this.haskey(baseInfo, 'data.joyCoin')) { + await this.curl({ + 'url': `https://api.m.jd.com/`, + 'form': `functionId=newStartReward&body={"linkId":"${context.linkId}"}&t=1741137369937&appid=activities_platform&client=ios&clientVersion=15.0.25`, + user + }) + } + if (this.haskey(baseInfo, 'data.level') == 30) { + let joyRestart = await this.curl({ + 'url': `https://api.m.jd.com/`, + 'form': `functionId=joyRestart&body={"linkId":"${context.linkId}"}&t=1741137369937&appid=activities_platform&client=ios&clientVersion=15.0.25`, + user, + algo: { + 'appId': '4abce' + } + }) + p.log(`已经满级了,正在切换场景`) + await this.curl({ + 'url': `https://api.m.jd.com/`, + 'form': `functionId=newStartReward&body={"linkId":"${context.linkId}"}&t=1741137369937&appid=activities_platform&client=ios&clientVersion=15.0.25`, + user + }) + for (let i of Array(2)) { + baseInfo = await this.curl({ + 'url': `https://api.m.jd.com/`, + 'form': `functionId=joyBaseInfo&body={"taskId":"","inviteType":"","inviterPin":"","linkId":"${context.linkId}"}&t=1741137369937&appid=activities_platform&client=ios&clientVersion=15.0.25`, + user, + algo: { + appId: "4abce" + } + }) + data = this.haskey(baseInfo, 'data') + if (data) { + break + } + else { + await this.wait(2000) + } + } + } + if (this.haskey(data, 'invitePin')) { + var compact = { + coin: data.joyCoin, + buyCoin: data.fastBuyCoin, + level: data.level, + buyLevel: data.fastBuyLevel, + invitePin: data.invitePin, + } + // if (inviterPin) { + // compact.helpPin = inviterPin + // compact.helpUser = helpUser + // } + this.dict[user] = { + ...this.dict[user], + ...compact + } + } + else { + this.dict[user] = { + joy: {}, + shop: {} + } + var compact = { + joy: {}, + shop: {} + } + } + return compact + } + + slice(data, num) { + let result = []; + if (num == 0) { + result = [data] + } + else { + for (let i = 0, len = data.length; i 2) { @@ -320,7 +320,7 @@ import {fileURLToPath, pathToFileURL} from 'url'; }else{ console.log(e) } - + })` fs.writeFile(`${abspath}/${script}`, code, function(err, data) { if (err) {