Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
MonsterNone authored Oct 24, 2023
1 parent f9cf802 commit 73c1b6c
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 37 deletions.
44 changes: 22 additions & 22 deletions start.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const VERSION = '2023618-O'
const VERSION = '20231111-F'

if (!auto.service) {
toast('无障碍服务未启动!退出!')
Expand Down Expand Up @@ -153,7 +153,7 @@ try {
sleep(8000)
return findTask()
}
if (!(taskName.match(/|||||||||88||||||||||||穿||||||||||/) || content.match(/|/))) {
if (!(taskName.match(/|||||||||88||||||||||||穿||||||||||||||/) || content.match(/|/))) {
return [taskName, jumpButtons[i], content]
}
}
Expand All @@ -163,11 +163,15 @@ try {

function backToList() {
console.log('返回')
if (textContains('当前已有金币').exists()) {
console.log('已在任务列表')
return
}
back()
sleep(1000)
let flag = 0
for (let i = 0; i < 3; i++) {
if (!textContains('累计任务奖励').findOne(5000)) {
if (!textContains('当前已有金币').findOne(5000)) {
if (currentActivity() == 'com.taobao.tao.TBMainActivity') {
console.log('返回到了主页,请重新运行任务!')
quit()
Expand Down Expand Up @@ -262,7 +266,7 @@ try {
// console.log('请手动切换回主页面')
// device.cancelKeepingAwake()
// quit()
if (textContains('累计任务奖励').exists()) {
if (textContains('当前已有金币').exists()) {
console.log('店铺已主动返回,继续任务')
return
}
Expand All @@ -280,8 +284,8 @@ try {
function getCoin() {
console.log('获取喵币数量')
try {
let e = textContains('我的喵币').findOnce()
let num = e.text().match(/(\d*)/)[1]
let e = textContains('当前已有金币').findOnce()
let num = e.parent().child(2).child(1).text().match(/([\d\.]*)\//)[1]
console.log('当前共有', num, '喵币')
return num
} catch (err) {
Expand All @@ -295,7 +299,7 @@ try {
if (autoOpen) {
// 打开淘宝活动页面
console.log('正在打开淘宝...')
var url = 'pages.tmall.com/wow/z/hdwk/hd2023618/home?disableNav=YES&qd_from=tbsybutton'
var url = 'pages.tmall.com/wow/z/hdwk/d11fy24/singleplayer?disableNav=YES&qd_from=tbsybutton'

app.startActivity({
action: "VIEW",
Expand All @@ -304,23 +308,23 @@ try {
sleep(2000)

console.log('等待页面加载...')
textContains('赚猫币').findOne(20000)
textContains('戳我赚金币').findOne(20000)
console.log('准备打开任务列表')
// sleep(10000)

let c = textContains('赚猫币').findOne(20000)
let c = textContains('戳我赚金币').findOne(20000)
if (c) {
console.log('使用默认方法尝试打开任务列表')
sleep(1000)
c.click()
c.parent().parent().child(c.parent().parent().childCount()-2).click()
sleep(1000)
c.click()
console.log('已点击,未能打开建议手动点击一下任务列表。此问题并非bug,和网络以及设备性能有关。')
console.log('检测任务列表,准备进行二次尝试')
} else {
throw '无法找到任务列表入口'
}
if (!textContains('累计任务奖励').findOne(8000)) {
if (!textContains('当前已有金币').findOne(8000)) {
console.log('默认方式打开失败,二次尝试')
console.log('首先检测弹窗')
for (let i = 0; i < 2 && text('关闭').findOne(2000); i++) { // 关闭弹窗
Expand All @@ -330,20 +334,16 @@ try {
}
console.log('已试图自动关闭弹窗。有未能自动关闭的弹窗请手动关闭')
sleep(5000)
// let right = c.bounds().right
// let left = c.bounds().left
// let top = c.bounds().top
// let bottom = c.bounds().bottom
// click(random(right,left), random(top, bottom))
c = c.parent().parent().child(c.parent().parent().childCount()-2)
click(c.bounds().centerX(), c.bounds().centerY())
console.log('已点击,等待任务列表出现')
if (!textContains('累计任务奖励').findOne(8000)) {
if (!textContains('当前已有金币').findOne(8000)) {
throw '无法打开任务列表'
}
}
} else {
console.log('请在30秒内打开淘宝活动页,并打开任务列表')
if (textContains('累计任务奖励').findOne(30000)) {
if (textContains('当前已有金币').findOne(30000)) {
console.log('已打开,继续任务')
} else {
console.log('未能检测到任务列表,退出')
Expand Down Expand Up @@ -371,7 +371,7 @@ try {

if (awardButtons) {
for (var i = 0; i < awardButtons.length; i++) {
console.log('领取累计任务奖励')
console.log('领取当前已有金币')
awardButtons[i].click()
console.log('等待5秒再次领取...')
sleep(5000)
Expand All @@ -398,12 +398,12 @@ try {
liulan()
sleep(2000)
}
back()
backToList()
} else if (jumpButton[0].match(/.*.*|.*.*|.*.*|.*.*/)) {
console.log('进行' + jumpButton[0] + '任务,10秒后返回')
jumpButton[1].click()
sleep(10000)
back()
backToList()
} else if (jumpButton[0].match(//)) {
console.log('进行' + jumpButton[0] + '任务')
jumpButton[1].click()
Expand All @@ -414,7 +414,7 @@ try {
}
into.click()
liulan()
} else if (jumpButton[0].match(//)) {
} else if (jumpButton[0].match(/[^#]/)) {
console.log('进行' + jumpButton[0] + '任务')
jumpButton[1].click()
console.log('等待搜索')
Expand Down
37 changes: 22 additions & 15 deletions tb_huichang.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const VERSION = '2023618-P'
const VERSION = '20231111-F'

if (!auto.service) {
toast('无障碍服务未启动!退出!')
Expand Down Expand Up @@ -123,12 +123,12 @@ try {
} else {
throw '无法找到任务列表入口'
}
if (!textContains('task_detail').findOne(8000)) {
if (!textContains('O1CN01stVIJt1VSfFvIXWtd').findOne(8000)) {
console.log('默认方式打开失败,二次尝试')
console.log('首先检测弹窗')
try {
let anchor = textContains('O1CN01cR2RJh1DIRHl5jiO7').findOne(5000)
anchor.parent().child(4).child(0).click()
let anchor = textContains('O1CN010Zax611FU0Z5m6nnQ').findOne(5000)
anchor.parent().click()
sleep(2000)
console.log('领红包弹窗已关闭')
} catch (err) {
Expand All @@ -151,7 +151,7 @@ try {
// click(random(right,left), random(top, bottom))
click(c.bounds().centerX(), c.bounds().centerY())
console.log('已点击,等待任务列表出现')
if (!textContains('task_detail').findOne(8000)) {
if (!textContains('O1CN01stVIJt1VSfFvIXWtd').findOne(8000)) {
throw '无法打开任务列表'
}
}
Expand Down Expand Up @@ -246,11 +246,18 @@ try {
// TODO:
function backToList() {
console.log('返回上级')
if (idContains('node_2_icon').exists()) {
console.log('已在任务列表')
return
}
back()
sleep(1000)
if (!idContains('node_2_icon').findOne(5000)) {
console.log('似乎没有返回,二次尝试')
back()
for (let i = 0; i < 3; i++) {
if (!idContains('node_2_icon').findOne(5000)) {
console.log('似乎没有返回,二次尝试')
back()
} else {
break
}
}
sleep(1000)
}
Expand All @@ -261,13 +268,13 @@ try {

app.startActivity({
action: "VIEW",
data: "taobao://s.click.taobao.com/aPfWYGu"
data: "taobao://s.click.taobao.com/7qinv6u"
})
sleep(2000)

console.log('等待页面加载...')
} else {
console.log('请在30秒内打开淘宝做任务赢红包活动页 57¥ CZ0001 B0DHdLyJp6b¥ https://m.tb.cn/h.Uxt0Jyu')
console.log('请在30秒内打开淘宝做任务赢红包活动页 88¥ CZ3457 yRhaW1EFDJB¥ https://m.tb.cn/h.5SjTGhB')
}
if (!idContains('node_2_icon').findOne(30000)) {
console.log('未能检测到任务页,退出')
Expand All @@ -289,7 +296,7 @@ try {
console.log('领红包弹窗关闭失败。此问题不影响运行')
}
try {
idContains('CLOSE').findOnce(5000).click()
textContains('TB16l86YLb2gK0jSZK9XXaEgFXa').findOne(5000).click()
sleep(2000)
console.log('其他弹窗已关闭')
} catch (err) {
Expand All @@ -298,7 +305,7 @@ try {
}

console.log('检测任务列表是否打开')
if (textContains('task_detail').findOne(5000)) {
if (textContains('O1CN01stVIJt1VSfFvIXWtd').findOne(5000)) {
console.log('先关闭列表')
idContains('close_btn').findOnce().click()
sleep(2000)
Expand Down Expand Up @@ -326,7 +333,7 @@ try {
sleep(2000)
let count = jumpButton[0].match(/(\d*)/)[1]
console.log('等待页面')
if (!textContains('超红精选热卖').findOne(8000)) {
if (!textContains('精选热卖').findOne(8000)) {
throw '商品页面未加载'
}
try {
Expand Down Expand Up @@ -361,7 +368,7 @@ try {
if (textMatches(/|/).findOne(10000) || currentActivity() == 'com.taobao.android.detail.wrapper.activity.DetailActivity') {
console.log('商品打开成功,返回')
back()
if (!textContains('超红精选热卖').findOne(10000)) {
if (!textContains('精选热卖').findOne(10000)) {
console.log('似乎没有返回,二次尝试')
back()
}
Expand Down

0 comments on commit 73c1b6c

Please sign in to comment.