diff --git a/test2.js b/test2.js
index e5643bb79de329525b6141bd22cc333b8390544d..45fdfee69232b966f61649c287c8566c9449917c 100644
--- a/test2.js
+++ b/test2.js
@@ -1 +1,15 @@
-console.log(currentActivity());
+if (files.cwd().endsWith("脚本")) {
+ let _require = require;
+ require = function (path) {
+ if (path.startsWith("./")) {
+ path = path.replace("./", "");
+ }
+ path = files.cwd() + "/gdt_hb/" + path;
+ return _require(path);
+ }
+}
+
+var utils = require("./utils.js");
+utils.waitAdvert("222");
+// console.log(currentActivity());
+// log(text("试玩游戏 领取奖励").findOne())
diff --git a/ttx.js b/ttx.js
index feae227e8ce2c66679536164354b54a5e9f90513..03c03738c1186cd21968eabd32a5ab5b6422b308 100644
--- a/ttx.js
+++ b/ttx.js
@@ -9,67 +9,26 @@ if (files.cwd().endsWith("脚本")) {
}
}
-
-auto.waitFor()
var utils = require("./utils.js");
-
-function viewSudokuVideoAndBack() {
- var i = 1;
- waitForActivity("com.bogokjvideo.video.ui.TaskTopicActivity", 200);
- while (text("看视频").findOne(2000) != null) {
- var finalActivity = currentActivity();
- text("看视频").findOne(2000).click();
- toastLog("观看第" + i + "个激励视频");
- utils.waitActivityChange();
- utils.waitAdvert(finalActivity);
- toastLog("观看第" + i + "个激励视频结束");
- sleep(2000);
- toastLog("点击我知道了");
- var 我知道了 = text("我知道了").findOne(60000);
- 我知道了 && 我知道了.click();
- console.log("点击: img_task_close");
-
- sleep(2000);
- var close_1 = id("img_task_close").findOne(60000)
- if (close_1) {
- utils.realClick(close_1);
- }
- waitForActivity("com.bogokjvideo.video.ui.TaskTopicActivity", 200);
- sleep(2000);
- i++
- }
- back();
-}
-
-function 观看咨询() {
-
- var 进度 = id("ocpv_progress").findOne(2000);
- while (进度 == null) {
- utils.swip_up();
- 进度 = id("ocpv_progress").findOne(2000);
- }
-
- while (id("ocpv_progress").findOne(2000) != null) {
- sleep(2000);
- }
-}
-
-
-var 新闻资讯 = text('新闻资讯').findOne(1000)
-toastLog("进行第二个任务:新闻资讯");
-if (新闻资讯) {
- var parent = 新闻资讯.parent().parent();
- var 去完成 = parent.findOne(text('去完成'))
- while (去完成) {
- 去完成.click();
- sleep(2000);
- 观看咨询();
- id("iv_back").findOne().click();
- var 我知道了 = text("我知道了").findOne(10000);
- 我知道了 && 我知道了.click();
- sleep(2000);
- 去完成 = parent.findOne(text('去完成'))
- }
-}
-toastLog("完成第二个任务:新闻资讯");
-
+var window = floaty.rawWindow(
+
+
+
+
+
+
+
+
+
+
+
+
+
+);
+window.exitOnClose();
+window.setSize(-1, -2);
+window.setPosition(0, 0)
+window.setTouchable(false);
+toast("长按确定键可调整位置");
+
+setInterval(()=>{}, 1000);
\ No newline at end of file
diff --git a/ui.js b/ui.js
index ac2f086dc9b6f282de2ba49c14e55a2ecbbc2c79..84a6dba8af1239dd9707e76342d12a405bc2ba96 100644
--- a/ui.js
+++ b/ui.js
@@ -8,6 +8,7 @@ var readApp = [];
//区块链app
var chainApp = [];
var showui = {};
+var floatyWindow;
const common = require("./common");
let run_time_limit = 3600; //默认一个小时
var storage = storages.create("xiangxiangyuedu");
@@ -58,6 +59,9 @@ showui.showMianUi = function () {
+
+
+
@@ -190,6 +194,8 @@ showui.showMianUi = function () {
ui.viewpager.setTitles(["设置", "区块链游戏", "区块链"]);
//让滑动页面和标签栏联动
ui.tabs.setupWithViewPager(ui.viewpager);
+ //显示控制台
+ // console.show();
//加载列表
threads.start(function () {
@@ -361,6 +367,31 @@ showui.showMianUi = function () {
menu.add("联众打码");
menu.add("输入激活码");
});
+
+
+ events.broadcast.on(utils.BROADCAST_APP_NAME, function(appName){
+ if(floatyWindow){
+ ui.run(function(){
+ floatyWindow.appName.setText("当前应用:" + appName);
+ });
+ }
+ });
+ events.broadcast.on(utils.BROADCAST_APP_PROGRESS, function(progress){
+ if(floatyWindow){
+ ui.run(function(){
+ floatyWindow.cur_progress.setProgress(progress);
+ });
+ }
+
+ });
+ events.broadcast.on(utils.BROADCAST_GLOBAL_PROGRESS, function(progress){
+ if(floatyWindow){
+ ui.run(function(){
+ floatyWindow.total_progress.setProgress(progress);
+ });
+ }
+ });
+
//监听选项菜单点击
ui.emitter.on("options_item_selected", (e, item) => {
switch (item.getTitle()) {
@@ -445,12 +476,51 @@ showui.showMianUi = function () {
// sleep(1000);
// showui.验证();
sleep(3000);
- showui.run();
+ console.time("总耗时");
+ if(!floatyWindow){
+ floatyWindow = floaty.rawWindow(
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+ floatyWindow.exitOnClose();
+ floatyWindow.setSize(-1, -2);
+ floatyWindow.setPosition(0, 0)
+ floatyWindow.setTouchable(false);
+ }
+ var start = java.lang.System.currentTimeMillis();
+ var intervalId=0;
+ threads.start(function(){
+ intervalId= setInterval(()=>{
+ if(floatyWindow){
+ floatyWindow.runTime.setText("已运行时间:" + parseInt((java.lang.System.currentTimeMillis() - start) / 1000) + "秒");
+ }
+ }, 1000);
+ });
+ try {
+ showui.run();
+ }finally{
+ intervalId && clearInterval(intervalId)
+ }
+ console.timeEnd("总耗时");
});
});
-
-
+ //控制台
+ ui.openConsole.on("click", function () {
+ log('控制台');
+ ui.openConsole.isChecked()?console.show():console.hide();
+ });
// ui.jiebang.on("click", function () {
// showui.解除();
@@ -511,6 +581,7 @@ showui.yy_login = function (password) {
showui.run = function () {
+
var curPackage = currentPackage();
var apps = [];
if (ui.区块链任务.isChecked()) {
@@ -551,7 +622,7 @@ showui.run = function () {
storage.put("script_running_status", "running");
log("engines " + apps[i] + ".js");
toastLog("开始运行:"+apps[i]);
-
+ console.time(apps[i]);
try {
//发布独立app模式 视为正式版本
// if (curPackage == "com.asst.gdt") {
@@ -563,7 +634,12 @@ showui.run = function () {
// continue;
// }
// } else {
+
+ utils.updateAppName(apps[i]);
+ utils.updateGlobalProgress((i / apps.length) * 100);
+ utils.updateAppProgress(0);
engines_execscript = engines.execScriptFile("./" + apps[i] + ".js");
+
// }
currentApp = apps[i];
log(currentApp + " - 已经在执行中了")
@@ -571,15 +647,16 @@ showui.run = function () {
storage.put("script_running_status", "end");
}
script_wait(engines_execscript, run_time_limit);
+ console.timeEnd(apps[i]);
common.clears(); //恢复
}
currentApp = "";
} while (ui.loopExec.isChecked());
-
-
+
}
+
function script_wait(e, run_time_limit) {
//限制脚本运行时间, 配置时间内脚本没有运行完,则强制停止运行脚本
let stop_count = run_time_limit * 1000 / 10000;
diff --git a/utils.js b/utils.js
index 9703890f1f32a35e523e21271c684dde0e543bfc..e84ff9b761974bc148b6388decbafb6f931d7c64 100644
--- a/utils.js
+++ b/utils.js
@@ -3,6 +3,19 @@ var down = require("./lib/down.js");
let utils = {};
+utils.BROADCAST_APP_PROGRESS = "BROADCAST_APP_PROGRESS";
+utils.BROADCAST_APP_NAME = "BROADCAST_APP_NAME";
+utils.BROADCAST_GLOBAL_PROGRESS = "BROADCAST_GLOBAL_PROGRESS";
+utils.updateAppName= function(appName){
+ events.broadcast.emit(this.BROADCAST_APP_NAME, appName);
+}
+utils.updateAppProgress = function(progress){
+ events.broadcast.emit(this.BROADCAST_APP_PROGRESS, progress);
+}
+
+utils.updateGlobalProgress = function(progress){
+ events.broadcast.emit(this.BROADCAST_GLOBAL_PROGRESS, progress);
+}
//获取版本
utils.getVersion = function(pkg){
@@ -120,6 +133,27 @@ utils.near = function (base, nearSelect, layer) {
}
return result;
}
+utils.openScreenCapture = function(){
+ let thread1 = threads.start(function(){
+ toastLog("检查请求截屏!")
+ var began = text("立即开始").findOne();
+ if(began){
+ sleep(1000)
+ toastLog("发现请求截屏!");
+ began.click();
+ sleep(1000);
+ thread1.interrupt();
+ }
+ });
+ sleep(1000);
+ if(!requestScreenCapture()){
+ toastLog("请求截图失败!");
+ exit();
+ }
+ else{
+ toastLog("请求截图成功!");
+ }
+}
//等待currentActivity改变
utils.waitActivityChange = function(timeoutFun){
var cur = currentActivity();
@@ -143,7 +177,7 @@ utils.waitActivityChange = function(timeoutFun){
utils.waitAdvert = function (finalActivity) {
sleep(5000) ; //延迟5s 防止页面还未切换
while(currentActivity() !== finalActivity){
- console.log("waitAdvert.currentActivity:", currentActivity(), ",finalActivity:", finalActivity);
+ // console.log("waitAdvert.currentActivity:", currentActivity(), ",finalActivity:", finalActivity);
if(currentActivity() === "com.qq.e.ads.RewardvideoPortraitADActivity"){
var close = className("android.widget.ImageView").clickable().depth(5).drawingOrder(2).findOne(80000);
if(close){
@@ -153,6 +187,46 @@ utils.waitAdvert = function (finalActivity) {
return;
}
}
+ if(currentActivity() === "com.bytedance.sdk.openadsdk.activity.base.TTRewardVideoActivity"){
+ while (true) {
+ var close = id("tt_video_ad_close_layout").clickable().findOne(2000);
+ if (close) {
+ console.log("广告关闭成功:", currentActivity());
+ close.click();
+ return;
+ }
+ close = text("继续试玩").clickable().findOne(2000);
+ if (close) {
+ console.log("广告关闭成功:", currentActivity());
+ close.click();
+ sleep(1000);
+ var 试玩游戏 = text("试玩游戏 领取奖励").clickable().findOne(5000);
+ if(试玩游戏){
+ //关闭后 可以查找到 tt_video_ad_close_layout 按钮
+ 试玩游戏.click();
+ continue;
+ }
+ }
+ sleep(2000);
+ }
+ }
+ if (currentActivity() === "com.bytedance.sdk.openadsdk.activity.TTRewardExpressVideoActivity") {
+ while (true) {
+ var close = id("tt_video_ad_close_layout").clickable().findOne(2000);
+ if (close) {
+ console.log("广告关闭成功:", currentActivity());
+ close.click();
+ return;
+ }
+ close = text("放弃奖励").findOne(2000);
+ if (close) {
+ console.log("广告关闭成功:", currentActivity());
+ close.click();
+ return;
+ }
+ sleep(2000);
+ }
+ }
if (currentActivity() === "com.bytedance.sdk.openadsdk.activity.base.TTRewardExpressVideoActivity") {
while (true) {
var close = id("tt_video_ad_close_layout").clickable().findOne(2000);
@@ -173,7 +247,7 @@ utils.waitAdvert = function (finalActivity) {
if(currentActivity() === "com.android.systemui.recents.RecentsActivity"){
//TODO 界面异常 报警?
console.log("关闭广告失败.页面异常...");
- return;
+ // return;
}
back();
sleep(2000);
diff --git "a/\344\274\230\344\274\230\350\266\243\344\272\253.js" "b/\344\274\230\344\274\230\350\266\243\344\272\253.js"
deleted file mode 100644
index 8cd51343b397e59406c974cf4aef7583e8a0e16e..0000000000000000000000000000000000000000
--- "a/\344\274\230\344\274\230\350\266\243\344\272\253.js"
+++ /dev/null
@@ -1,120 +0,0 @@
-
-auto.waitFor();
-var storage = storages.create("xiangxiangyuedu");
-
-function launchAppEnhance(app_name) {
- let thread = threads.start(function () {
- toastLog("检查是否有打开权限!");
- while (true) {
- var allow = textContains("允许").findOne(5000);
- if (allow) {
- sleep(1000)
- toastLog("发现允许授权!");
- allow.click();
- sleep(1000);
- thread.interrupt();
- break;
- }
- }
- });
- sleep(1000);
- var result = launchApp(app_name);
- sleep(3000);
- thread.interrupt();
- return result;
-}
-
-
-function task(){
- sleep(10000)
- _down_move();//下滑刷新一下
- while(true){
- sleep(2000)
- var all = text('3-3').findOne(3000);
- log("all:" + all)
- if(all){
- toastLog('任务已完成');
- break;
- }
- sleep(2000)
- var tasks = className('android.view.View').clickable().depth(13).indexInParent("5").findOne(1000)
- if(tasks){
- tasks.click();
- sleep(60000);
- toastLog("广告中.")
- var ad_close = id('com.youyouquxiang.android:id/tt_video_ad_close').findOne(2000);
- if(ad_close){
- click(ad_close.bounds().centerX(), ad_close.bounds().centerY());
- sleep(2000);
- _down_move();//下滑刷新一下
- }else{
- click(random(640,650),random(118,125));
- sleep(3000);
- back();
- }
-
- }
- }
-}
-
-//向下滑
-function _down_move() {
- console.log("向下滑动")
- let x = device.width / 2
- , t = device.height * 4 / 5
- , b = device.height * 1 / 5
- sml_move(x, b, x, t, 200 + random(50, 100));
- sleep(1000);
-}
-
-function sml_move(qx, qy, zx, zy, time) {
- //仿真随机带曲线滑动: qx, qy, zx, zy, time 代表起点x,起点y,终点x,终点y,过程耗时单位毫秒
- var xxy = [time];
- var point = [
- { "x": qx, "y": qy },
- { "x": random(qx - 100, qx + 100), "y": random(qy, qy + 50) },
- { "x": random(zx - 100, zx + 100), "y": random(zy, zy + 50) },
- { "x": zx, "y": zy }
- ];
- for (let i = 0; i < 1; i += 0.01) {
- xxyy = [parseInt(bezier_curves(point, i).x), parseInt(bezier_curves(point, i).y)]
- xxy.push(xxyy);
- }
- gesture.apply(null, xxy);
-}
-
-function bezier_curves(cp, t) {
- cx = 3.0 * (cp[1].x - cp[0].x);
- bx = 3.0 * (cp[2].x - cp[1].x) - cx;
- ax = cp[3].x - cp[0].x - cx - bx;
- cy = 3.0 * (cp[1].y - cp[0].y);
- by = 3.0 * (cp[2].y - cp[1].y) - cy;
- ay = cp[3].y - cp[0].y - cy - by;
-
- tSquared = t * t;
- tCubed = tSquared * t;
- result = { "x": 0, "y": 0 };
- result.x = (ax * tCubed) + (bx * tSquared) + (cx * t) + cp[0].x;
- result.y = (ay * tCubed) + (by * tSquared) + (cy * t) + cp[0].y;
- return result;
-};
-
-
-
-function main() {
- let open_app = launchAppEnhance("优优趣享");
- if(open_app) {
- task()
- }
- else {
- toastLog("优优趣享开失败,请确认是否安装并授权打开!");
- }
- }
-
-try {
- main();
- } catch (error) {
- toastLog(error);
- }
-
- storage.put("script_running_status", "end");
\ No newline at end of file
diff --git "a/\345\207\271\351\237\263\347\237\255\350\247\206\351\242\221.js" "b/\345\207\271\351\237\263\347\237\255\350\247\206\351\242\221.js"
index f5d88ac17f3f371917d27da6d96db8afef60f158..3479b4c54d14ff369969a73b566fede192f1e277 100644
--- "a/\345\207\271\351\237\263\347\237\255\350\247\206\351\242\221.js"
+++ "b/\345\207\271\351\237\263\347\237\255\350\247\206\351\242\221.js"
@@ -136,6 +136,7 @@ function task() {
index++;
swip_up()
var 领钻石 = text('看广告领钻石').findOne(1000)
+
if (领钻石) {
var finalActivity = currentActivity();
领钻石.parent().click()
@@ -153,10 +154,7 @@ function task() {
sleep(time)
}
-
-
-
-
+ utils.updateAppProgress(20);
} else {
@@ -305,7 +303,7 @@ function myTask2() {
// sleep(3000);
// }
toastLog("结束第一个任务")
-
+ utils.updateAppProgress(30);
toastLog("开始第二个任务")
//阅读任务1次
@@ -328,7 +326,7 @@ function myTask2() {
// 等待阅读完毕();
toastLog("结束第二个任务")
-
+ utils.updateAppProgress(40);
@@ -348,7 +346,7 @@ function myTask2() {
sleep(5000);
}
}
-
+ utils.updateAppProgress(60);
@@ -373,7 +371,7 @@ function myTask2() {
toastLog("结束第三个任务")
-
+ utils.updateAppProgress(70);
toastLog("开始第四个任务")
//阅读任务1次
@@ -395,7 +393,7 @@ function myTask2() {
// 等待阅读完毕();
toastLog("结束第四个任务")
-
+ utils.updateAppProgress(80);
sleep(3000);
@@ -414,7 +412,7 @@ function myTask2() {
sleep(5000);
}
}
-
+ utils.updateAppProgress(100);
toast("执行完毕");
} else {
log("寻找我的按钮失败");
diff --git "a/\345\244\251\345\244\251\346\234\211\351\261\274\345\233\275\351\231\205\347\211\210.js" "b/\345\244\251\345\244\251\346\234\211\351\261\274\345\233\275\351\231\205\347\211\210.js"
index 1de14bfe8f48965ebe9617edf328c9c45ccfbcfe..cc1c494f7d43b3c14b114acfa752c6159f900a5a 100644
--- "a/\345\244\251\345\244\251\346\234\211\351\261\274\345\233\275\351\231\205\347\211\210.js"
+++ "b/\345\244\251\345\244\251\346\234\211\351\261\274\345\233\275\351\231\205\347\211\210.js"
@@ -119,7 +119,6 @@ function task(){
var finalActivity = currentActivity();
kp.click();
log("卡牌 翻牌..")
- sleep(5000);
utils.waitAdvert(finalActivity);
sleep(3000)
var lingqu = text("领取").findOnce();
diff --git "a/\346\213\211\346\211\213.js" "b/\346\213\211\346\211\213.js"
index 61c23fd470308a0aade540c23aefe98561266fbb..c15b02de59e849a061ae8e8ed0c5f824e812bccb 100644
--- "a/\346\213\211\346\211\213.js"
+++ "b/\346\213\211\346\211\213.js"
@@ -67,8 +67,8 @@ function swip_up() {
}
function task() {
- var 拉手 = text('拉手').findOne(20000)
- if (拉手) {
+ var 首页 = text('首页').findOne(20000)
+ if (首页) {
var index = 1
var count = 15
while (index <= count) {
@@ -77,6 +77,10 @@ function task() {
sleep(time)
toastLog("预计时长" + (random_time / 1000) + "秒~")
sleep(random_time)
+ var 金币 = className("android.widget.FrameLayout").clickable(true).depth(13).findOne(5000);
+ if(金币){
+ 金币.parent().parent().click();
+ }
swip_up()
index++
}
diff --git "a/\346\216\214\344\270\212\345\256\235\347\237\255\350\247\206\351\242\221.js" "b/\346\216\214\344\270\212\345\256\235\347\237\255\350\247\206\351\242\221.js"
index 8cd59f4ac679bebdd46a4e47ee3ece058b80c405..6b060cde8548f844e6af34a7bf64398f63f07e60 100644
--- "a/\346\216\214\344\270\212\345\256\235\347\237\255\350\247\206\351\242\221.js"
+++ "b/\346\216\214\344\270\212\345\256\235\347\237\255\350\247\206\351\242\221.js"
@@ -242,6 +242,7 @@ function task() {
utils.waitAdvert(finalActivity);
sleep(2000);
//TODO 领取龙珠
+ images.findImage()
back();
sleep(1000);
diff --git "a/\346\231\272\345\244\251\344\270\213.js" "b/\346\231\272\345\244\251\344\270\213.js"
index 1940190d3f4d5553e05835ff19995fbf8ceb4e9d..98fddb8ef7dfba1183f44419fb64b08e70699443 100644
--- "a/\346\231\272\345\244\251\344\270\213.js"
+++ "b/\346\231\272\345\244\251\344\270\213.js"
@@ -1,3 +1,5 @@
+
+
auto.waitFor()
var storage = storages.create("xiangxiangyuedu");
@@ -53,12 +55,20 @@ function 广告() {
}
}
+function doSwipe(){
+ swipe(500,720,64,720,500);
+}
+
function task() {
var 激励视频 = text('激励视频').findOne(20000)
if (激励视频) {
sleep(time)
var index = 0
- while (index < 5) {
+ while (index < 4) {
+ if(index == 3){//第三个视频之后左滑一段距离
+ doSwipe();
+ sleep(1000);
+ }
var 完成度 = text('完成度0/1').findOne(1000)
if (完成度) {
完成度.parent().parent().click()
diff --git "a/\350\266\243\347\272\246\346\203\240.js" "b/\350\266\243\347\272\246\346\203\240.js"
deleted file mode 100644
index dd30b6fd6ec6e71b0540cb328333b324d8c5058e..0000000000000000000000000000000000000000
--- "a/\350\266\243\347\272\246\346\203\240.js"
+++ /dev/null
@@ -1,121 +0,0 @@
-auto.waitFor()
-
-var storage = storages.create("xiangxiangyuedu");
-var time = random(2000, 3000)
-
-function launchAppEnhance(app_name) {
- let thread = threads.start(function () {
- toastLog("检查是否有打开权限!")
- while (true) {
- var allow = text("允许").findOne(5000)
- if (allow) {
- sleep(1000)
- toastLog("发现允许授权!")
- allow.click()
- sleep(1000)
- thread.interrupt()
- break
- }
- }
- })
- sleep(1000)
- var result = launchApp(app_name)
- sleep(3000)
- thread.interrupt()
- return result
-}
-
-// 点击控件坐标,控件的clickbale为false的时候
-function 点击控件(x) {
- var weight = x.bounds()
- click(weight.centerX(), weight.centerY())
-}
-
-function 广告() {
- let try_count = 13, close_btn = null;
- while (!close_btn) {
- if (try_count <= 0) {
- break
- }
- // 直到找到关闭按钮
- close_btn = idContains("ad_close").findOne(1000) ||
- className('android.widget.ImageView').clickable().depth(5).drawingOrder(2).findOne(1000)
- if (close_btn) {
- close_btn.click()
- sleep(time)
- break
- } else {
- try {
- 取消 = text("取消").findOne(500)
- if (取消) {
- 点击控件(取消)
- }
- } catch (error) { }
- try {
- 关闭 = text("关闭").findOne(500)
- if (关闭) {
- 点击控件(关闭)
- }
- } catch (error) { }
- try {//支付宝
- if (currentPackage() != 'com.quyuehui.cn') {
- toastLog('估计是进入支付宝页面了')
- sleep(2000)
- back()
- sleep(2000)
- 继续 = textStartsWith("继续").findOne(1000)
- if (继续) {
- 点击控件(继续)
- }
- var 每日任务 = text('每日任务').findOne(3000)
- if (每日任务) {
- break
- }
- }
- } catch (error) { }
- }
- try_count--
- sleep(2000)
- }
-}
-
-function task() {
- var 去完成 = text('去完成').findOne(20000)
- if (去完成) {
- 去完成.click()
- sleep(5000)
- var index = 0
- while (index < 2) {
- var 去完成 = text('去完成').findOne(2000)
- if (去完成) {
- 去完成.click()
- sleep(5000)
- var 今日任务 = text('今日任务').findOne(1000)
- if (!今日任务) {
- toastLog('当前是广告界面')
- 广告()
- sleep(time)
- }
- }
- index++
- }
- }
-}
-
-function main() {
- let open_app = launchAppEnhance("趣约惠");
- if (open_app) {
- task()
- }
- else {
- toastLog("趣约惠打开失败,请确认是否安装并授权打开!");
- }
-}
-
-try {
- main();
-} catch (error) {
- toastLog(error);
-}
-
-storage.put("script_running_status", "end");
diff --git "a/\351\223\276\346\221\212.js" "b/\351\223\276\346\221\212.js"
index 96a720e11772cbb08e12accbf5c1672cf3147e96..68b4b9624df1042aed4cdc19c850cbe6c183f80f 100644
--- "a/\351\223\276\346\221\212.js"
+++ "b/\351\223\276\346\221\212.js"
@@ -14,28 +14,6 @@ var utils = require("./utils.js");
var storage = storages.create("xiangxiangyuedu");
var time = random(2000, 3000)
-function openScreenCapture() {
- let thread1 = threads.start(function () {
- toastLog("检查请求截屏!")
- var began = text("立即开始").findOne();
- if (began) {
- sleep(1000)
- toastLog("发现请求截屏!");
- began.click();
- sleep(1000);
- thread1.interrupt();
- }
- });
- sleep(1000);
- if (!requestScreenCapture(false)) {
- toastLog("请求截图失败!");
- exit();
- }
- else {
- toastLog("请求截图成功!");
- }
- }
-
function launchAppEnhance(app_name) {
let thread = threads.start(function () {
@@ -116,17 +94,7 @@ function task(){
}
-
-function swapeToRead() {
- //滑动阅读新闻
- swipe(device.width / 2, device.height * 0.7 ,
- device.width / 2, device.height * 0.4, 1500);
-
- swipe(device.width / 2, device.height * 0.7 ,
- device.width / 2, device.height * 0.4, 1500);
- sleep(1000);
-}
-
+
function main() {
let open_app = launchAppEnhance("链摊");
diff --git "a/\351\223\276\346\267\230.js" "b/\351\223\276\346\267\230.js"
index 5e83f961b8e77629548b5202834e78fddad1d844..7fc7ac6a4a0603d845671ccde6e980dcfdc8537f 100644
--- "a/\351\223\276\346\267\230.js"
+++ "b/\351\223\276\346\267\230.js"
@@ -85,7 +85,6 @@ function 看视频(x) {
if (视频) {
toastLog('观看' + x + '视频')
var finalActivity = currentActivity();
- log("finalActivity:" + finalActivity)
var weight = 视频.parent().bounds()
click(weight.centerX(), weight.centerY())
sleep(5000)
@@ -130,9 +129,10 @@ function task() {
var 查看视频 = text('查看视频').findOne(2000)
arr = 查看视频.parent().parent().find(text('去完成'))
if (arr.length > 0) {
+ var finalActivity = currentActivity();
arr[0].click()
toastLog('当前是广告界面')
- 广告()
+ utils.waitAdvert(finalActivity);
sleep(time)
}
var 查看商家企业预入驻 = text('查看商家企业预入驻').findOne(2000)
diff --git "a/\351\262\234\347\273\277\346\234\211\345\223\201.js" "b/\351\262\234\347\273\277\346\234\211\345\223\201.js"
deleted file mode 100644
index 91c8971d5690b9f8af10e426ab5d07db36afd691..0000000000000000000000000000000000000000
--- "a/\351\262\234\347\273\277\346\234\211\345\223\201.js"
+++ /dev/null
@@ -1,373 +0,0 @@
-auto.waitFor()
-
-var storage = storages.create("xiangxiangyuedu");
-var time = random(2000, 3000)
-
-function launchAppEnhance(app_name) {
- let thread = threads.start(function () {
- toastLog("检查是否有打开权限!")
- while (true) {
- var allow = text("允许").findOne(5000)
- if (allow) {
- sleep(1000)
- toastLog("发现允许授权!")
- allow.click()
- sleep(1000)
- thread.interrupt()
- break
- }
- }
- })
- sleep(1000)
- var result = launchApp(app_name)
- sleep(3000)
- thread.interrupt()
- return result
-}
-
-function 广告() {
- let try_count = 13, close_btn = null;
- while (!close_btn) {
- if (try_count <= 0) {
- break
- }
- // 直到找到关闭按钮
- close_btn = idContains("ad_close").findOne(1000) ||
- className('android.widget.ImageView').clickable().depth(5).drawingOrder(2).findOne(1000)
- if (close_btn) {
- close_btn.click()
- sleep(time)
- break
- } else {
- try {
- 取消 = text("取消").findOne(500)
- if (取消) {
- 点击控件(取消)
- }
- } catch (error) { }
- try {
- 关闭 = text("关闭").findOne(500)
- if (关闭) {
- 点击控件(关闭)
- }
- } catch (error) { }
- try {//支付宝
- if (currentPackage() != 'com.lianshi.xianlvyoushi') {
- toastLog('估计是进入支付宝页面了')
- sleep(2000)
- back()
- sleep(2000)
- 继续 = textStartsWith("继续").findOne(1000)
- if (继续) {
- 点击控件(继续)
- }
- var 每日任务 = text('每日任务').findOne(3000)
- if (每日任务) {
- break
- }
- }
- } catch (error) { }
- }
- try_count--
- sleep(2000)
- }
- var 放弃奖励 = text("放弃奖励").findOne(1000);
- if(放弃奖励){
- 放弃奖励.click();
- }
-}
-
-// 随机向上滑动
-function swip_up() {
- var w = device.width
- var h = device.height
-
- function bezier_curves(cp, t) {
- cx = 3.0 * (cp[1].x - cp[0].x);
- bx = 3.0 * (cp[2].x - cp[1].x) - cx;
- ax = cp[3].x - cp[0].x - cx - bx;
- cy = 3.0 * (cp[1].y - cp[0].y);
- by = 3.0 * (cp[2].y - cp[1].y) - cy;
- ay = cp[3].y - cp[0].y - cy - by;
-
- tSquared = t * t;
- tCubed = tSquared * t;
- result = { "x": 0, "y": 0 };
- result.x = (ax * tCubed) + (bx * tSquared) + (cx * t) + cp[0].x;
- result.y = (ay * tCubed) + (by * tSquared) + (cy * t) + cp[0].y;
- return result;
- };
-
-
- function sml_move(qx, qy, zx, zy, time) {
- //仿真随机带曲线滑动: qx, qy, zx, zy, time 代表起点x,起点y,终点x,终点y,过程耗时单位毫秒
- var xxy = [time];
- var point = [
- { "x": qx, "y": qy },
- { "x": random(qx - 100, qx + 100), "y": random(qy, qy + 50) },
- { "x": random(zx - 100, zx + 100), "y": random(zy, zy + 50) },
- { "x": zx, "y": zy }
- ];
- for (let i = 0; i < 1; i += 0.08) {
- xxyy = [parseInt(bezier_curves(point, i).x), parseInt(bezier_curves(point, i).y)]
- xxy.push(xxyy);
- }
- gesture.apply(null, xxy);
- }
-
- sml_move(w / 2, h * 0.8 + h * random() * 0.1, w / 2, h * 0.15, 200 + 600 * random());
-}
-
-function 过滑块() {
- dragSlider()
- function dragSlider() {
- 滑块 = text('验证').findOne(5000)
- if (滑块) {
- sleep(time)
- toastLog("找到滑块")
- sleep(time)
- if (device.model == 'Redmi 8A') {
- 拖动滑块x = random(98, 158)
- 拖动滑块y = random(763, 823)
- var x = random(580, 600)
- }
- if (device.model == 'MI 5X') {
- 拖动滑块x = random(147, 237)
- 拖动滑块y = random(960, 1050)
- var x = random(880, 910)
- }
- if (x > -1) {
- randomSwipe(拖动滑块x, 拖动滑块y, x, 拖动滑块y)
- return true;
- } else {
- return false;
- console.log("识别有误,请确认是否在滑块界面");
- }
- }
- else {
- toastLog("没找到滑块")
- }
- }
-
- /**
- * 真人模拟滑动函数 (滑块滑动)
- * @param {起点x} sx
- * @param {起点y} sy
- * @param {终点x} ex
- * @param {终点y} ey
- */
- function randomSwipe(sx, sy, ex, ey) {
- //设置随机滑动时长范围
- var timeMin = 1000
- var timeMax = 3000
- //设置控制点极限距离
- var leaveHeightLength = 500
-
- //根据偏差距离,应用不同的随机方式
- if (Math.abs(ex - sx) > Math.abs(ey - sy)) {
- var my = (sy + ey) / 2
- var y2 = my + random(0, leaveHeightLength)
- var y3 = my - random(0, leaveHeightLength)
-
- var lx = (sx - ex) / 3
- if (lx < 0) { lx = -lx }
- var x2 = sx + lx / 2 + random(0, lx)
- var x3 = sx + lx + lx / 2 + random(0, lx)
- } else {
- var mx = (sx + ex) / 2
- var y2 = mx + random(0, leaveHeightLength)
- var y3 = mx - random(0, leaveHeightLength)
-
- var ly = (sy - ey) / 3
- if (ly < 0) { ly = -ly }
- var y2 = sy + ly / 2 + random(0, ly)
- var y3 = sy + ly + ly / 2 + random(0, ly)
- }
-
- //获取运行轨迹,及参数
- var time = [0, random(timeMin, timeMax)]
- var track = bezierCreate(sx, sy, x2, y2, x3, y3, ex, ey)
-
-
- log("随机控制点A坐标:" + x2 + "," + y2)
- log("随机控制点B坐标:" + x3 + "," + y3)
- log("随机滑动时长:" + time[1])
-
- //滑动
- gestures(time.concat(track))
- }
-
- /**
- * 计算滑动轨迹
- */
- function bezierCreate(x1, y1, x2, y2, x3, y3, x4, y4) {
- //构建参数
- var h = 100;
- var cp = [{ x: x1, y: y1 + h }, { x: x2, y: y2 + h }, { x: x3, y: y3 + h }, { x: x4, y: y4 + h }];
- var numberOfPoints = 100;
- var curve = [];
- var dt = 1.0 / (numberOfPoints - 1);
-
- //计算轨迹
- for (var i = 0; i < numberOfPoints; i++) {
- var ax, bx, cx;
- var ay, by, cy;
- var tSquared, tCubed;
- var result_x, result_y;
-
- cx = 3.0 * (cp[1].x - cp[0].x);
- bx = 3.0 * (cp[2].x - cp[1].x) - cx;
- ax = cp[3].x - cp[0].x - cx - bx;
- cy = 3.0 * (cp[1].y - cp[0].y);
- by = 3.0 * (cp[2].y - cp[1].y) - cy;
- ay = cp[3].y - cp[0].y - cy - by;
-
- var t = dt * i
- tSquared = t * t;
- tCubed = tSquared * t;
- result_x = (ax * tCubed) + (bx * tSquared) + (cx * t) + cp[0].x;
- result_y = (ay * tCubed) + (by * tSquared) + (cy * t) + cp[0].y;
- curve[i] = {
- x: result_x,
- y: result_y
- };
- }
-
- //轨迹转路数组
- var array = [];
- for (var i = 0; i < curve.length; i++) {
- try {
- var j = (i < 100) ? i : (199 - i);
- xx = parseInt(curve[j].x)
- yy = parseInt(Math.abs(100 - curve[j].y))
- } catch (e) {
- break
- }
- array.push([xx, yy])
- }
-
- return array
- }
-}
-
-function task() {
- var i = 0
- while (i < 10) {
- var 我 = text('我').findOne(1000)
- if (我) {
- toastLog('当前在首页')
- break
- }
- var 登录 = text('登录').findOne(1000)
- if (登录) {
- toastLog('当前是登录界面')
- var 请填写手机号 = text('请填写手机号').findOne(5000)
- if (请填写手机号) {
- sleep(time)
- 请填写手机号.click()
- sleep(time)
- if (device.model == 'Redmi 8A') {
- click(random(96, 663), random(748, 800))
- }
- if (device.model == 'MI 5X') {
- click(random(165, 800), random(565, 700))
- }
- }
- sleep(time)
- 登录.click()
- sleep(time)
- 过滑块()
- break
- }
- var 激活 = text('活力值已集满,是否激活刷宝').findOne(1000)
- if (激活) {
- break
- }
- i++
- }
- var 首页 = text('首页').findOne(5000)
- if (首页) {
- 首页.parent().click()
- }
- sleep(5000)
- var index = 1
- var count = 50
- while (index <= count) {
- var check_obj = text("活力值").findOne(1000);
- if (!check_obj) {
- toastLog("观看视频任务已经完成")
- sleep(time)
- break;
- }
- var random_time = random(9000, 11000)
- toastLog("观看第" + index + "/" + count + "个视频中...")
- sleep(time)
- toastLog("预计时长" + (random_time / 1000) + "秒~")
- sleep(random_time)
- swip_up()
- sleep(time)
- if (currentActivity() != 'com.lianshi.duanshipin.view.activity.MainActivity') {
- 广告()
- }
- index++
- }
-
- var 激活 = text('活力值已集满,是否激活刷宝').findOne(5000)
- if (激活) {
- var 确认 = text('确认').findOne(2000)
- if (确认) {
- 确认.click()
- var iv_cha = id('iv_cha').findOne(5000)
- if (iv_cha) {
- iv_cha.click()
- }
- var 我 = text('我').findOne(1000)
- if (!我) {
- toastLog('当前是广告界面')
- 广告()
- }
- }
- }
- var 确认 = text('确认').findOne(20000)
- if (确认) {
- 确认.click()
- 广告();
- var iv_cha = id('iv_cha').findOne(5000)
- if (iv_cha) {
- iv_cha.click()
- }
- var 我 = text('我').findOne(1000)
- if (!我) {
- toastLog('当前是广告界面')
- 广告()
- }
- }
-}
-
-function main() {
- let open_app = launchAppEnhance("鲜绿有品");
- if (open_app) {
- var thread_1 = threads.start(function () {
- toastLog("检查广告弹窗")
- while (true) {
- var widget = id("com.lianshi.xianlvyoushi:id/iv_cha").findOne(2000);
- if (widget) {
- widget.click()
- }
- }
- })
- task()
- thread_1.interrupt()
- }
- else {
- toastLog("鲜绿有品打开失败,请确认是否安装并授权打开!");
- }
-}
-
-try {
- main();
-} catch (error) {
- toastLog(error);
-}
-
-storage.put("script_running_status", "end");