test
This commit is contained in:
44
app.py
44
app.py
@@ -97,6 +97,16 @@ def urlSend(num):
|
||||
sendTg(f"用户输入:{inputArguments},手机号不正确,或者uid参数异常")
|
||||
|
||||
|
||||
|
||||
def returnRes(err_code,outputArguments):
|
||||
# 成功的响应 0成功 -1失败
|
||||
content = {
|
||||
"err_code": err_code,
|
||||
"data_list": [{"outputArguments": outputArguments}],
|
||||
}
|
||||
headers = {"Content-Type": "application/json"}
|
||||
return JSONResponse(content=content, headers=headers)
|
||||
|
||||
@app.get("/")
|
||||
# def read_root():
|
||||
# return {"Hello": "World"}
|
||||
@@ -147,7 +157,7 @@ async def getphonenum(
|
||||
uid: Union[str, None] = Header(default=None),
|
||||
):
|
||||
err_code = 0
|
||||
outputArguments = ""
|
||||
outputArguments = "验证码发送成功"
|
||||
print("inputArguments", inputArguments)
|
||||
try:
|
||||
inputArguments = unquote(inputArguments, "utf-8")
|
||||
@@ -172,25 +182,27 @@ async def getphonenum(
|
||||
# 后台发送
|
||||
background_tasks.add_task(sendFlash, phonenumber, warntext)
|
||||
|
||||
# 成功的响应 0成功 -1失败
|
||||
content = {
|
||||
"err_code": err_code,
|
||||
"data_list": [{"outputArguments": outputArguments}],
|
||||
}
|
||||
headers = {"Content-Type": "application/json"}
|
||||
return JSONResponse(content=content, headers=headers)
|
||||
|
||||
else:
|
||||
err_code = -1
|
||||
outputArguments = "验证码发送失败,请检查手机号格式,或其他异常"
|
||||
print(f"用户输入:{inputArguments},手机号不正确,或者uid参数异常")
|
||||
# sendTg(f"用户输入:{inputArguments},手机号不正确,或者uid参数异常")
|
||||
|
||||
if err_code == 0:
|
||||
outputArguments = "验证码发送成功"
|
||||
else:
|
||||
outputArguments = "验证码发送失败,请检查手机号格式,或其他异常"
|
||||
# 成功的响应 0成功 -1失败
|
||||
content = {
|
||||
"err_code": err_code,
|
||||
"data_list": [{"outputArguments": outputArguments}],
|
||||
}
|
||||
headers = {"Content-Type": "application/json"}
|
||||
return JSONResponse(content=content, headers=headers)
|
||||
# 成功的响应 0成功 -1失败
|
||||
content = {
|
||||
"err_code": err_code,
|
||||
"data_list": [{"outputArguments": outputArguments}],
|
||||
}
|
||||
headers = {"Content-Type": "application/json"}
|
||||
return JSONResponse(content=content, headers=headers)
|
||||
|
||||
# # 微信对话平台一定要选择: 随机回复
|
||||
# background_tasks.add_task(resData, inputArguments, uid)
|
||||
# content = {"err_code": 0, "data_list": [{"outputArguments": "test"}]}
|
||||
# headers = {"Content-Type": "application/json"}
|
||||
# return JSONResponse(content=content, headers=headers)
|
||||
s
|
||||
Reference in New Issue
Block a user