test
This commit is contained in:
41
app.py
41
app.py
@@ -108,12 +108,49 @@ async def getphonenum(
|
|||||||
uid: Union[str, None] = Header(default=None)
|
uid: Union[str, None] = Header(default=None)
|
||||||
):
|
):
|
||||||
|
|
||||||
|
err_code=0
|
||||||
|
print("inputArguments", inputArguments)
|
||||||
|
# uid:唯一标识用户的openid
|
||||||
|
# print("appid", appid, "bid", bid, "requestid", requestid, "uid", uid)
|
||||||
|
# uid='wxx'
|
||||||
|
# 要处理url编码问题decode
|
||||||
|
try:
|
||||||
|
inputArguments = unquote(inputArguments, "utf-8")
|
||||||
|
except:
|
||||||
|
inputArguments = ""
|
||||||
|
# 正则获取11位手机号
|
||||||
|
phonenumber = findPhoneNum(inputArguments)
|
||||||
|
print("phonenumber", phonenumber)
|
||||||
|
# # phonenumber='13243889782'
|
||||||
|
if phonenumber is not None and uid is not None:
|
||||||
|
warntext = "[异度世界],微信加群验证码:3399"
|
||||||
|
# sendTg(f"用户手机号{phonenumber},开始发送验证码")
|
||||||
|
# 判断用户uid是都触发过短信,不允许触发第2次
|
||||||
|
if findUid(uid, phonenumber) is True:
|
||||||
|
err_code=-1
|
||||||
|
print("用户uid已存在,不触发短信")
|
||||||
|
# sendTg(f"用户{uid}已存在,不触发短信")
|
||||||
|
else:
|
||||||
|
# 发送闪信
|
||||||
|
# sendFlash(phonenumber, warntext)
|
||||||
|
# 后台发送
|
||||||
|
background_tasks.add_task(sendFlash,phonenumber,warntext)
|
||||||
|
|
||||||
|
else:
|
||||||
|
err_code=-1
|
||||||
|
print(f"用户输入:{inputArguments},手机号不正确,或者uid参数异常")
|
||||||
|
# sendTg(f"用户输入:{inputArguments},手机号不正确,或者uid参数异常")
|
||||||
|
|
||||||
# 存储uid和手机号
|
# 存储uid和手机号
|
||||||
# return {"appid": appid,"bid": bid,"requestid": requestid,"uid": uid,'inputArguments':inputArguments}
|
# return {"appid": appid,"bid": bid,"requestid": requestid,"uid": uid,'inputArguments':inputArguments}
|
||||||
|
|
||||||
# 后台任务
|
# 后台任务
|
||||||
background_tasks.add_task(resData,inputArguments,uid)
|
# background_tasks.add_task(resData,inputArguments,uid)
|
||||||
|
|
||||||
# await resData(inputArguments,uid)
|
# await resData(inputArguments,uid)
|
||||||
content = {"err_code": 0,"data_list": [{"outputArguments":'test'}]}
|
# 成功的响应 1成功 2失败
|
||||||
|
content = {"err_code": err_code,"data_list": [{"outputArguments":'test'}]}
|
||||||
|
|
||||||
|
|
||||||
headers = {"Content-Type": "application/json"}
|
headers = {"Content-Type": "application/json"}
|
||||||
return JSONResponse(content=content, headers=headers)
|
return JSONResponse(content=content, headers=headers)
|
||||||
|
|||||||
Reference in New Issue
Block a user