Skip to content

Commit

Permalink
解决加购和浏览物品任务出现的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
czj2369 committed Oct 25, 2022
1 parent 89338fa commit 630329b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 14 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@

# 更新

2022年10月26日

1.【JD】解决加购和浏览物品任务出现的问题(另:已知暂时无法解决的操作,品牌墙活动)

2022年10月23日

1.【JD】解决卡在一个页面不动的情况
Expand Down
40 changes: 26 additions & 14 deletions auto_20221111/jd/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
* JD221111
*
* Author: czj
* Date: 2022/11/11
* Versions: 1.0.1
* Versions: 1.0.2
* Github: https://github.com/czj2369/jd_tb_auto
*/
const sleepTime = 500;
Expand Down Expand Up @@ -83,7 +82,7 @@ function init() {
* 进入活动界面
*/
function enterActivity() {
if (desc("浮层活动").exists() && text("购物车")) {
if (desc("浮层活动").exists() && text("购物车").exists()) {
const rect = desc("浮层活动").findOne().bounds();
click(rect.centerX(), rect.centerY());
sleep(500)
Expand All @@ -107,6 +106,11 @@ function enterActivity() {
*/
function clikcFinish() {

if (text("恭喜获得奖励").exists() || text("预约抽红包").exists() || text("继续环游").exists()) {
back();
sleep(1000);
}

if (textContains("去打卡").exists()) {
const daka = textContains("去打卡").findOne().bounds();
click(daka.centerX(), daka.centerY());
Expand All @@ -121,7 +125,7 @@ function clikcFinish() {
}

console.log("当前任务序号:", TASK_ID)
const button = text("去领取").exists() ? text("去领取").find()[0] : text("去完成").find()[TASK_ID];
const button = text("去完成").find()[TASK_ID];
if (button != undefined) {
const rect = button.bounds()
const parentButton = button.parent();
Expand All @@ -137,14 +141,15 @@ function clikcFinish() {
}
}
//sleep(2000);
if (click(rect.centerX(), rect.centerY()) && click(rect.centerX(), rect.centerY())) {
if (click(rect.centerX(), rect.centerY())) {
console.log("点击去完成");
// 计时器重置
JUDGE_TIME = 0;
sleep(3000);
return true;
}
}
return false;
}

/**
Expand Down Expand Up @@ -227,7 +232,11 @@ function viewProduct() {
const ret = list[0].bounds();
if (click(ret.centerX(), ret.centerY())) {
sleep(2000);
back();
while (text("购物车").exists()) {
sleep(2000);
back();
break;
}
sleep(2000);
}
back();
Expand All @@ -246,7 +255,11 @@ function addCarTask() {
console.log("浏览4个商品任务");
if (clickCenterXY(315, 1098, 501, 1182)) {
sleep(2000);
back();
while (text("购物车").exists()) {
sleep(2000);
back();
break;
}
sleep(2000);
}
back();
Expand Down Expand Up @@ -360,10 +373,9 @@ function recoverApp() {
}
}
/**
* JD221111
*
* Author: czj
* Date: 2022/11/11
* Versions: 1.0.1
* Github: https://github.com/czj2369/jd_tb_auto
*/
* JD221111
*
* Author: czj
* Versions: 1.0.2
* Github: https://github.com/czj2369/jd_tb_auto
*/

0 comments on commit 630329b

Please sign in to comment.