callback
This commit is contained in:
43
app.py
43
app.py
@@ -97,8 +97,7 @@ def urlSend(num):
|
|||||||
sendTg(f"用户输入:{inputArguments},手机号不正确,或者uid参数异常")
|
sendTg(f"用户输入:{inputArguments},手机号不正确,或者uid参数异常")
|
||||||
|
|
||||||
|
|
||||||
|
def returnRes(err_code, outputArguments):
|
||||||
def returnRes(err_code,outputArguments):
|
|
||||||
# 成功的响应 0成功 -1失败
|
# 成功的响应 0成功 -1失败
|
||||||
content = {
|
content = {
|
||||||
"err_code": err_code,
|
"err_code": err_code,
|
||||||
@@ -107,6 +106,7 @@ def returnRes(err_code,outputArguments):
|
|||||||
headers = {"Content-Type": "application/json"}
|
headers = {"Content-Type": "application/json"}
|
||||||
return JSONResponse(content=content, headers=headers)
|
return JSONResponse(content=content, headers=headers)
|
||||||
|
|
||||||
|
|
||||||
@app.get("/")
|
@app.get("/")
|
||||||
# def read_root():
|
# def read_root():
|
||||||
# return {"Hello": "World"}
|
# return {"Hello": "World"}
|
||||||
@@ -205,3 +205,42 @@ async def getphonenum(
|
|||||||
return JSONResponse(content=content, headers=headers)
|
return JSONResponse(content=content, headers=headers)
|
||||||
|
|
||||||
# # 微信对话平台一定要选择: 随机回复
|
# # 微信对话平台一定要选择: 随机回复
|
||||||
|
|
||||||
|
|
||||||
|
# 通过网址发送闪信
|
||||||
|
@app.get("/callback")
|
||||||
|
# def read_root():
|
||||||
|
# return {"Hello": "World"}
|
||||||
|
def callback(
|
||||||
|
query: Union[str, None] = query,
|
||||||
|
):
|
||||||
|
print("query", query)
|
||||||
|
background_tasks.add_task(urlSend, num)
|
||||||
|
content = {
|
||||||
|
"ans_node_name": "小微闲聊",
|
||||||
|
"title": "小薇兄你好",
|
||||||
|
"answer": "你好呀!",
|
||||||
|
"answer_type": "text",
|
||||||
|
"bid_stat": {
|
||||||
|
"curr_time": "20190515-18:07:37",
|
||||||
|
"err_msg": "微信通用意图.肯定.branches.s_Any@.arguments's element.slot slot does not exist!",
|
||||||
|
"latest_time": "20190523-16:06:33",
|
||||||
|
"latest_valid": False,
|
||||||
|
"up_ret": -1,
|
||||||
|
},
|
||||||
|
"confidence": 1,
|
||||||
|
"from_user_name": "o9U-85tEZToQxIF8ht6o-KkagxO0",
|
||||||
|
"status": "FAQ",
|
||||||
|
"to_user_name": "xalsjfasf1ljasjdf1",
|
||||||
|
"options": [
|
||||||
|
{
|
||||||
|
"ans_node_id": 12355896,
|
||||||
|
"ans_node_name": "自建应用",
|
||||||
|
"answer": "有详情入口的应用消息一般是通过api进行推送的入口不E_BREAKLINE_BREAK2、企业号或企业微信后台推送的图文消息,在微信PC侧会有“详情”入口,在企业微信手机端、PC端以及微信手机端则不会有“详情”入口。LINE_BREAKLINE_BREAK注意:微信电脑端侧仅会显示摘要和详情,不显示标题。企业微信电脑端、微信微信手机端、企业微信手机端则会显示标题和摘要。若未填写摘要,则不显示摘要。",
|
||||||
|
"confidence": 0.795230507850647,
|
||||||
|
"title": "自建应用消息没有详情入口",
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}
|
||||||
|
headers = {"Content-Type": "application/json"}
|
||||||
|
return JSONResponse(content=content, headers=headers)
|
||||||
|
|||||||
Reference in New Issue
Block a user