Repository navigation
Expand file tree
/
Copy pathalipay.js
More file actions
126 lines (124 loc) · 5.79 KB
/
Copy pathalipay.js
File metadata and controls
126 lines (124 loc) · 5.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
// ----------------------------
// 脚本信息设定
let task_name = "支付宝签到"
let app_name = "支付宝"
// ----------------------------
let common = require('common.js')
common.startLog(task_name)
common.runApp(app_name)
// ----------------------------
// 脚本自定义函数
getDailyPoints()
common.openMainActivity(app_name)
common.openMainActivity(app_name)
getDailyGoldBill()
// ----------------------------
common.stopApp(app_name)
common.endLog(task_name)
home()
exit()
function getDailyPoints() {
let detect_mine_button = common.detectWidgetItem("text", "我的", "error", "normal")
if (detect_mine_button) {
// 支付宝这个控件布局层次经常变动,故强制点击两次
detect_mine_button.parent().parent().click()
sleep(1000)
detect_mine_button.parent().click()
let detect_menbership_button = common.detectWidgetItem("text", "支付宝会员", "log", "lite")
if (detect_menbership_button) {
console.log("成功切换到「我的」页面")
detect_menbership_button.parent().click()
let detect_get_all_button = common.detectWidgetItem("text", "全部领取", "log", "lite")
if (detect_get_all_button) {
detect_get_all_button.click()
// 这个控件一直存在,无法检测是否真的有其他积分。当无其他积分时,APP本身会有气泡提示「网络异常」。
console.log("已领取「其他」积分")
}
let detect_daily_sign_button = common.detectWidgetItem("textContains", "今日签到", "none", "normal")
if (detect_daily_sign_button) {
detect_daily_sign_button.parent().click()
sleep(2000)
console.log("已领取「今日签到」积分")
}
else {
console.info("未检测到「今日签到」按钮,已经领取过「今日签到」积分")
}
}
else {
console.error("未成功切换到「我的」页面")
}
}
}
function getDailyGoldBill() {
let detect_mine_button = common.detectWidgetItem("text", "理财", "error", "normal")
if (detect_mine_button) {
detect_mine_button.parent().parent().click()
sleep(1000)
detect_mine_button.parent().click()
let detect_gold_button = common.detectWidgetItem("text", "黄金", "error", "normal")
if (detect_gold_button) {
detect_gold_button.parent().parent().click()
console.log("进入黄金页面")
sleep(2000)
// let detect_get_gold_button = common.detectWidgetItem("text", "黄金票", "none", "normal")
let detect_get_gold_welfare_button = common.detectWidgetItem("text", "黄金福利", "none", "normal")
// 寻找同级顺延第一个控件
let detect_get_gold_button = null
if (detect_get_gold_welfare_button) {
let parent_children = detect_get_gold_welfare_button.parent().children()
for (let i = 0; i < parent_children.length; i++) {
if (parent_children[i].text() == detect_get_gold_welfare_button.text()) {
if (i + 2 < parent_children.length) {
detect_get_gold_button = parent_children[i + 1]
}
break
}
}
}
if (detect_get_gold_button) {
detect_get_gold_button.click()
console.log("进入黄金票页面")
sleep(2000)
// TODO:实现点击「猜涨」按钮并不影响后续的操作
// setScreenMetrics(1080, 2412)
// common.sml_mov(900, 100, 910, 110, 1000)
// let detect_guess_increase_button = common.detectWidgetItem("text", "猜涨", "none", "normal")
// if (detect_guess_increase_button) {
// detect_guess_increase_button.click()
// console.log("点击「猜涨」按钮")
// sleep(2000)
// }
console.log("尝试直接点击「去签到」按钮进入黄金票签到页面")
click(150, 1650)
sleep(2000)
let detect_get_tomorrow_button = common.detectWidgetItem("textContains", "明日", "none", "normal")
if (detect_get_tomorrow_button) {
console.info("今天「黄金票」已领取过,无需领取")
}
else {
let detect_get_immediately_button = common.detectWidgetItem("textContains", "连签有奖", "error", "normal")
if (detect_get_immediately_button) {
detect_get_immediately_button.parent().click()
}
}
}
}
// let detect_weekly_profit_button = common.detectWidgetItem("id", "com.alipay.android.widget.fortunehome:id/weekly_profit_container", "none", "normal")
// if (detect_weekly_profit_button) {
// detect_weekly_profit_button.click()
// let detect_get_tomorrow_button = common.detectWidgetItem("textContains", "明日", "none", "normal")
// if (detect_get_tomorrow_button) {
// console.info("今天「黄金票」已领取过,无需领取")
// }
// else {
// let detect_get_immediately_button = common.detectWidgetItem("textContains", "连签有奖", "error", "normal")
// if (detect_get_immediately_button) {
// detect_get_immediately_button.parent().click()
// }
// }
// }
// else {
// console.error("未检测到「每周收益」按钮")
// }
}
}