-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathalipay.js
More file actions
78 lines (76 loc) · 3.2 KB
/
alipay.js
File metadata and controls
78 lines (76 loc) · 3.2 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
// ----------------------------
// 脚本信息设定
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_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("未检测到「每周收益」按钮")
}
}
}