代码优化
This commit is contained in:
parent
e4bfd76349
commit
b5399f5be6
|
|
@ -103,21 +103,25 @@ class DealAccount:
|
|||
if result:
|
||||
res_dict = result[0]
|
||||
logger.info(f"<UNK>{data['account_id']} <UNK>")
|
||||
set_param = {"status": 2, "update_time": datetime.now().strftime("%Y-%m-%d %H:%M:%S")}
|
||||
set_param = {"status": 2}
|
||||
params = (res_dict["account_id"],)
|
||||
where_conditions = "account_id = %s "
|
||||
result_sql = await self.update_device_status(set_param, where_conditions, params)
|
||||
logger.info(f"<UNK>{data['account_id']} 开始修改数据状态,修改结果为:{result_sql}")
|
||||
if result_sql:
|
||||
restore = self.task_all.restore_system(pad_code=[data["pad_code"]], backup_name=res_dict["backup_name"])
|
||||
logger.info(f"<UNK>{data['pad_code']}备份结果为: {restore}")
|
||||
if restore:
|
||||
result_status = self.task_all.check_phone_status(pad_code=[data["pad_code"]], file_name="test_abc.js")
|
||||
logger.info(f"<UNK>:{data['pad_code']}{result_status}")
|
||||
if result_status:
|
||||
logger.info(f"云机:{data['pad_code']} 环境还原成功")
|
||||
logger.info(f"云机:{data['pad_code']} 环境还原成功,开始下载文件:{res_dict['script_name']}")
|
||||
# 下载执行脚本
|
||||
self.task_all.upload_file_to_phone([data["pad_code"]], file_name=res_dict["script_name"])
|
||||
# 设置代理
|
||||
logger.info(data)
|
||||
time.sleep(10)
|
||||
logger.info(f"<UNK>{data['pad_code']} 开始设置代理")
|
||||
self.task_all.set_network_proxy(pad_code=[data["pad_code"]], country=data["country"])
|
||||
# 启动对应脚本
|
||||
time.sleep(10)
|
||||
|
|
|
|||
|
|
@ -136,9 +136,9 @@ class DealAllTask:
|
|||
f'--es path "{script_path}" --es referrer {shlex.quote(params)}'
|
||||
)
|
||||
|
||||
def check_phone_status(self, pad_code: list[str], file_name: str,times=10):
|
||||
def check_phone_status(self, pad_code: list[str], file_name: str, times=10):
|
||||
count = 0
|
||||
time.sleep(300)
|
||||
time.sleep(180)
|
||||
while True:
|
||||
result = self.async_execute_adb_command(pad_code, file_name, is_check=True)
|
||||
if result:
|
||||
|
|
@ -213,3 +213,12 @@ class DealAllTask:
|
|||
retry_count += 1
|
||||
if retry_count > 5:
|
||||
break
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
obj = DealAllTask()
|
||||
results = obj.async_execute_adb_command(["ACP251024MKBZTCO"], "test_abc.js", is_check=True)
|
||||
print(type(results))
|
||||
if results:
|
||||
print(123113)
|
||||
print(f"1223{results}1223")
|
||||
|
|
|
|||
Loading…
Reference in New Issue