This commit is contained in:
wangzhengzhen
2024-12-30 17:43:16 +08:00
parent 505e803142
commit 509068cb54
3 changed files with 32 additions and 20 deletions

View File

@@ -7,18 +7,20 @@ class Rule:
pass pass
@classmethod @classmethod
def count(self, num, interval, factor = 0): def count(cls, num, interval, factor = 0):
self.num = num rule = cls()
self.interval = interval rule.num = num
self.factor = factor rule.interval = interval
return self rule.factor = factor
return rule
@classmethod @classmethod
def time(self, duration, interval, factor = 0): def time(cls, duration, interval, factor = 0):
self.duration = duration rule = cls()
self.interval = interval rule.duration = duration
self.factor = factor rule.interval = interval
return self rule.factor = factor
return rule
class _App: class _App:
def __init__(self, name): def __init__(self, name):
@@ -121,6 +123,14 @@ class TomatoListen(_App):
_App.__init__(self, "番茄畅听") _App.__init__(self, "番茄畅听")
self.device = device self.device = device
# 看广告
def func_ad(self):
button = ui.Button(200, 850, 500, 900)
point = button.get_point()
self.device.back()
self.device.back() # 防止自动进入直播界面
self.device.click(point)
class TomatoFiction(_App): class TomatoFiction(_App):
def __init__(self, device): def __init__(self, device):
_App.__init__(self, "番茄小说") _App.__init__(self, "番茄小说")

View File

@@ -13,6 +13,8 @@ def main():
wikoHi70m = WikoHi70m('3URNU24803102309') wikoHi70m = WikoHi70m('3URNU24803102309')
# 任务 # 任务
watchAdTask = apps.Task("看广告", apps.Rule.count(500, 45, 2),
lambda : apps.TomatoListen(wikoHi70m).func_ad())
watchVideoTask = apps.Task.watch_video("刷视频", apps.Rule.count(500, 8, 2), wikoHi70m) watchVideoTask = apps.Task.watch_video("刷视频", apps.Rule.count(500, 8, 2), wikoHi70m)
bgWatchVideoTask = apps.Task("后台刷视频", apps.Rule.count(500, 8, 2), bgWatchVideoTask = apps.Task("后台刷视频", apps.Rule.count(500, 8, 2),
lambda : wikoHi70m.swipe(240 + int(random.uniform(-10, 10)), 1200 + int(random.uniform(-10, 10)), 240 + int(random.uniform(-10, 10)), 1100 + int(random.uniform(-10, 10)), 50)) lambda : wikoHi70m.swipe(240 + int(random.uniform(-10, 10)), 1200 + int(random.uniform(-10, 10)), 240 + int(random.uniform(-10, 10)), 1100 + int(random.uniform(-10, 10)), 50))
@@ -24,9 +26,9 @@ def main():
bgReadBookTask = apps.Task("后台看书", apps.Rule.count(1000, 5, 2), bgReadBookTask = apps.Task("后台看书", apps.Rule.count(1000, 5, 2),
lambda : wikoHi70m.swipe(500 + int(random.uniform(-10, 10)), 1200 + int(random.uniform(-10, 10)), 240 + int(random.uniform(-10, 10)), 1200 + int(random.uniform(-10, 10)), 80)) lambda : wikoHi70m.swipe(500 + int(random.uniform(-10, 10)), 1200 + int(random.uniform(-10, 10)), 240 + int(random.uniform(-10, 10)), 1200 + int(random.uniform(-10, 10)), 80))
watchAdTask.start()
# 看视频+小窗看书,同步执行 # 看视频+小窗看书,同步执行
sync_task(bgWatchVideoTask, minReadBookTask) # sync_task(bgWatchVideoTask, minReadBookTask)
# 任务完成锁屏 # 任务完成锁屏
wikoHi70m.lock() wikoHi70m.lock()

View File

@@ -8,17 +8,17 @@ class Point:
# 按纽 # 按纽
class Button: class Button:
def __init__(self, x, y, w = 0, h = 0): def __init__(self, x1, y1, x2 = 0, y2 = 0):
self.x = x self.x1 = x1
self.y = y self.y1 = y1
self.w = w self.x2 = x2
self.h = h self.y2 = y2
def get_point(self, ran = True): def get_point(self, ran = True):
if ran == True and self.w > 0 and self.h > 0: if ran == True and self.x2 > 0 and self.y2 > 0:
return Point(self.x + int(random.uniform(self.w * 4, self.w * 0.7)), self.y + int(random.uniform(self.h * 0.4, self.h * 0.7))) return Point(int(random.uniform(self.x1, self.x2)), int(random.uniform(self.y1, self.y2)))
else: else:
return Point(self.x, self.y) return Point(self.x1, self.y1)