haptear 4 years ago
parent
commit
e5f9a65b96
  1. 60
      zq/zq.js
  2. 16
      zq/zqkkz.js

60
zq/zq.js

@ -1,11 +1,11 @@
start();
function start() {
function start () {
auto.waitFor()
var appName = "com.jingdong.app.mall";
var appName = "cn.youth.news";
if (launch(appName)) {
console.info("启动中青看点");
console.info("启动中青看点");
}
console.show();
}
@ -15,42 +15,60 @@ function start() {
* @param {横坐标} x
* @param {纵坐标} y
*/
function randomClick(x, y) {
var rx = random(0, 5);
var ry = random(0, 5);
function randomClickObject (obj) {
var rx = 0;// random(0, 5);
var ry = 0;// random(0, 5);
click(x + rx, y + ry);
sleep(2000);
if (obj && obj.click) {
obj.click();
}
var rct = obj.bounds();
click(rct.centerX() + rx, rct.centerY() + ry);
click(rct.centerX() + rx, rct.centerY() + ry);
click(rct.centerX() + rx, rct.centerY() + ry);
return true;
}
auto();
sleep(1000);
console.show();
function getById (maxIndex, name) {
for (let index = 0; index < maxIndex; index++) {
console.verbose(index, name);
var t = id(name).findOnce();
if (t != undefined)
return t;
sleep(500);
}
return null;
}
for (var i = 1; i < 500; i++) {
sleep(1000);
console.log("下滑!")
gesture(400, [520, 1550], [520, 450]);
sleep(1000);
var youth = id("ah5").className("android.widget.TextView").findOnce(1);
var youth = id("ah5").className("android.widget.TextView").findOnce(0)
|| id("a03").className("android.widget.LinearLayout").findOnce(0)
|| id("ail").className("android.widget.TextView").findOnce(0);
sleep(200);
if (youth == undefined)
youth = id("a03").className("android.widget.LinearLayout").findOnce(1);
if (youth == undefined) {
console.log(i, "未找到!")
continue;
}
try {
console.log(i, youth.text());
var youok = youth.bounds();
var a = youok.centerX();
var b = youok.centerY();
click(a, b);
randomClickObject(youth);
// var youok = youth.bounds();
// var a = youok.centerX();
// var b = youok.centerY();
// click(a, b);
sleep(1000);
back();
var taskBtn = getById(2, 'cn.youth.news:id/x8');
if (taskBtn == undefined)
back();
} catch (error) {
}
}

16
zq/zqkkz.js

@ -1,5 +1,5 @@
var allTasks = ['实时剧情', '朵朵浪花', '闪光热点', '阳光生活', '热点天下', '资讯播报'];
var allTasks = ['温暖生活', '实时剧情', '朵朵浪花', '闪光热点', '阳光生活', '热点天下', '资讯播报'];
let taskText = '';
start();
@ -18,9 +18,6 @@ function start () {
//看看赚
function kkz () {
//初始化时要忽略的任务
let taskText = '';
for (var i = 1; i < 50; i++) {
sleep(1000);
if (i % 5 == 0)
@ -87,7 +84,7 @@ function getTask (i) {
let task = tasks[index];
taskText = '';
let par = task.parent();
if (par && par.childCount() >=3) {
if (par && par.childCount() >= 3) {
let statusText = par.child(2).text();
//忽略已完成
if (statusText != '去完成' && statusText != '进行中')
@ -100,14 +97,11 @@ function getTask (i) {
continue;
}
console.log(1);
//还未处理过
if (allTasks.indexOf(taskText) > -1) {
console.log(2);
//console.log(" ", index, "已经处理的任务 ", taskText);
//console.log(" ", index, "已经处理的任务 ", taskText);
}
else {
console.log(3);
allTasks.push(taskText);
return task;
}
@ -160,8 +154,8 @@ function viewTask (task) {
else {
let linkText = link.text() || link.contentDescription || "";
linkText = linkText.length > 8 ? linkText.substring(0, 8) : linkText;
console.log(' ', i, "link ", linkText.length, " ", linkText);
console.log(' ', i, "link ", linkText);
if (linkText.indexOf && linkText.indexOf('广告') > -1) {
continue;
}

Loading…
Cancel
Save