-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathtaobao.js
More file actions
88 lines (85 loc) · 3.62 KB
/
taobao.js
File metadata and controls
88 lines (85 loc) · 3.62 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
// ----------------------------
// 脚本信息设定
let task_name = "淘宝签到"
let app_name = "淘宝"
// ----------------------------
let common = require('common.js')
common.startLog(task_name)
common.runApp(app_name)
// ----------------------------
// 脚本自定义函数
getDailyGoldCoin()
common.openMainActivity(app_name)
bonusSign()
// ----------------------------
common.stopApp(app_name)
common.endLog(task_name)
home()
exit()
function getDailyGoldCoin() {
let detect_get_gold_coin_button = common.detectWidgetItem("desc", "领淘金币", "error", "normal")
if (detect_get_gold_coin_button) {
click(detect_get_gold_coin_button.bounds().centerX(), detect_get_gold_coin_button.bounds().centerY())
let detect_sign_button = common.detectWidgetItem("textContains", "点击签到", "none", "normal")
if (detect_sign_button) {
console.log("已进入领淘金币页面")
sleep(2000)
let detect_sign_button_second = common.detectWidgetItem("textContains", "点击签到", "none", "normal")
detect_sign_button_second.parent().click()
if (common.detectSuccessInfo("textContains", "明天可领")) {
console.log("已领取「淘金币」")
}
}
else {
let detect_already_sign_button = common.detectWidgetItem("textContains", "明天可领", "log", "normal")
if (detect_already_sign_button) {
console.log("今日的「淘金币」已领取过,无需重复领取")
}
else {
console.log("未检测到「签到领金币」按钮,「签到领金币」失败")
}
}
}
}
function bonusSign() {
let detect_sign_button = common.detectWidgetItem("desc", "红包签到", "error", "normal")
if (detect_sign_button) {
click(detect_sign_button.bounds().centerX(), detect_sign_button.bounds().centerY())
sleep(2000)
passVerify()
let detect_sign_immediately_button = common.detectWidgetItem("textContains", "立即签到", "none", "normal")
if (detect_sign_immediately_button) {
detect_sign_immediately_button.click()
let detect_close_popup_button = common.detectWidgetItem("text", "关闭", "none", "lite")
if (detect_close_popup_button) {
detect_close_popup_button.click()
console.log("检测到弹窗,已关闭弹窗")
}
let detect_sign_state = common.detectWidgetItem("textContains", "今天", "error", "normal")
if (detect_sign_state.parent().childCount() != 3) {
console.log("已领取「签到领现金」元宝")
}
else {
console.log("未检测到操作成功的控件信息,请之后尝试重新运行脚本")
}
}
let detect_click_bonus = common.detectWidgetItem("text", "点击领取", "error", "normal")
if (detect_click_bonus) {
detect_click_bonus.parent().parent().click()
console.log("已领取「签到领现金」元宝")
}
else {
console.log("未检测到「点击领取」按钮,请之后尝试重新运行脚本")
}
}
}
function passVerify() {
let detect_pass_verify_slider = common.detectWidgetItem("textContains", "向右滑动验证", "none", "lite")
if (detect_pass_verify_slider) {
console.log("当前检测到存在验证滑块页面")
setScreenMetrics(1080, 2412)
// swipe(183, 1662, 950, 1662, 1000);
common.sml_mov(183, 1662, 950, 1662, 1000)
console.log("已通过验证")
}
}