更新 huaweitest.py

master
wangsiyuan 2024-03-01 18:33:59 +08:00
parent a7e630cd84
commit 57f7f9252f
1 changed files with 2 additions and 2 deletions

View File

@ -57,14 +57,14 @@ async def do_success(request: Request):
@app.get("/script/failed") @app.get("/script/failed")
async def do_failed(reason: str = None): async def do_failed(reason: str = None, errortype: str = None):
# 获取当前时间 # 获取当前时间
now = datetime.now() now = datetime.now()
# 格式化时间为 年-月-日 时:分:秒 的格式 # 格式化时间为 年-月-日 时:分:秒 的格式
formatted_now = now.strftime("%Y-%m-%d %H:%M:%S") formatted_now = now.strftime("%Y-%m-%d %H:%M:%S")
# 假设这里记录失败原因到日志或数据库 # 假设这里记录失败原因到日志或数据库
print(f"上报失败,Time: {formatted_now}, 失败原因: {reason}") # 实际应用中应使用更专业的日志记录方式 print(f"上报失败,Time: {formatted_now}, 失败原因: {reason},失败类型: {errortype}.") # 实际应用中应使用更专业的日志记录方式
return { return {
"code": 0, "code": 0,
"msg": "ok", "msg": "ok",