优化
This commit is contained in:
@@ -33,7 +33,7 @@ class _App:
|
||||
def open_function(self):
|
||||
pass
|
||||
|
||||
def _exec(rule, func, log_prefix = ""):
|
||||
def _exec(rule, func = [], log_prefix = "执行任务"):
|
||||
factor = getattr(rule, "factor")
|
||||
if hasattr(rule, "num"):
|
||||
num = getattr(rule, "num")
|
||||
@@ -43,7 +43,11 @@ def _exec(rule, func, log_prefix = ""):
|
||||
if factor > 0:
|
||||
wait_time = round(random.uniform(wait_time - factor, wait_time + factor), 2)
|
||||
print("{}:{}/{} ,停留 {} 秒".format(log_prefix, i, num, wait_time))
|
||||
func()
|
||||
if isinstance(func, list):
|
||||
for f in func:
|
||||
f()
|
||||
else:
|
||||
func()
|
||||
time.sleep(wait_time)
|
||||
i += 1
|
||||
return True
|
||||
|
@@ -2,17 +2,6 @@ from devices import WikoHi70m
|
||||
import apps
|
||||
import random
|
||||
|
||||
def app_custom(device):
|
||||
# 上滑视频
|
||||
device.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)
|
||||
# 上滑浏览(小窗口)
|
||||
# device.swipe(450 + int(random.uniform(-10, 10)), 400 + int(random.uniform(-10, 10)), 450 + int(random.uniform(-10, 10)), 200 + int(random.uniform(-10, 10)), 300)
|
||||
# 上滑视频(小窗口)
|
||||
device.swipe(450 + int(random.uniform(-10, 10)), 400 + int(random.uniform(-10, 10)), 450 + int(random.uniform(-10, 10)), 200 + int(random.uniform(-10, 10)), 50)
|
||||
# 左滑(小窗口)
|
||||
# device.swipe(600 + int(random.uniform(-10, 10)), 400 + int(random.uniform(-10, 10)), 400 + int(random.uniform(-10, 10)), 400 + int(random.uniform(-10, 10)), 80)
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
# adb_cmd.mobile_unlock()
|
||||
@@ -20,9 +9,22 @@ def main():
|
||||
try:
|
||||
|
||||
# 3URNU24803102309 192.168.8.138:5555
|
||||
wikoHi70m = WikoHi70m('192.168.8.138:5555')
|
||||
wikoHi70m = WikoHi70m('3URNU24803102309')
|
||||
|
||||
# apps._exec(apps.Rule.count(500, 5, 2), lambda : app_custom(wikoHi70m), "任务执行中")
|
||||
func = [
|
||||
# 上滑视频
|
||||
# lambda : device.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(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(600 + int(random.uniform(-10, 10)), 400 + int(random.uniform(-10, 10)), 400 + int(random.uniform(-10, 10)), 400 + int(random.uniform(-10, 10)), 80)
|
||||
# 上滑浏览(小窗口)
|
||||
# lambda : device.swipe(450 + int(random.uniform(-10, 10)), 400 + int(random.uniform(-10, 10)), 450 + int(random.uniform(-10, 10)), 200 + int(random.uniform(-10, 10)), 300)
|
||||
# 上滑视频(小窗口)
|
||||
# lambda : device.swipe(450 + int(random.uniform(-10, 10)), 400 + int(random.uniform(-10, 10)), 450 + int(random.uniform(-10, 10)), 200 + int(random.uniform(-10, 10)), 50)
|
||||
]
|
||||
apps._exec(apps.Rule.count(1000, 5, 2), func, "任务执行中")
|
||||
|
||||
# 快手
|
||||
# kuaishouLite = apps.KuaishouLite(wikoHi70m)
|
||||
|
Reference in New Issue
Block a user