diff --git a/RanDongXiaJi.js b/RanDongXiaJi.js new file mode 100644 index 0000000..acb966b --- /dev/null +++ b/RanDongXiaJi.js @@ -0,0 +1,72 @@ +start(); +function start() { + auto.waitFor(); + app.launch("com.jingdong.app.mall"); + while (className("android.widget.Image").text("c143642ad0850f7a").findOnce() == null) { + toast("请进入活动界面"); + sleep(3000); + } + if (className("android.widget.Image").text("c143642ad0850f7a").exists()) { + toast("成功进入活动界面"); + sleep(3000); + while (textContains("运动+").exists()) { + textContains("运动+").findOnce().click(); + toast("收集运动卡币");sleep(1000); + } + while (textContains("任务+").exists()) { + textContains("任务+").findOnce().click(); + toast("收集任务卡币");sleep(1000); + } + } + doTask(); +} +//TODO:浏览小程序 +function doTask() { + className("android.widget.Image").text("c143642ad0850f7a").findOne().parent().click() + toast("打开任务界面"); + sleep(3000); + + //关键字作为任务类型 + var hasTask = true; + while (hasTask) { + if (textMatches(/.*[0-9]秒.*/).exists() && textMatches(/.*[0-9]秒.*/).findOnce().parent().child(8).text() == "去完成") { + textMatches(/.*[0-9]秒.*/).findOnce().parent().child(8).click(); + sleep(10000); + } else if (textContains("浏览加购").exists() && textContains("浏览加购").findOnce().parent().child(8).text() == "去完成") { + textContains("浏览加购").findOnce().parent().child(8).click(); + sleep(3000); + for (var i = 0; i < 5; i++) { + className("android.view.View").scrollable(true).depth(15).findOne().child(i).child(0).child(4).click(); + toast("加购第" + i + "个商品"); + sleep(3000); + back(); + sleep(3000); + } + toast("浏览加购完成,返回"); + } else if (textContains("浏览").exists() && textContains("浏览").findOnce().parent().child(8).text() == "去完成") { + textContains("浏览").findOnce().parent().child(8).click(); + sleep(3000); + toast("浏览完成,返回"); + } else if (textStartsWith("参与可得").exists() && textStartsWith("参与可得").findOnce().parent().child(8).text() == "去完成") { + textStartsWith("参与可得").findOnce().parent().child(8).click(); + sleep(3000); + toast("浏览完成,返回"); + }else if (textContains("成功入会").exists() && textContains("成功入会").findOnce().parent().child(8).text() == "去完成") { + textContains("成功入会").findOnce().parent().child(8).click(); + sleep(3000); + if(textContains("加入店铺会员").exists()){ + toast("脚本结束(涉及个人隐私,请手动加入店铺会员或者忽略加入会员任务)"); + break; + } + toast("浏览入会界面,获取金币"); + } + else { + toast("所有任务已完成,若有剩余可再启动一次脚本或手动完成"); + break; + } + sleep(1000);//给提示一个显示的时间 + back(); + sleep(3000); + } + +} \ No newline at end of file diff --git a/jd618.js b/jd618.js new file mode 100644 index 0000000..2856380 --- /dev/null +++ b/jd618.js @@ -0,0 +1,47 @@ +//点击做任务领金币 +run(); +function run() { + auto.waitFor(); + var appName = "com.jingdong.app.mall"; + var hasFoundDoTask = text("做任务领金币").findOnce(); + while (hasFoundDoTask == null) { + sleep(2000); + hasFoundDoTask = text("做任务领金币").findOnce(); + toast("请打开任务界面") + } + if (hasFoundDoTask != null) { + hasFoundDoTask.click(); + sleep(1000); + goFinish(); + } + // else { + // toast("未检测到任务,请打开任务界面,再执行脚本"); + // exit(); + // } +} +function goFinish() { + var tasks = text("去完成").find(); + for (var i = 1; i < tasks.length; i++) { + sleep(2000); + if (tasks[i] == null) { + continue; + } + tasks[i].click(); + sleep(8000); + while (true) { + if (textContains("逛精选").exists()) { + sleep(random(9000, 10000)); + //弹出关注时返回 + back(); + sleep(2000); + tasks[i].click(); + sleep(8000); + } + else { + back(); + break; + } + } + } + toast("任务完成"); +} \ No newline at end of file