Skip to content
This repository has been archived by the owner on Feb 18, 2022. It is now read-only.

Commit

Permalink
v2.6.7
Browse files Browse the repository at this point in the history
- 为部分组件增加了随机性
  • Loading branch information
lolisaikou committed Aug 16, 2020
1 parent bdc178f commit 3718c1b
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 39 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## 当前程序版本:2.6.6
## 当前程序版本:2.6.7
**为部分组件增加了随机性,所以学习时间可能会增加哦**
**现在满分为42哦(除了每日和专项答题)**
因为刚刚上线,所以`commit`有点多,更新也比较频繁,经常是想到哪改到哪,所以请多包涵,有问题可以提`issue`

Expand Down Expand Up @@ -32,6 +33,13 @@


## 版本更新
- 2020.08.16
主页增加随机背景 [#29](https://github.com/lolisaikou/LazyStudy/issues/29)
为部分函数增加了随机性(提高安全性)
~~大概~~修复听广播卡住的问题 [#27](https://github.com/lolisaikou/LazyStudy/issues/27)
现在更新题库会正常显示更新了多少道题(不会再显示更新了undefined道题) [#20](https://github.com/lolisaikou/LazyStudy/issues/20)
修改学习顺序,减少不必要的流程
***
- 2020.08.14
跟进了最新版的积分规则
修复一些小问题
Expand Down
6 changes: 4 additions & 2 deletions UI.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ ui.layout(
</appbar>
<viewpager id="viewpager">
<frame>
<text textSize="16sp" textColor="red" text="v2.6.6" />
<img src={"https://api.ixiaowai.cn/gqapi/gqapi.php?" + new Date().getTime()} scaleType="centerCrop" alpha="0.3" />
<text textSize="16sp" textColor="red" text="v2.6.7" />
<button id="amsw" text="阅读模式选择" layout_gravity="right|top" w="auto" h="auto" circle="true"/>
<button id="showFloating" text="打开悬浮窗" w="150" h="60" circle="true" layout_gravity="center" style="Widget.AppCompat.Button.Colored" />
</frame>
Expand Down Expand Up @@ -305,7 +306,8 @@ ui.updateTikuNet.click(() => {
var ss = "./updateTikuNet.js";
let begin = require(ss);
var resultNum = begin();
var resultStr = "更新" + resultNum + "道题!";
var resultStr = "更新了" + resultNum + "道题!";
log("更新了" + resultNum + "道题!")
ui.run(() => {
ui.resultLabel.setText("");
ui.pbar.setVisibility(View.INVISIBLE);
Expand Down
8 changes: 6 additions & 2 deletions updateTikuNet.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,12 @@ function updateTikunet() {
log('题库下载完毕,', util.format("题目总数:%s"), liArray.size());
//执行更新
log("开始更新数据库...");
CreateAndInsert(liArray)
log("数据库更新完毕!");
if (CreateAndInsert(liArray)) {
log("数据库更新完毕!");
return liArray.size();
} else {
return -1;
}
}
//updateTikunet();
module.exports = updateTikunet;
Expand Down
80 changes: 46 additions & 34 deletions xxqg_v3.1.3.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ var aCount = 6;//文章默认学习篇数
var vCount = 6;//小视频默认学习个数
var cCount = 2;//收藏+分享+评论次数

var aTime = 65;//有效阅读一分钟1分*6
var aTime = 70;//有效阅读一分钟1分*6
var vTime = 15;//每个小视频学习-15秒
var rTime = 370;//广播收听6分 * 60 = 360秒

Expand All @@ -84,7 +84,7 @@ var myScores = {};//分数
* @return: null
*/
function delay(seconds) {
sleep(1000 * seconds);//sleep函数参数单位为毫秒所以乘1000
sleep(1000 * seconds + randomNum(0, 500));//sleep函数参数单位为毫秒所以乘1000
}


Expand All @@ -94,6 +94,7 @@ function delay(seconds) {
* @return: null
*/
function article_timing(n, seconds) {
seconds = seconds + randomNum(0, 10)
h = device.height;//屏幕高
w = device.width;//屏幕宽
x = (w / 3) * 2;
Expand All @@ -109,7 +110,7 @@ function article_timing(n, seconds) {
{
console.info("第" + (n + 1) + "篇文章已经学习" + (i + 1) + "秒,剩余" + (seconds - i - 1) + "秒!");
}
delay(1);
sleep(1000);
if (i % 10 == 0)//每10秒滑动一次,如果android版本<7.0请将此滑动代码删除
{
toast("这是防息屏toast,请忽视-。-");
Expand All @@ -135,7 +136,7 @@ function video_timing_bailing(n, seconds) {
console.error("当前已离开第" + (n + 1) + "个百灵小视频界面,请重新返回视频");
delay(2);
}
delay(1);
sleep(1000);
console.info("第" + (n + 1) + "个小视频已经观看" + (i + 1) + "秒,剩余" + (seconds - i - 1) + "秒!");
}
}
Expand All @@ -146,8 +147,9 @@ function video_timing_bailing(n, seconds) {
* @return: null
*/
function video_timing_news(n, seconds) {
seconds = seconds + randomNum(0, 10)
for (var i = 0; i < seconds; i++) {
delay(1);
sleep(1000);
while (!textContains("欢迎发表你的观点").exists())//如果离开了联播小视频界面则一直等待
{
console.error("当前已离开第" + (n + 1) + "个新闻小视频界面,请重新返回视频");
Expand All @@ -164,7 +166,7 @@ function video_timing_news(n, seconds) {
*/
function radio_timing(r_time, seconds) {
for (var i = 0; i < seconds; i++) {
delay(1);
sleep(1000);
if (i % 5 == 0)//每5秒打印一次信息
{
console.info("广播已经收听" + (i + 1 + r_time) + "秒,剩余" + (seconds - i - 1) + "秒!");
Expand Down Expand Up @@ -396,17 +398,20 @@ function listenToRadio() {
click("听新闻广播");
delay(2);
while (!(textContains("正在收听").exists() || textContains("最近收听").exists() || textContains("推荐收听").exists())) {
log("等待加载")
delay(1)
log("等待加载");
delay(1);
}
if (click("最近收听") == 0) {
if (click("推荐收听") == 0) {
click("正在收听")
click("正在收听");
}
}
console.log("正在收听广播...");
delay(1);
back();//返回电台界面
delay(2);
if (id("btn_back").findOne().click() == 0) {
delay(2);
back();//返回电台界面
}
delay(2);
}


Expand Down Expand Up @@ -440,8 +445,8 @@ function start_app() {
*/
function localChannel() {
delay(1)
desc("学习").click();
while (!desc("学习").exists());//等待加载出主页
desc("学习").click();
console.log("点击本地频道");
if (text("新思想").exists()) {
text("新思想").findOne().parent().parent().child(3).click();
Expand Down Expand Up @@ -490,10 +495,13 @@ function getScores() {
console.log(myScores);

aCount = Math.ceil((12 - myScores["我要选读文章"]) / 2); //文章个数
if (aCount != 0) {
aCount = aCount + randomNum(0, 1)
}
vCount = 6 - myScores["视听学习"];
rTime = (6 - myScores["视听学习时长"]) * 60;
asub = 2 - myScores["订阅"];
sCount = 2 - myScores["分享"]
sCount = 2 - myScores["分享"] * 2
cCount = 1 - myScores["发表观点"]

console.log('评论:' + cCount.toString() + '个')
Expand All @@ -515,20 +523,25 @@ function getScores() {
@return: null
*/
function stopRadio() {
console.log("停止收听广播!");
click("电台");
delay(1);
click("听新闻广播");
delay(2);
while (!(textContains("正在收听").exists() || textContains("最近收听").exists() || textContains("推荐收听").exists())) {
log("等待加载")
log("等待加载");
delay(2)
}
if (click("正在收听") == 0) {
click("最近收听")
click("最近收听");
}
delay(3);
id("v_play").findOnce(0).click()
back()
id("v_play").findOnce(0).click();
delay(2)
if (id("btn_back").findOne().click() == 0) {
delay(2);
back();
}
}

/**
Expand All @@ -548,7 +561,6 @@ function sub() {
click("强国号", 0)
let sublist = className("ListView").findOnce(0);
var i = 0;
var t = 0;
while (i < asub) {
let object = desc("订阅").find();
if (!object.empty()) {
Expand Down Expand Up @@ -590,8 +602,9 @@ function sub() {
})
} else if (text("你已经看到我的底线了").exists()) {
console.log("没有可订阅的强国号了,退出!!!")
t++;// 如果全部都被订阅t++,让父循环结束
break;
back();
delay(2);
return;
} else {
delay(1);
sublist.scrollForward();
Expand All @@ -601,43 +614,42 @@ function sub() {
delay(1);
sublist.scrollForward();
}
if (t >= 1) {
break;
}
}
back();
delay(2);
}

//主函数
function main() {
start_app();//启动app
var path = files.path("list.db");
var start = new Date().getTime();//程序开始时间
getScores();//获取积分
if (myScores['订阅'] != 2) {
sub();//订阅
}
if (rTime != 0) {
listenToRadio();//听电台广播
}
var r_start = new Date().getTime();//广播开始时间
articleStudy();//学习文章,包含点赞、分享和评论
if (rTime != 0) {
listenToRadio();//继续听电台
if (myScores['订阅'] != 2) {
sub();//订阅
}
if (myScores['挑战答题'] != 6) {
challengeQuestion();//挑战答题
}
if (myScores['每日答题'] != 6) {
dailyQuestion();//每日答题
}
articleStudy();//学习文章,包含点赞、分享和评论
var end = new Date().getTime();//广播结束时间
var radio_time = (parseInt((end - r_start) / 1000));//广播已经收听的时间
radio_timing(parseInt((end - r_start) / 1000), rTime - radio_time);//广播剩余需收听时间
if (rTime != 0) {
stopRadio();
}
if (myScores['本地频道'] != 1) {
localChannel();//本地频道
}
if (vCount != 0) {
videoStudy_news();//看视频
}
if (rTime != 0) {
stopRadio();//停止广播
}
end = new Date().getTime();
console.log("运行结束,共耗时" + (parseInt(end - start)) / 1000 + "秒");
files.copy(path, "/sdcard/Download/list.db");
Expand Down

0 comments on commit 3718c1b

Please sign in to comment.