时间从D盘time.txt获取。
This commit is contained in:
@@ -8,6 +8,7 @@ from appium.webdriver.common.appiumby import AppiumBy
|
||||
from appium.options.android import UiAutomator2Options
|
||||
from selenium.webdriver.support.ui import WebDriverWait
|
||||
from selenium.webdriver.support import expected_conditions as EC
|
||||
from urllib3.connection import port_by_scheme
|
||||
|
||||
|
||||
# =======================
|
||||
@@ -24,6 +25,35 @@ def run_command(command):
|
||||
# API请求函数
|
||||
# =======================
|
||||
|
||||
def get_new_port(yh_id):
|
||||
"""从服务器获取新的端口号"""
|
||||
url = "https://engineering.yuxindazhineng.com/index/index/get_yh_port"
|
||||
headers = {
|
||||
"Content-Type": "application/x-www-form-urlencoded"
|
||||
}
|
||||
data = {
|
||||
"yh_id": yh_id
|
||||
}
|
||||
|
||||
try:
|
||||
print(f"🔍 查询服务器新端口号,用户ID: {yh_id}")
|
||||
response = requests.post(url, headers=headers, data=data, timeout=10)
|
||||
|
||||
if response.status_code == 200:
|
||||
result = response.json()
|
||||
if result.get("code") == 0:
|
||||
print(f"✅ 查询成功,新端口号: {result.get('data', '未知')}")
|
||||
return result.get("data", None)
|
||||
else:
|
||||
print(f"❌ 查询失败: {result.get('msg', '未知错误')}")
|
||||
return None
|
||||
else:
|
||||
print(f"❌ 服务器响应错误: {response.status_code}")
|
||||
return None
|
||||
except requests.exceptions.RequestException as e:
|
||||
print(f"❌ 网络请求失败: {e}")
|
||||
return None
|
||||
|
||||
def get_accounts_from_server(yh_id):
|
||||
"""从服务器获取账户信息"""
|
||||
url = "http://www.yuxindazhineng.com:3002/api/accounts/get_uplaod_data"
|
||||
@@ -66,9 +96,9 @@ def update_device_info(account_id, device_name, device_port, device_ip):
|
||||
data = {
|
||||
"account_id": str(account_id),
|
||||
"account_data": {
|
||||
"device_name": device_name,
|
||||
"device_port": device_port,
|
||||
"device_ip": device_ip
|
||||
"device_name": str(device_name),
|
||||
"device_port": str(device_port),
|
||||
"device_ip": str(device_ip)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,7 +221,9 @@ def start_settlement_app(device_id, device_ip, device_port):
|
||||
# 无线 ADB 建链主流程
|
||||
# =======================
|
||||
|
||||
def setup_adb_wireless(port="5555", yh_id="68c0dbfdb7cbcd616e7c5ab5"):
|
||||
def setup_adb_wireless(yh_id="68c0dbfdb7cbcd616e7c5ab5"):
|
||||
port = get_new_port(yh_id)
|
||||
# port = 3435
|
||||
print(f"🚀 开始无线 ADB 建链(端口 {port})")
|
||||
print(f"📋 用户ID: {yh_id}")
|
||||
|
||||
@@ -309,7 +341,7 @@ def setup_adb_wireless(port="5555", yh_id="68c0dbfdb7cbcd616e7c5ab5"):
|
||||
|
||||
if __name__ == "__main__":
|
||||
# 配置参数
|
||||
TARGET_PORT = "5555"
|
||||
|
||||
USER_ID = "68c0dbfdb7cbcd616e7c5ab5" # 替换为实际的用户ID
|
||||
|
||||
setup_adb_wireless(TARGET_PORT, USER_ID)
|
||||
setup_adb_wireless(USER_ID)
|
||||
Reference in New Issue
Block a user