代码优化
This commit is contained in:
parent
038495f226
commit
9e76be1976
|
|
@ -114,6 +114,7 @@ class DealAccount:
|
|||
# 下载执行脚本
|
||||
self.task_all.upload_file_to_phone([data["pad_code"]], file_name=res_dict["script_name"])
|
||||
# 设置代理
|
||||
print(data)
|
||||
self.task_all.set_network_proxy(pad_code=[data["pad_code"]],country=data["country"])
|
||||
# 启动对应脚本
|
||||
self.task_all.async_execute_adb_command(pad_code=data["pad_code"], file_name=res_dict["script_name"])
|
||||
|
|
|
|||
31
main.py
31
main.py
|
|
@ -221,21 +221,24 @@ async def shop_backup(backup_data: BackupItem, account_manager: Any = Depends(ge
|
|||
pad_code
|
||||
"""
|
||||
param = backup_data.model_dump()
|
||||
try:
|
||||
result = await account_manager.deal_backup_task(param)
|
||||
if param.get("is_restore", False):
|
||||
time.sleep(random.randint(1, 10))
|
||||
restore_result = await account_manager.deal_restore_system(param)
|
||||
if restore_result and result:
|
||||
return {"code": 200, "message": f"任务:{param.get("pad_code")} 备份还原成功"}
|
||||
raise HTTPException(status_code=404, detail=f"云机:{param.get("pad_code")} 备份还原失败")
|
||||
print(param)
|
||||
result = await account_manager.deal_backup_task(param)
|
||||
if param.get("is_restore", False):
|
||||
time.sleep(random.randint(1, 10))
|
||||
print(param)
|
||||
restore_result = await account_manager.deal_restore_system(param)
|
||||
if restore_result and result:
|
||||
return {"code": 200, "message": f"任务:{param.get("pad_code")} 备份还原成功"}
|
||||
raise HTTPException(status_code=404, detail=f"云机:{param.get("pad_code")} 备份还原失败")
|
||||
else:
|
||||
if result:
|
||||
return {"code": 200, "message": f"任务:{param.get("pad_code")} 备份成功", }
|
||||
else:
|
||||
if result:
|
||||
return {"code": 200, "message": f"任务:{param.get("pad_code")} 备份成功", }
|
||||
else:
|
||||
raise HTTPException(status_code=404, detail=f"云机:{param.get("pad_code")} 备份失败")
|
||||
except Exception as e:
|
||||
raise HTTPException(status_code=404, detail=f"云机:{param.get("pad_code")} 备份失败,失败原因:{e}")
|
||||
raise HTTPException(status_code=404, detail=f"云机:{param.get("pad_code")} 备份失败")
|
||||
# try:
|
||||
# pass
|
||||
# except Exception as e:
|
||||
# raise HTTPException(status_code=404, detail=f"云机:{param.get("pad_code")} 备份失败,失败原因:{e}")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
|||
|
|
@ -59,3 +59,4 @@ class BackupItem(BaseModel):
|
|||
account_id: str = Field(..., description="账号ID")
|
||||
script_name: str = Field(..., description="脚本名称")
|
||||
is_restore: bool = Field(..., description="是否还原")
|
||||
country: bool = Field(..., description="国家")
|
||||
|
|
|
|||
|
|
@ -138,6 +138,7 @@ class DealAllTask:
|
|||
|
||||
def check_phone_status(self, pad_code: list[str], file_name: str,times=10):
|
||||
count = 0
|
||||
time.sleep(300)
|
||||
while True:
|
||||
result = self.async_execute_adb_command(pad_code, file_name, is_check=True)
|
||||
if result:
|
||||
|
|
|
|||
Loading…
Reference in New Issue