Skip to content

Commit 73c1b6c

Browse files
authored
Add files via upload
1 parent f9cf802 commit 73c1b6c

File tree

2 files changed

+44
-37
lines changed

2 files changed

+44
-37
lines changed

start.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const VERSION = '2023618-O'
1+
const VERSION = '20231111-F'
22

33
if (!auto.service) {
44
toast('无障碍服务未启动!退出!')
@@ -153,7 +153,7 @@ try {
153153
sleep(8000)
154154
return findTask()
155155
}
156-
if (!(taskName.match(/|||||||||88||||||||||||穿||||||||||/) || content.match(/|/))) {
156+
if (!(taskName.match(/|||||||||88||||||||||||穿||||||||||||||/) || content.match(/|/))) {
157157
return [taskName, jumpButtons[i], content]
158158
}
159159
}
@@ -163,11 +163,15 @@ try {
163163

164164
function backToList() {
165165
console.log('返回')
166+
if (textContains('当前已有金币').exists()) {
167+
console.log('已在任务列表')
168+
return
169+
}
166170
back()
167171
sleep(1000)
168172
let flag = 0
169173
for (let i = 0; i < 3; i++) {
170-
if (!textContains('累计任务奖励').findOne(5000)) {
174+
if (!textContains('当前已有金币').findOne(5000)) {
171175
if (currentActivity() == 'com.taobao.tao.TBMainActivity') {
172176
console.log('返回到了主页,请重新运行任务!')
173177
quit()
@@ -262,7 +266,7 @@ try {
262266
// console.log('请手动切换回主页面')
263267
// device.cancelKeepingAwake()
264268
// quit()
265-
if (textContains('累计任务奖励').exists()) {
269+
if (textContains('当前已有金币').exists()) {
266270
console.log('店铺已主动返回,继续任务')
267271
return
268272
}
@@ -280,8 +284,8 @@ try {
280284
function getCoin() {
281285
console.log('获取喵币数量')
282286
try {
283-
let e = textContains('我的喵币').findOnce()
284-
let num = e.text().match(/(\d*)/)[1]
287+
let e = textContains('当前已有金币').findOnce()
288+
let num = e.parent().child(2).child(1).text().match(/([\d\.]*)\//)[1]
285289
console.log('当前共有', num, '喵币')
286290
return num
287291
} catch (err) {
@@ -295,7 +299,7 @@ try {
295299
if (autoOpen) {
296300
// 打开淘宝活动页面
297301
console.log('正在打开淘宝...')
298-
var url = 'pages.tmall.com/wow/z/hdwk/hd2023618/home?disableNav=YES&qd_from=tbsybutton'
302+
var url = 'pages.tmall.com/wow/z/hdwk/d11fy24/singleplayer?disableNav=YES&qd_from=tbsybutton'
299303

300304
app.startActivity({
301305
action: "VIEW",
@@ -304,23 +308,23 @@ try {
304308
sleep(2000)
305309

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

311-
let c = textContains('赚猫币').findOne(20000)
315+
let c = textContains('戳我赚金币').findOne(20000)
312316
if (c) {
313317
console.log('使用默认方法尝试打开任务列表')
314318
sleep(1000)
315-
c.click()
319+
c.parent().parent().child(c.parent().parent().childCount()-2).click()
316320
sleep(1000)
317321
c.click()
318322
console.log('已点击,未能打开建议手动点击一下任务列表。此问题并非bug,和网络以及设备性能有关。')
319323
console.log('检测任务列表,准备进行二次尝试')
320324
} else {
321325
throw '无法找到任务列表入口'
322326
}
323-
if (!textContains('累计任务奖励').findOne(8000)) {
327+
if (!textContains('当前已有金币').findOne(8000)) {
324328
console.log('默认方式打开失败,二次尝试')
325329
console.log('首先检测弹窗')
326330
for (let i = 0; i < 2 && text('关闭').findOne(2000); i++) { // 关闭弹窗
@@ -330,20 +334,16 @@ try {
330334
}
331335
console.log('已试图自动关闭弹窗。有未能自动关闭的弹窗请手动关闭')
332336
sleep(5000)
333-
// let right = c.bounds().right
334-
// let left = c.bounds().left
335-
// let top = c.bounds().top
336-
// let bottom = c.bounds().bottom
337-
// click(random(right,left), random(top, bottom))
337+
c = c.parent().parent().child(c.parent().parent().childCount()-2)
338338
click(c.bounds().centerX(), c.bounds().centerY())
339339
console.log('已点击,等待任务列表出现')
340-
if (!textContains('累计任务奖励').findOne(8000)) {
340+
if (!textContains('当前已有金币').findOne(8000)) {
341341
throw '无法打开任务列表'
342342
}
343343
}
344344
} else {
345345
console.log('请在30秒内打开淘宝活动页,并打开任务列表')
346-
if (textContains('累计任务奖励').findOne(30000)) {
346+
if (textContains('当前已有金币').findOne(30000)) {
347347
console.log('已打开,继续任务')
348348
} else {
349349
console.log('未能检测到任务列表,退出')
@@ -371,7 +371,7 @@ try {
371371

372372
if (awardButtons) {
373373
for (var i = 0; i < awardButtons.length; i++) {
374-
console.log('领取累计任务奖励')
374+
console.log('领取当前已有金币')
375375
awardButtons[i].click()
376376
console.log('等待5秒再次领取...')
377377
sleep(5000)
@@ -398,12 +398,12 @@ try {
398398
liulan()
399399
sleep(2000)
400400
}
401-
back()
401+
backToList()
402402
} else if (jumpButton[0].match(/.*.*|.*.*|.*.*|.*.*/)) {
403403
console.log('进行' + jumpButton[0] + '任务,10秒后返回')
404404
jumpButton[1].click()
405405
sleep(10000)
406-
back()
406+
backToList()
407407
} else if (jumpButton[0].match(//)) {
408408
console.log('进行' + jumpButton[0] + '任务')
409409
jumpButton[1].click()
@@ -414,7 +414,7 @@ try {
414414
}
415415
into.click()
416416
liulan()
417-
} else if (jumpButton[0].match(//)) {
417+
} else if (jumpButton[0].match(/[^#]/)) {
418418
console.log('进行' + jumpButton[0] + '任务')
419419
jumpButton[1].click()
420420
console.log('等待搜索')

tb_huichang.js

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const VERSION = '2023618-P'
1+
const VERSION = '20231111-F'
22

33
if (!auto.service) {
44
toast('无障碍服务未启动!退出!')
@@ -123,12 +123,12 @@ try {
123123
} else {
124124
throw '无法找到任务列表入口'
125125
}
126-
if (!textContains('task_detail').findOne(8000)) {
126+
if (!textContains('O1CN01stVIJt1VSfFvIXWtd').findOne(8000)) {
127127
console.log('默认方式打开失败,二次尝试')
128128
console.log('首先检测弹窗')
129129
try {
130-
let anchor = textContains('O1CN01cR2RJh1DIRHl5jiO7').findOne(5000)
131-
anchor.parent().child(4).child(0).click()
130+
let anchor = textContains('O1CN010Zax611FU0Z5m6nnQ').findOne(5000)
131+
anchor.parent().click()
132132
sleep(2000)
133133
console.log('领红包弹窗已关闭')
134134
} catch (err) {
@@ -151,7 +151,7 @@ try {
151151
// click(random(right,left), random(top, bottom))
152152
click(c.bounds().centerX(), c.bounds().centerY())
153153
console.log('已点击,等待任务列表出现')
154-
if (!textContains('task_detail').findOne(8000)) {
154+
if (!textContains('O1CN01stVIJt1VSfFvIXWtd').findOne(8000)) {
155155
throw '无法打开任务列表'
156156
}
157157
}
@@ -246,11 +246,18 @@ try {
246246
// TODO:
247247
function backToList() {
248248
console.log('返回上级')
249+
if (idContains('node_2_icon').exists()) {
250+
console.log('已在任务列表')
251+
return
252+
}
249253
back()
250-
sleep(1000)
251-
if (!idContains('node_2_icon').findOne(5000)) {
252-
console.log('似乎没有返回,二次尝试')
253-
back()
254+
for (let i = 0; i < 3; i++) {
255+
if (!idContains('node_2_icon').findOne(5000)) {
256+
console.log('似乎没有返回,二次尝试')
257+
back()
258+
} else {
259+
break
260+
}
254261
}
255262
sleep(1000)
256263
}
@@ -261,13 +268,13 @@ try {
261268

262269
app.startActivity({
263270
action: "VIEW",
264-
data: "taobao://s.click.taobao.com/aPfWYGu"
271+
data: "taobao://s.click.taobao.com/7qinv6u"
265272
})
266273
sleep(2000)
267274

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

300307
console.log('检测任务列表是否打开')
301-
if (textContains('task_detail').findOne(5000)) {
308+
if (textContains('O1CN01stVIJt1VSfFvIXWtd').findOne(5000)) {
302309
console.log('先关闭列表')
303310
idContains('close_btn').findOnce().click()
304311
sleep(2000)
@@ -326,7 +333,7 @@ try {
326333
sleep(2000)
327334
let count = jumpButton[0].match(/(\d*)/)[1]
328335
console.log('等待页面')
329-
if (!textContains('超红精选热卖').findOne(8000)) {
336+
if (!textContains('精选热卖').findOne(8000)) {
330337
throw '商品页面未加载'
331338
}
332339
try {
@@ -361,7 +368,7 @@ try {
361368
if (textMatches(/|/).findOne(10000) || currentActivity() == 'com.taobao.android.detail.wrapper.activity.DetailActivity') {
362369
console.log('商品打开成功,返回')
363370
back()
364-
if (!textContains('超红精选热卖').findOne(10000)) {
371+
if (!textContains('精选热卖').findOne(10000)) {
365372
console.log('似乎没有返回,二次尝试')
366373
back()
367374
}

0 commit comments

Comments
 (0)