Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于定时任务 #50

Closed
yyylly opened this issue Jun 4, 2019 · 27 comments
Closed

关于定时任务 #50

yyylly opened this issue Jun 4, 2019 · 27 comments
Labels
Doubt 🛡️ 疑惑 Any doubts about this repository Enhancement 🛠️ 建议 New feature or request Obsolete 🕳️ 远古 Issue creater doesn't provide more specific information within a long time (often one month) Proposal 💡 方案 Issue creater's own proposal which may be really helpful

Comments

@yyylly
Copy link

yyylly commented Jun 4, 2019

我有个方案,并且已经得到初步实现。
1、基于大大的master分支(6月2号获取的代码),开启自动解锁(解锁时设置停止时间)
2、创建在autojs APP中创建定时任务。
3、修改Ant_Forest_Launcher.js文件代码
//增加全局变量
let setHours=0;
let setMinutes=0;

function antForest() {
//初始化
init();
//检查是否满足条件启动支付宝
launch();
checkLanguage();
//do while 是新增的。
do
{
debugInfo("还没到停止时间,继续运行!");
//收能量function
checkEnergy();
curTime = new Date();
sys_hours=curTime.getHours();
sys_minutes=curTime.getMinutes();
}
while(setHours>0&&setMinutes>0&&(setHours==sys_hours&&setMinutes>=sys_minutes||setHours>sys_hours))

//展示结果
showResult();
endProcess();

}

修改function:
function unlock() {
if (!unlock_module) {
messageAction("自动解锁功能无法使用", 3);
return messageAction("解锁模块未导入", 3, 0, 1);
}
let is_screen_on = unlock_module.is_screen_on;
current_app.is_screen_on = is_screen_on;
if (!is_screen_on && !config.auto_unlock_switch) {
messageAction("脚本无法继续", 4);
messageAction("屏幕关闭且自动解锁功能未开启", 8, 1, 1, 1);
}
if (!context.getSystemService(context.KEYGUARD_SERVICE).isKeyguardLocked()) return debugInfo("无需解锁");
debugInfo("尝试自动解锁");
unlock_module.unlock();
//设置全局变量(定时)值
setHours=14;
setMinutes=15;
debugInfo("自动解锁完毕");
}

@yyylly
Copy link
Author

yyylly commented Jun 4, 2019

上面会有个问题:运行到309秒左右就超时强制退出了。
原来是大大限制了线程超时时间的。考虑得好全面
threads.start(function () {
setTimeout(() => messageAction("超时强制退出", 8, 1, 0, "both_n"), +max * 60000);
});
debugInfo("单次运行最大超时设置完毕");

改下这里:max_running_time
let config = {
main_user_switch: false, // if you are multi-account user, you may specify a "main account" to switch
max_running_time: 30, // 1 <= x <= 30; running timeout each time; unit: minute; leave "false value" if you dislike limitation
};

@CJW0716
Copy link

CJW0716 commented Jun 4, 2019

我换了新手机后,红米k20pro 解锁不能成功,是因为那个滑动的距离问题吗

@yyylly
Copy link
Author

yyylly commented Jun 4, 2019

解锁的得问大大了。没有深入了解大大的code。 为了安全总体review了下才敢run,哈哈哈

@CJW0716
Copy link

CJW0716 commented Jun 4, 2019

那个解锁出现,“消除解锁页面页面提示层失败” 解不开锁怎么办

@VergLsm
Copy link

VergLsm commented Jun 4, 2019

@17839170745 你观察一下解锁是的动作,是不是点亮屏幕之后,划不开到密码解锁屏幕,如果是,调整时划动时长还是距离,一般可以解决

@CJW0716
Copy link

CJW0716 commented Jun 6, 2019

我把那个滑动距离时长调到最大了,还是解锁失败

@CJW0716
Copy link

CJW0716 commented Jun 10, 2019

1.6.25a4版本在哪里下载。那个解锁出现,“消除解锁页面页面提示层失败” 解不开锁怎么办

@VergLsm
Copy link

VergLsm commented Jun 10, 2019

@17839170745 找一下commit记录

@SuperMonster003
Copy link
Owner

@yyylly 首先非常感谢提出宝贵的修改意见和功能建议
master分支的更新比较慢 没有特殊需求的话 建议使用Ant_Forest分支做根基
看了下代码 大致是设置了 "时""分" 参数作为循环终止条件
只要没有到设定时间 一直循环
相当于循环收取
这个属于我预想开发的定时任务功能中的一部分
或许以后会找个时间集中开发出来吧
再次感谢

@SuperMonster003
Copy link
Owner

那个解锁出现,“消除解锁页面页面提示层失败” 解不开锁怎么办

@17839170745 可以试试换个主题 有些主题需要加速上滑才能划开解锁图层

@VergLsm
Copy link

VergLsm commented Jun 14, 2019

@SuperMonster003 这里有个小问题,解锁后需要等待差不多半分钟才开始打开支付宝采集,这个时间可调小一些吗?

@SuperMonster003
Copy link
Owner

@VergLsm 看看开发者测试模式有没有什么问题 再查看一下是否能看出是哪个步骤占据了大量时间

@VergLsm
Copy link

VergLsm commented Jun 14, 2019

@SuperMonster003

@SuperMonster003
Copy link
Owner

@VergLsm 图片看不到
不要使用内网FTP地址
ftp://192.168.1.7:2121/Pictures/Screenshots/S90614-17043983.jpg

@VergLsm
Copy link

VergLsm commented Jun 14, 2019

@SuperMonster003 emm,,我发现了,但是网络好像有问题,截图一直传失败,正在重试

@VergLsm
Copy link

VergLsm commented Jun 14, 2019

@SuperMonster003 日志没有明显提示,截图可以发你邮箱吗?实在传不上这里,没办法了,最近这个网络是真的很恶心

@SuperMonster003
Copy link
Owner

@VergLsm 收到图片 等我抽空分析一下解锁模块 看能不能确定问题

@VergLsm
Copy link

VergLsm commented Jun 16, 2019

@SuperMonster003 解锁等待问题确认已经修复。

@Gaara3
Copy link

Gaara3 commented Jun 26, 2019

请问有没有配合tasker实现定时收取的教程呀,小白跪谢

@xxTree
Copy link

xxTree commented Jun 27, 2019

上面会有个问题:运行到309秒左右就超时强制退出了。
原来是大大限制了线程超时时间的。考虑得好全面
threads.start(function () {
setTimeout(() => messageAction("超时强制退出", 8, 1, 0, "both_n"), +max * 60000);
});
debugInfo("单次运行最大超时设置完毕");

改下这里:max_running_time
let config = {
main_user_switch: false, // if you are multi-account user, you may specify a "main account" to switch
max_running_time: 30, // 1 <= x <= 30; running timeout each time; unit: minute; leave "false value" if you dislike limitation
};

按照你说的改了后没问题,就是不稳定,循环收取一段时间后可能会突然不动了 也不报错

@yyylly
Copy link
Author

yyylly commented Jun 27, 2019

上面会有个问题:运行到309秒左右就超时强制退出了。
原来是大大限制了线程超时时间的。考虑得好全面
threads.start(function () {
setTimeout(() => messageAction("超时强制退出", 8, 1, 0, "both_n"), +max * 60000);
});
debugInfo("单次运行最大超时设置完毕");
改下这里:max_running_time
let config = {
main_user_switch: false, // if you are multi-account user, you may specify a "main account" to switch
max_running_time: 30, // 1 <= x <= 30; running timeout each time; unit: minute; leave "false value" if you dislike limitation
};

按照你说的改了后没问题,就是不稳定,循环收取一段时间后可能会突然不动了 也不报错

这个我这里还真没发现呢。建议你开下开发者模式,看看能不能log一些内容下来

@xxTree
Copy link

xxTree commented Jun 27, 2019

上面会有个问题:运行到309秒左右就超时强制退出了。
原来是大大限制了线程超时时间的。考虑得好全面
threads.start(function () {
setTimeout(() => messageAction("超时强制退出", 8, 1, 0, "both_n"), +max * 60000);
});
debugInfo("单次运行最大超时设置完毕");

改下这里:max_running_time
let config = {
main_user_switch: false, // if you are multi-account user, you may specify a "main account" to switch
max_running_time: 30, // 1 <= x <= 30; running timeout each time; unit: minute; leave "false value" if you dislike limitation
};

如果有联系方式麻烦留一下,有问题请教

@yyylly
Copy link
Author

yyylly commented Jun 27, 2019

定时收

指定时间区间不停收取能量?

@xxTree
Copy link

xxTree commented Jun 27, 2019

定时收

指定时间区间不停收取能量?

是24小时不停

@yyylly
Copy link
Author

yyylly commented Jun 27, 2019

上面会有个问题:运行到309秒左右就超时强制退出了。
原来是大大限制了线程超时时间的。考虑得好全面
threads.start(function () {
setTimeout(() => messageAction("超时强制退出", 8, 1, 0, "both_n"), +max * 60000);
});
debugInfo("单次运行最大超时设置完毕");
改下这里:max_running_time
let config = {
main_user_switch: false, // if you are multi-account user, you may specify a "main account" to switch
max_running_time: 30, // 1 <= x <= 30; running timeout each time; unit: minute; leave "false value" if you dislike limitation
};

如果有联系方式麻烦留一下,有问题请教

建议你找仓库主人大大,我对底层不熟悉。谢谢。

@xxTree
Copy link

xxTree commented Jun 29, 2019

还有想问一下。那个收取的时候会停2到3秒再收取是不是哪里设置了sleep

@SuperMonster003
Copy link
Owner

已于 v1.8.0 加入定时循环功能 欢迎体验并反馈 此Issue暂时关闭
另外 @xxTree v1.8.0 已经解决了这个问题

@SuperMonster003 SuperMonster003 added the Doubt 🛡️ 疑惑 Any doubts about this repository label Nov 9, 2019
@SuperMonster003 SuperMonster003 added Enhancement 🛠️ 建议 New feature or request Obsolete 🕳️ 远古 Issue creater doesn't provide more specific information within a long time (often one month) Proposal 💡 方案 Issue creater's own proposal which may be really helpful labels Nov 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Doubt 🛡️ 疑惑 Any doubts about this repository Enhancement 🛠️ 建议 New feature or request Obsolete 🕳️ 远古 Issue creater doesn't provide more specific information within a long time (often one month) Proposal 💡 方案 Issue creater's own proposal which may be really helpful
Projects
None yet
Development

No branches or pull requests

6 participants