2025年9月13日星期六

叮咚买菜任务脚本(2025年9月版)

1.购买服务器阿里云:服务器购买地址https://t.aliyun.com/U/DT4XYh若失效,可用地址

1.购买服务器

阿里云:

服务器购买地址

https://t.aliyun.com/U/DT4XYh

若失效,可用地址

https://www.aliyun.com/activity/wuying/dj?source=5176.29345612&userCode=49hts92d

腾讯云:

https://curl.qcloud.com/wJpWmSfU

若失效,可用地址

https://cloud.tencent.com/act/cps/redirect?redirect=2446&cps_key=ad201ee2ef3b771157f72ee5464b1fea&from=console

华为云

https://activity.huaweicloud.com/cps.html?fromacct=64b5cf7cc11b4840bb4ed2ea0b2f4468&utm_source=V1g3MDY4NTY=&utm_medium=cps&utm_campaign=201905

2.部署教程

2024年最新青龙面板跑脚本教程(一)持续更新中

3.代码如下

/* cron: 22 7,10,16 * * **/
const $ = new Env('叮咚买菜');const notify = $.isNode() ? require('Notify') : '';const {log} = console;const Notify = 1//0为关闭通知,1为打开通知,默认为1//////////////////////let ddmc = process.env.ddmc;let ddmcArr = [];let data = '';let msg = '';
!(async () => {
if (!(await Envs()))return;else {


log(`\n\n=============================================    \n脚本执行 - 北京时间(UTC+8):${new Date(new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 +8 * 60 * 60 * 1000).toLocaleString()} \n=============================================\n`);

log(`\n=================== 共找到 ${ddmcArr.length} 个账号 ===================`)
for (let index = 0; index < ddmcArr.length; index++) {
let num = index + 1log(`\n========= 开始【第 ${num} 个账号】=========\n`)
data=JSON.parse(JSON.stringify(getRequest(ddmcArr[index]))); station_id=data.station_id;CityId=data.city_number; uid=data.uid; latitude=data.latitude; longitude=data.longitude; device_token=data.device_token; device_id=data.device_id; ddmck=data.DDXQSESSID; header1 = JSON.parse(`{"Accept":"*/*","Accept-Encoding":"gzip, deflate, br","Host":"farm.api.ddxq.mobi","Connection":"keep-alive","Accept-Language":"zh-cn","Origin":"https://game.m.ddxq.mobi","User-Agent":"Mozilla/5.0 (iPhone; CPU iPhone OS 14_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 xzone/9.61.1 station_id/${station_id} device_id/${device_id}","cookie":"DDXQSESSID=${ddmck}"}`) header2 = JSON.parse(`{"Accept":"*/*","Accept-Encoding":"gzip, deflate, br","Host":"farm.api.ddxq.mobi","Connection":"keep-alive","Accept-Language":"zh-cn","Origin":"https://game.m.ddxq.mobi","User-Agent":"Mozilla/5.0 (iPhone; CPU iPhone OS 14_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 xzone/9.61.1 station_id/${station_id} device_id/${device_id}","DDMC-GAME-TID":2,"cookie":"DDXQSESSID=${ddmck}"}`)
msg += `\n第${num}个账号运行结果:`await checkid();await $.wait(1 * 1000);log('【APP签到】')await $.wait(1 * 1000);await doSign();await $.wait(1 * 1000);log('开始鱼塘任务')await $.wait(1 * 1000);log('【鱼塘-连续签到】')await $.wait(1 * 1000);await doachieve('CONTINUOUS_SIGN',0);//鱼塘连续签到await $.wait(1 * 1000);            log('【鱼塘-每日签到】')await $.wait(1 * 1000);await doachieve('DAILY_SIGN',0);//鱼塘每日签到await $.wait(1 * 1000);            log('【鱼塘-三餐开福袋】')await $.wait(1 * 1000);await doachieve('LOTTERY',0);//三餐开福袋7-9 10-12 16-18await $.wait(1 * 1000);            log('【鱼塘-去翻牌一次】')await $.wait(1 * 1000);            await luckydarw();await $.wait(1 * 1000);            log('【鱼塘-浏览商品得饲料】')await $.wait(1 * 1000);            await doachieve('BROWSE_GOODS',0);//鱼塘await $.wait(1 * 1000);            log('【鱼塘-浏览宝妈严选得饲料】')await $.wait(1 * 1000);            await doachieve('BROWSE_GOODS3',0);//鱼塘await $.wait(1 * 1000);            await getasklist();//获取鱼塘任务数据await $.wait(1 * 1000);log('【鱼塘-领饲料瓶】')await $.wait(1 * 1000);await rewardtask(slpid,0);await $.wait(1 * 1000);log('【鱼塘-参与天天翻牌活动】领取奖励')await $.wait(1 * 1000);            await rewardtask(fpid,0);//完成翻牌任务,鱼塘await $.wait(1 * 1000);log('【果园-去鱼塘喂食一次】领取任务')await $.wait(1 * 1000);await gotofeedfish();//领取果园喂鱼任务await $.wait(1 * 1000);await checkfish();await $.wait(2 * 1000);log('开始喂鱼')            if(nofish == 1){    log('!!!鱼塘没有鱼了!!!') }else if(parseInt(pid) < 55 || parseInt(newfish) > 10 ){                for (i = 0; i < 20; i++) {                    await feedfish();//喂鱼    await $.wait(3 * 1000);    if(parseInt(fish) > 55 || parseInt(sl) < 10 || nofish == 1){  log('无法喂养,可能饲料不足10g或者饲料瓶已经满了或者没有鱼')  break;    }                } }else{log('无法喂养,可能饲料不足10g或者饲料瓶已经满了或者没有鱼') }await $.wait(1 * 1000);await checkfish2();await $.wait(1 * 3000);log('=============================================')            log('开始果园任务')log('=============================================')await $.wait(1 * 1000);log('【果园-连续签到】')await $.wait(1 * 1000);await doachieve('CONTINUOUS_SIGN',1);await $.wait(1 * 1000);            log('【果园-每日签到】')await $.wait(1 * 1000);await doachieve('DAILY_SIGN',1);await $.wait(1 * 1000);log('【果园-三餐开福袋】')await $.wait(1 * 1000);await doachieve('LOTTERY',1);//三餐开福袋7-9 10-12 16-18await $.wait(1 * 1000);log('【去鱼塘喂食一次】领奖励')await getasklist2();await $.wait(1 * 1000);            await rewardtask(fishid2,1);            log('【果园-浏览商品奖水滴】')await $.wait(1 * 1000);            await doachieve('BROWSE_GOODS',1)await $.wait(1 * 1000);await checkwater();await $.wait(2 * 1000);if(nobanana == 1){    log('!!!农场没有树了!!!') }else if(parseInt(newater) > 10){                for (i = 0; i < 10; i++) {                    await water();//浇水    await $.wait(2 * 1000);    if(parseInt(nowater) < 10){  log('水滴不足10,停止浇水')  break;    }                } }else{log('果园水滴不足10,停止浇水') }await $.wait(1 * 1000);log('领取【浇水10次送水滴】奖励')await $.wait(1 * 1000);await doachieve('FEED_N_TIMES',1)await $.wait(2 * 1000);await checkwater2();await $.wait(2 * 1000);
}await SendMsg(msg); }
})() .catch((e) => log(e)) .finally(() => $.done())

/** * APP签到 */function doSign(timeout = 3 * 1000) {return new Promise((resolve) => {let url = {url`http://sunquan.api.ddxq.mobi/api/v2/user/signin/`,headers: {                 "cookie":`DDXQSESSID=${ddmck}`            },body`api_version=9.7.3&app_version=1.0.0&app_client_id=3&station_id=${station_id}&native_version=9.35.1&city_number=${CityId}&latitude=${latitude}&longitude=${longitude}`, }
$.post(url, async (error, response, data) => {try {let result = JSON.parse(data);if (result.msg == '请求成功' && result.success == true) {log(`签到成功,获得:${result.data.point}积分,已经签到了${result.data.sign_series}天`)//msg += `\n签到成功,获得:${result.data.point}积分,已经签到了${result.data.sign_series}天`else {log(`签到失败,原因是:${result.message}`) msg += '\n签到失败,可能是cookies失效' }catch (e) {log(e)finally {resolve(); } }, timeout) })}/** * 获取鱼塘任务数据 */function getasklist(timeout = 3 * 1000) {return new Promise((resolve) => {let url = {url`http://farm.api.ddxq.mobi/api/v2/task/list?api_version=9.1.0&app_client_id=2&station_id=${station_id}&stationId=${station_id}&native_version=&app_version=9.58.0&OSVersion=10&CityId=${CityId}&uid=${uid}&latitude=${latitude}&longitude=${longitude}&lat=${latitude}&lng=${longitude}&device_token=${device_token}&gameId=1&cityCode=${CityId}`,headers: header1, }
$.get(url, async (error, response, data) => {try {let result = JSON.parse(data);var siliaoping = data.indexOf("HARD_BOX") != -1 if (result.msg == '请求成功' && result.success == true) {log('农场-获取任务数据成功')var tasklist = result.data.userTaskslet fp = tasklist.find(item => item['taskName']==='参与天天翻牌活动')                    fpid = fp['userTaskLogId']if(siliaoping == true){let slp = tasklist.find(item => item['taskCode']==='HARD_BOX') slpid = slp['userTaskLogId'] pid= slp.targetRewardRangesVos[0].rewardRanges[0].amountDesc }else{ slpid = 0 pid = 0 }

else {log(`获取任务数据失败,可能是cookies失效`)                    msg += '\n获取任务数据失败,可能是cookies失效' }
catch (e) {log(e)finally {resolve(); } }, timeout) })}//果园function getasklist2(timeout = 3 * 1000) {return new Promise((resolve) => {let url = {url`https://farm.api.ddxq.mobi/api/v2/task/list-orchard?api_version=9.1.0&app_client_id=1&station_id=${station_id}&stationId=${station_id}&native_version=&CityId=${CityId}&OSVersion=14&uid=${uid}&latitude=${latitude}&longitude=${longitude}&lat=${latitude}&lng=${longitude}&device_token=${device_token}&reward=FEED&cityCode=${CityId}`,headers: header2, }
$.get(url, async (error, response, data) => {try {let result = JSON.parse(data);if (result.msg == '请求成功' && result.success == true) {log('果园-获取任务数据成功')let tasklist = result.data.userTaskslet hesuan = tasklist.find(item => item['taskName']==='去鱼塘喂食1次')                    fishid2 = hesuan['userTaskLogId']else {log(`获取任务数据失败,可能是cookies失效`)                    msg += '\n获取任务数据失败,可能是cookies失效' }
catch (e) {log(e)finally {resolve(); } }, timeout) })}
/** * 鱼塘任务 */function doachieve(taskCode,code,timeout = 3 * 1000) {return new Promise((resolve) => {        if(code == 0){            ddmcheader=header1 ddmcurl = `https://farm.api.ddxq.mobi/api/v2/task/achieve?api_version=9.1.0&app_client_id=2&station_id=${station_id}&stationId=${station_id}&native_version=&app_version=9.58.0&OSVersion=10&CityId=${CityId}&latitude=${latitude}&longitude=${longitude}&lat=${latitude}&lng${latitude}&device_token=${device_token}&gameId=1&taskCode=${taskCode}` }else{ ddmcheader=header2 ddmcurl =`https://farm.api.ddxq.mobi/api/v2/task/achieve?api_version=9.1.0&app_client_id=2&station_id=${station_id}&stationId=${station_id}&native_version=&app_version=9.58.0&OSVersion=10&CityId=${CityId}&latitude=${latitude}&longitude=${longitude}&lat=${latitude}&lng${latitude}&device_token=${device_token}&taskCode=${taskCode}` }let url = {url: ddmcurl,headers: ddmcheader, }
$.get(url, async (error, response, data) => {try {let result = JSON.parse(data);if (taskCode == 'CONTINUOUS_SIGN' && code == 0 && result.success == true) {log(`任务完成,获得:${result.data.rewards[0].amount}g饲料`)                } else if(taskCode == 'DAILY_SIGN' && code == 0 && result.success == true) {                    log(`任务完成,获得:${result.data.rewards[0].amount}g饲料`)else if(taskCode == 'CONTINUOUS_SIGN' && code == 1 && result.success == true) {                    log(`任务完成,获得:${result.data.rewards[0].amount}水滴`)else if(taskCode == 'DAILY_SIGN' && code == 1 && result.success == true) {                    log(`任务完成,获得:${result.data.rewards[0].amount}水滴`)else if(result.msg == '今日已完成任务,明日再来吧!') {log(`任务已完成`)else if(result.msg == '你已完成任务,去看看其他任务吧~') {log(`任务已完成`)                } else if(taskCode == 'LOTTERY' && result.msg == '任务尚未开启,请耐心等待~') {                    log('还没到领取时间,请在7-9;10-12;16-18这三个时间段内操作')else if(taskCode == 'LOTTERY' && code == 0 && result.success == true) {                    log(`任务完成,获得:${result.data.rewards[0].amount}g饲料`)else if(taskCode == 'LOTTERY' && code == 1 && result.success == true) {                    log(`任务完成,获得:${result.data.rewards[0].amount}水滴`)                } else if(taskCode == 'BROWSE_GOODS' && code == 0 && result.success == true) {rewardtask(result.data.userTaskLogId,0);else if(taskCode == 'BROWSE_GOODS' && code == 1 && result.success == true) {rewardtask(result.data.userTaskLogId,1);                } else if(taskCode == 'BROWSE_GOODS3' && code == 0 && result.success == true) {                    rewardtask(result.data.userTaskLogId,0);else if(taskCode == 'FEED_N_TIMES' && result.success == true) {                    log(`任务完成,获得:${result.data.rewards[0].amount}水滴`)else if(taskCode == 'FEED_N_TIMES' && result.msg == '浇水次数不满足') {                    log('浇水不满10次,无法完成任务')else if(result.msg == '此任务不可手动完成') {                    log('任务需要手动操作')else{log(`获取任务数据失败,可能是cookies失效`) }
catch (e) {log(e)finally {resolve(); } }, timeout) })}function luckydarw(timeout = 3 * 1000) {return new Promise((resolve) => {let url = {url`http://farm.api.ddxq.mobi/api/v2/lucky-draw-activity/draw?api_version=9.7.3&app_version=1.0.0&app_client_id=3&station_id=${station_id}&native_version=9.58.0&city_number=${CityId}&device_token=${device_token}&device_id=${device_id}&latitude=${latitude}&longitude=${longitude}&gameId=1&uid=${uid}`,headers: header1, } $.get(url, async (error, response, data) => {try {let result = JSON.parse(data);if (result.msg == '请求成功' && result.success == true) {log(`已翻牌并获得:${result.data.chosen.amount}饲料`)else {log('饲料不足,翻牌失败')                    msg += '\n饲料不足,翻牌失败' }catch (e) {log(e)finally {resolve(); } }, timeout) })}
function rewardtask(taskid,code,timeout = 3 * 1000) {return new Promise((resolve) => {if(code == 0){            ddmcheader1=header1 ddmcurl1 = `http://farm.api.ddxq.mobi/api/v2/task/reward?api_version=9.1.0&app_client_id=2&station_id=${station_id}&stationId=${station_id}&native_version=&app_version=9.58.0&OSVersion=10&CityId=${CityId}&uid=${uid}&latitude=${latitude}&longitude=${longitude}&lat=${latitude}&lng=${longitude}&device_token=${device_token}&gameId=1&userTaskLogId=${taskid}` }else{ ddmcheader1=header2 ddmcurl1 = `http://farm.api.ddxq.mobi/api/v2/task/reward?api_version=9.1.0&app_client_id=2&station_id=${station_id}&stationId=${station_id}&native_version=&app_version=9.58.0&OSVersion=10&CityId=${CityId}&uid=${uid}&latitude=${latitude}&longitude=${longitude}&lat=${latitude}&lng=${longitude}&device_token=${device_token}&userTaskLogId=${taskid}` }let url = {url: ddmcurl1,headers: ddmcheader1, } $.get(url, async (error, response, data) => {try {let result = JSON.parse(data);if(taskid == 0){log('暂时没有饲料瓶入口') }else if (result.msg == '请求成功' && result.success == true) {log(`任务完成,获得:${result.data.rewards[0].amount}饲料`)                } else if(result.msg == '你已领取奖励,去领其他奖励吧~') {log('已经领取过该奖励')else if(result.msg == '不可领取') {log('已经领取过该奖励')else if(result.msg == '参数无效') {log('任务不存在或者已完成')else {log('任务失败,可能是cookies失效') }
catch (e) {log(e)finally {resolve(); } }, timeout) })}
function gotofeedfish(timeout = 3 * 1000) {return new Promise((resolve) => {let url = {url`http://farm.api.ddxq.mobi/api/v2/task/receive?api_version=9.1.0&app_client_id=2&station_id=${station_id}&stationId=${station_id}&native_version=&CityId=${CityId}&OSVersion=10&uid=${uid}&latitude=${latitude}&longitude=${longitude}&lat=${latitude}&lng=${longitude}&device_token=&gameId=2&taskCode=FEED_CRAP`,headers: header2, } $.get(url, async (error, response, data) => {try {let result = JSON.parse(data);if (result.msg == '请求成功' && result.success == true) {log(`【去鱼塘喂食一次】领取任务成功,等待喂鱼`)else if(result.msg == '该任务已经完成了哦'){log('【去鱼塘喂食一次】任务已完成') }else{log('【去鱼塘喂食一次】任务失败,可能是cookies失效') }catch (e) {log(e)finally {resolve(); } }, timeout) })}
function feedfish(timeout = 3 * 1000) {return new Promise((resolve) => {let url = {url`http://farm.api.ddxq.mobi/api/v2/props/feed?api_version=9.1.0&app_client_id=2&station_id=${station_id}&stationId=${station_id}&native_version=&app_version=9.58.0&OSVersion=10&CityId=${CityId}&uid=${uid}&latitude=${latitude}&longitude=${longitude}&lat=${latitude}&lng=${longitude}&device_token=${device_token}&gameId=1&propsId=${fishpropsId}&seedId=${fishseedId}&cityCode=${CityId}&feedPro=0&triggerMultiFeed=1`,headers: {                 "Host""farm.api.ddxq.mobi",                "user-agent""Mozilla/5.0 (Linux; Android 10; MI 8 Build/QKQ1.190828.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/89.0.4389.72 MQQBrowser/6.2 TBS/045947 Mobile Safari/537.36 xzone/9.58.0 station_id/60dd252dbd8d8c0001eca0e0 OpenTime/"+timestampMs(),                "accept""*/*",                "origin""https://game.m.ddxq.mobi",                "x-requested-with""com.yaya.zone",                "sec-fetch-site""same-site",                "sec-fetch-mode""cors",                "sec-fetch-dest""empty",                "referer""https://game.m.ddxq.mobi/",                "accept-encoding""gzip, deflate, br",                "accept-language""zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7",                "cookie"`DDXQSESSID=${ddmck}`            }, }
$.get(url, async (error, response, data) => {try {if(error){//406 Not Acceptable                   log ('Api请求失败,请登陆APP完成滑动验证')   msg +='\n请登陆APP完成滑动验证完成喂鱼操作'   fish='0'   sl='0' }else{let result = JSON.parse(data);    if (result.success == true && result.data.hardBoxRewardAmountAfterFeed == null) {   log(`喂鱼成功,剩余${result.data.feed.amount}g饲料,${result.data.seed.msg}`)                       fish=result.data.hardBoxRewardAmountAfterFeed   sl=result.data.feed.amount    }else if(result.success == true && result.data.hardBoxRewardAmountAfterFeed != null){                       log(`喂鱼成功,剩余${result.data.feed.amount}g饲料,已存储${result.data.hardBoxRewardAmountAfterFeed}g饲料,${result.data.seed.msg}`)                       fish=result.data.hardBoxRewardAmountAfterFeed   sl=result.data.feed.amount    } else if(result.msg == '饲料不足10g,请完成任务领饲料~' || result.msg == '今天喂食太多了,休息一下明天再来吧'){   log('喂鱼失败,饲料不足10g或者达到喂鱼上限')   fish='0'   sl='0'    }else{   log('喂鱼任务失败,可能是cookies失效')    } }
catch (e) {log(e)finally {resolve(); } }, timeout) })}
function water(timeout = 3 * 1000) {return new Promise((resolve) => {let url = {url`http://farm.api.ddxq.mobi/api/v2/props/feed?api_version=9.1.0&app_client_id=2&station_id=${station_id}&stationId=${station_id}&native_version=&CityId=${CityId}&OSVersion=10&uid=${uid}&latitude=${latitude}&longitude=${longitude}&lat=${latitude}&lng=${longitude}&device_token=${device_token}&propsCode=FEED&seedId=${waterseedId}&propsId=${waterpropsId}`,headers: header2, }
$.get(url, async (error, response, data) => {try {                if(error){ log ('Api请求失败,请登陆APP完成滑动验证')    msg +='\n请登陆APP完成滑动验证' nowater='0' }else{let result = JSON.parse(data);if (result.msg == '请求成功' && result.success == true) {   nowater=result.data.feed.amount   gyfl = result.data.fertilizerUse.amount   log(`浇水成功,剩余${nowater}水滴,当前肥力:${gyfl},${result.data.msg}`)   if(gyfl < 10){log('肥力不足,自动施肥')await userfeiliao();   }    } else {   log('浇水失败,可能是水滴不足或者cookies失效')                       msg += '\n浇水失败,可能是水滴不足或者cookies失效'    } }
catch (e) {log(e)finally {resolve(); } }, timeout) })}
function userfeiliao(timeout = 3 * 1000) {return new Promise((resolve) => {let url = {url`https://farm.api.ddxq.mobi/api/v2/props/props-use?api_version=9.1.0&app_client_id=1&station_id=${station_id}&stationId=${station_id}&native_version=&CityId=${CityId}&OSVersion=14&uid=${uid}&latitude=${latitude}&longitude=${longitude}&lat=${latitude}&lng=${longitude}&device_token=${device_token}&propsCode=FERTILIZER&propsId=220910108081811250&seedId=220910108081800250`,headers: header2, } $.get(url, async (error, response, data) => {try {let result = JSON.parse(data);if (result.msg == '请求成功' && result.success == true) {log(`施肥成功,剩余${result.data.propsUse.amount}肥料,当前可用肥料:${result.data.propsUseResultVo.amount}`)else {log('肥料不足,施肥失败') }catch (e) {log(e)finally {resolve(); } }, timeout) })}
function checkwater(timeout = 3 * 1000) {return new Promise((resolve) => {let url = {url`http://farm.api.ddxq.mobi/api/v2/userguide/orchard/detail?api_version=9.1.0&app_client_id=2&station_id=${station_id}&stationId=${station_id}&native_version=&CityId=${CityId}&OSVersion=10&uid=${uid}&latitude=${latitude}&longitude=${longitude}lat=${latitude}&lng=${longitude}&device_token=${device_token}&gameId=2&cityCode=${CityId}`,headers: header2, } $.get(url, async (error, response, data) => {try {let result = JSON.parse(data);if(data.indexOf("seedId")<0){ nobanana = 1 newater=result.data.feed.amount waterpropsId = result.data.feed.propsId waterseedId = 0log('农场没有香蕉可以种,检查是否已经获得奖励') msg +='\n农场没有香蕉可以种,检查是否已经获得奖励' }else if (result.msg == '请求成功' && result.success == true) { nobanana = 0 newater=result.data.feed.amount    waterpropsId = result.data.feed.propsId waterseedId = result.data.baseSeed.seedIdlog(`目前果园水滴:${newater}`) }catch (e) {log(e)finally {resolve(); } }, timeout) })}
function checkwater2(timeout = 3 * 1000) {return new Promise((resolve) => {let url = {url`http://farm.api.ddxq.mobi/api/v2/userguide/orchard/detail?api_version=9.1.0&app_client_id=2&station_id=${station_id}&stationId=${station_id}&native_version=&CityId=${CityId}&OSVersion=10&uid=${uid}&latitude=${latitude}&longitude=${longitude}lat=${latitude}&lng=${longitude}&device_token=${device_token}&gameId=2&cityCode=${CityId}`,headers: header2, } $.get(url, async (error, response, data) => {try {let result = JSON.parse(data);if(data.indexOf("seedId")<0){log('农场没有香蕉可以种,检查是否已经获得奖励') }else if (result.msg == '请求成功' && result.success == true) { msg+= `\n【果园】${result.data.baseSeed.msg}` }catch (e) {log(e)finally {resolve(); } }, timeout) })}
function checkfish(timeout = 3 * 1000) {return new Promise((resolve) => {let url = {url`http://farm.api.ddxq.mobi/api/v2/userguide/detail?api_version=9.1.0&app_client_id=2&station_id=${station_id}&stationId=${station_id}&native_version=&app_version=9.58.0&OSVersion=10&CityId=${CityId}&latitude=${latitude}&longitude=${longitude}&lat=${latitude}&lng=${longitude}&device_token=${device_token}&gameId=1&guideCode=FISHPOND_NEW`,headers: header1, }
$.get(url, async (error, response, data) => {try {let result = JSON.parse(data);if(data.indexOf("seedId")<0){ nofish = 1 newfish=result.data.feed.amount fishpropsId = result.data.feed.propsId fishseedId = 0 fish = 0log('鱼塘没有鱼可以喂,检查是否已经获得奖励') msg +='\n鱼塘没有鱼可以喂,检查是否已经获得奖励' }else if (result.msg == '请求成功' && result.success == true) { nofish = 0 newfish=result.data.feed.amount fishpropsId = result.data.feed.propsId fishseedId = result.data.baseSeed.seedIdlog(`目前鱼饲料:${newfish}g`) }
catch (e) {log(e)finally {resolve(); } }, timeout) })}
function checkfish2(timeout = 3 * 1000) {return new Promise((resolve) => {let url = {url`http://farm.api.ddxq.mobi/api/v2/userguide/detail?api_version=9.1.0&app_client_id=2&station_id=${station_id}&stationId=${station_id}&native_version=&app_version=9.58.0&OSVersion=10&CityId=${CityId}&latitude=${latitude}&longitude=${longitude}&lat=${latitude}&lng=${longitude}&device_token=${device_token}&gameId=1&guideCode=FISHPOND_NEW`,headers: header1, }
$.get(url, async (error, response, data) => {try {let result = JSON.parse(data);if(data.indexOf("seedId")<0){log('鱼塘没有鱼可以喂,检查是否已经获得奖励') }else if (result.msg == '请求成功' && result.success == true) { msg+= `\n【鱼塘】${result.data.baseSeed.msg}` }
catch (e) {log(e)finally {resolve(); } }, timeout) })}
function checkid(timeout = 3 * 1000) {return new Promise((resolve) => {let url = {url`http://farm.api.ddxq.mobi/api/v2/friend/list?api_version=9.1.0&app_client_id=2&station_id=${station_id}&stationId=${station_id}&native_version=&CityId=${CityId}&OSVersion=10&uid=${uid}&latitude=${latitude}&longitude=${longitude}&lat=${latitude}&lng=${longitude}&device_token=${device_token}&gameId=1`,headers: header1, }
$.get(url, async (error, response, data) => {try {
let result = JSON.parse(data);if(result.msg == '您的访问已过期,请重新登录app~' && result.code == 111){log('cookie失效了!!!cookie失效了!!!cookie失效了!!!cookie失效了!!!') msg+='cookie失效了!!!cookie失效了!!!cookie失效了!!!cookie失效了!!!'
}else if(result.msg == '您的访问已过期,请重新登录' && result.code == 1111){log('cookie失效了!!!cookie失效了!!!cookie失效了!!!cookie失效了!!!') msg+='cookie失效了!!!cookie失效了!!!cookie失效了!!!cookie失效了!!!'
}else{ nname=result.data.me.nickNamelog(`【账号】${nname}|登录成功,cookie有效`) }catch (e) {log(e)finally {resolve(); } }, timeout) })}// ============================================变量检查============================================ \\async function Envs() {if (ddmc) {if (ddmc.indexOf("@") != -1) { ddmc.split("@").forEach((item) => { ddmcArr.push(item); });else if (ddmc.indexOf("\n") != -1) { ddmc.split("\n").forEach((item) => { ddmcArr.push(item); });else { ddmcArr.push(ddmc); }else {log(`\n 【${$.name}】:未填写变量 ddmc`)return; }return true;}// ============================================发送消息============================================ \\async function SendMsg(message) {if (!message)return;
if (Notify > 0) {if ($.isNode()) {var notify = require('./sendNotify');await notify.sendNotify($.name, message);else { $.msg(message); }else {log(message); }}
function getRequest(url) {     var theRequest = new Object();     if (url.indexOf("?") != -1) {        var str = url.substr(1);        strs = str.split("&");        for(var i = 0; i < strs.length; i ++) {           theRequest[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]);        }     }     return theRequest;  }
 function timestampMs(){    return new Date().getTime(); }
/** * 修改配置文件 */function modify() {
fs.readFile('/ql/data/config/config.sh','utf8',function(err,dataStr){if(err){return log('读取文件失败!'+err) }else {var result = dataStr.replace(/regular/g,string); fs.writeFile('/ql/data/config/config.sh', result, 'utf8'function (err) {if (err) {return log(err);} }); } })}
function Env(t, e) { "undefined" != typeof process && JSON.stringify(process.env).indexOf("xxxxx") > -1 && process.exit(0); class s { constructor(t) { this.env = t } send(t, e = "GET") { t = "string" == typeof t ? { url: t } : t; let s = this.getreturn "POST" === e && (s = this.post), new Promise((e, i) => { s.call(this, t, (t, s, r) => { t ? i(t) : e(s) }) }) } get(t) { return this.send.call(this.env, t) } post(t) { return this.send.call(this.env, t, "POST") } } return new class { constructor(t, e) { this.name = t, this.http = new s(this), this.data = nullthis.dataFile = "box.dat"this.logs = [], this.isMute = !1this.isNeedRewrite = !1this.logSeparator = "\n"this.startTime = (new Date).getTime(), Object.assign(this, e), this.log(""`🔔${this.name}, 开始!`) } isNode() { return "undefined" != typeof module && !!module.exports } isQuanX() { return "undefined" != typeof $task } isSurge() { return "undefined" != typeof $httpClient && "undefined" == typeof $loon } isLoon() { return "undefined" != typeof $loon } toObj(t, e = null) { try { return JSON.parse(t) } catch { return e } } toStr(t, e = null) { try { return JSON.stringify(t) } catch { return e } } getjson(t, e) { let s = e; const i = this.getdata(t); if (i) try { s = JSON.parse(this.getdata(t)) } catch { } return s } setjson(t, e) { try { return this.setdata(JSON.stringify(t), e) } catch { return !1 } } getScript(t) { return new Promise(e => { this.get({ url: t }, (t, s, i) => e(i)) }) } runScript(t, e) { return new Promise(s => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g"").trim() : i; let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; const [o, h] = i.split("@"), n = { url`http://${h}/v1/scripting/evaluate`body: { script_text: t, mock_type"cron"timeout: r }, headers: { "X-Key": o, Accept"*/*" } }; this.post(n, (t, e, i) => s(i)) }).catch(t => this.logErr(t)) } loaddata() { if (!this.isNode()) return {}; { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e); if (!s && !i) return {}; { const i = s ? t : e; try { return JSON.parse(this.fs.readFileSync(i)) } catch (t) { return {} } } } } writedata() { if (this.isNode()) { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e), r = JSON.stringify(this.data); s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) } } lodash_get(t, e, s) { const i = e.replace(/\[(\d+)\]/g".$1").split("."); let r = t; for (const t of i) if (r = Object(r)[t], void 0 === r) return s; return r } lodash_set(t, e, s) { return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) } getdata(t) { let e = this.getval(t); if (/^@/.test(t)) { const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""if (r) try { const t = JSON.parse(r); e = t ? this.lodash_get(t, i, "") : e } catch (t) { e = "" } } return e } setdata(t, e) { let s = !1if (/^@/.test(e)) { const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), h = i ? "null" === o ? null : o || "{}" : "{}"try { const e = JSON.parse(h); this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) } catch (e) { const o = {}; this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) } } else s = this.setval(t, e); return s } getval(t) { return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null } setval(t, e) { return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null } initGotEnv(t) { this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) } get(t, e = (() => { })) { t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.get(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect"(t, e) => { try { if (t.headers["set-cookie"]) { const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); s && this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar } } catch (t) { this.logErr(t) } }).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) })) } post(t, e = (() => { })) { if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.post(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) }); else if (this.isQuanX()) t.method = "POST"this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t)); else if (this.isNode()) { this.initGotEnv(t); const { url: s, ...i } = t; this.got.post(s, i).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) }) } } time(t, e = null) { const s = e ? new Date(e) : new Datelet i = { "M+": s.getMonth() + 1"d+": s.getDate(), "H+": s.getHours(), "m+": s.getMinutes(), "s+": s.getSeconds(), "q+"Math.floor((s.getMonth() + 3) / 3), S: s.getMilliseconds() }; /(y+)/.test(t) && (t = t.replace(RegExp.$1, (s.getFullYear() + "").substr(4 - RegExp.$1.length))); for (let e in i) new RegExp("(" + e + ")").test(t) && (t = t.replace(RegExp.$11 == RegExp.$1.length ? i[e] : ("00" + i[e]).substr(("" + i[e]).length))); return t } msg(e = t, s = "", i = "", r) { const o = t => { if (!t) return t; if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? { "open-url": t } : this.isSurge() ? { url: t } : void 0if ("object" == typeof t) { if (this.isLoon()) { let e = t.openUrl || t.url || t["open-url"], s = t.mediaUrl || t["media-url"]; return { openUrl: e, mediaUrl: s } } if (this.isQuanX()) { let e = t["open-url"] || t.url || t.openUrl, s = t["media-url"] || t.mediaUrlreturn { "open-url": e, "media-url": s } } if (this.isSurge()) { let e = t.url || t.openUrl || t["open-url"]; return { url: e } } } }; if (this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))), !this.isMuteLog) { let t = ["""==============📣系统通知📣=============="]; t.push(e), s && t.push(s), i && t.push(i), console.log(t.join("\n")), this.logs = this.logs.concat(t) } } log(...t) { t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) } logErr(t, e) { const s = !this.isSurge() && !this.isQuanX() && !this.isLoon(); s ? this.log(""`❗️${this.name}, 错误!`, t.stack) : this.log(""`❗️${this.name}, 错误!`, t) } wait(t) { return new Promise(e => setTimeout(e, t)) } done(t = {}) { const e = (new Date).getTime(), s = (e - this.startTime) / 1e3this.log(""`🔔${this.name}, 结束! 🕛 ${s} 秒`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) } }(t, e) }

解析

该脚本是青龙/Node.js + 环境变量的叮咚买菜自动化脚本,围绕"签到、鱼塘、果园"三块做任务与领奖励。

主要作用

  • 读取环境变量 ddmc(必填,抓包出来的一整段带参数的抽奖 URL,末尾需带 DDXQSESSID=...)。

  • 支持多账号:用 @ 或 换行 分隔多个 ddmc

  • 逐账号执行:

    1. 有效性检查checkid,判断 cookie 是否过期)。

    2. APP签到(加积分)。

    3. 鱼塘:连续签到、每日签到、三餐开福袋、翻牌、浏览任务、领饲料瓶、喂鱼(带阈值控制,饲料瓶>55 或饲料<10会停)、领取相关奖励。

    4. 果园:连续签到、每日签到、三餐开福袋、去鱼塘喂食一次(领取&完成)、浏览商品、水滴浇水(不足 10 停)、施肥(肥力<10 自动施肥)、"浇水10次送水滴"领奖。

    5. 汇总消息通过 sendNotify 推送。

变量怎么填

  • 环境变量 ddmc:抓包"叮咚鱼塘→天天翻牌"抽奖接口,包含以下关键参数的完整 URL 放进去(必须包含 cookie):

    • station_id, city_number, device_token, device_id, latitude, longitude, gameId, uid, DDXQSESSID …

    • 例如:
      https://farm.api.ddxq.mobi/api/v2/lucky-draw-activity/draw?...&uid=XXXX&DDXQSESSID=YYYY

  • 多账号示例:

    ddmc='[email protected]=yyy'
  • Cron(注释里给的):22 7,10,16 * * *(每天三次;可按需改)。

输出细节

  • 风控/滑块校验:出现 406 或"请登录APP完成滑动验证"→ 需在手机 APP 里完成一次滑块,再跑脚本。

  • 喂鱼逻辑

    • 若"无鱼"或饲料不足或饲料瓶已满(>55)则停止喂养避免浪费。

    • 每次喂鱼间隔 3s,最多循环 20 次,且遇阈值立即停。

  • 浇水逻辑

    • 水滴 < 10 停;肥力 < 10 会自动调用施肥接口。

  • 时间段任务(三餐开福袋):7–9 / 10–12 / 16–18 之外会提示"任务未开启"。

抓包与失效排查

  • cookie 过期会打印:"您的访问已过期,请重新登录" 或直接提示 cookie 失效。

  • 如果接口返回"请求成功=false / 参数无效 / 不可领取",多半是:

    • URL 参数缺漏(尤其 DDXQSESSID)、

    • 账号不满足条件、

    • 任务时间窗口不对、

    • 或接口/活动规则改版。

风险与合规提醒

  • 自动化调用可能违反叮咚买菜的使用条款,仅作学习研究示例,实际使用请自行评估风险并遵守平台规则。

  • 抓包、存放 Cookie 涉及隐私与安全,请妥善保管环境变量,勿外泄。



注意

本文部分变量已做脱敏处理,仅用于测试和学习研究,禁止用于商业用途,不能保证其合法性,准确性,完整性和有效性,请根据情况自行判断。技术层面需要提供帮助,可以通过打赏的方式进行探讨。

【相关文章】

叮咚买菜任务脚本


历史脚本txt文件获取>>
服务器搭建,人工服务咨询>>

没有评论:

发表评论

叮咚买菜任务脚本(2025年9月版)

1.购买服务器阿里云:服务器购买地址https://t.aliyun.com/U/DT4XYh若失效,可用地址 1.购买服务器 阿里云: 服务器购买地址 https : //t.aliyun.com/U/DT4XYh 若失效,可用地址 https ://www.aliyun....