完善总的审核接口
This commit is contained in:
parent
9bc177d2a5
commit
34077921e8
@ -7,4 +7,4 @@ def check_local(txt):
|
||||
risk = 0
|
||||
if len(result) > 0:
|
||||
risk = 1
|
||||
return {'errcode': 0, 'risk': risk, 'reason': result}
|
||||
return {'errcode': 0, 'risk': risk, 'reason': result}
|
||||
|
39
main.py
39
main.py
@ -15,13 +15,44 @@ class Item(BaseModel):
|
||||
content: str
|
||||
|
||||
|
||||
@app.post("/check")
|
||||
async def check_content(item: Item):
|
||||
# res_wechat = await msg_sec_check(item.content)
|
||||
# res_baidu = await check_baidu(item.content)
|
||||
@app.post("/check_wx")
|
||||
async def check_wx(item: Item):
|
||||
res_wechat = await msg_sec_check(item.content)
|
||||
return res_wechat
|
||||
|
||||
|
||||
@app.post("/check_bd")
|
||||
async def check_wx(item: Item):
|
||||
res_baidu = await check_baidu(item.content)
|
||||
return res_baidu
|
||||
|
||||
|
||||
@app.post("/check_local")
|
||||
async def check_local_def(item: Item):
|
||||
res_local = check_local(item.content)
|
||||
return res_local
|
||||
|
||||
|
||||
@app.post("/check_all")
|
||||
async def check_content(item: Item):
|
||||
res_wechat = await msg_sec_check(item.content)
|
||||
result = {'errcode': 1}
|
||||
if res_wechat['errcode'] == 0:
|
||||
result['errcode'] = 0
|
||||
result['wx'] = res_wechat['risk']
|
||||
result['reason_wx'] = res_wechat['reason']
|
||||
res_baidu = await check_baidu(item.content)
|
||||
if res_baidu['errcode'] == 0:
|
||||
result['errcode'] = 0
|
||||
result['bd'] = res_baidu['risk']
|
||||
result['reason_bd'] = res_baidu['reason']
|
||||
res_local = check_local(item.content)
|
||||
if res_local['errcode'] == 0:
|
||||
result['errcode'] = 0
|
||||
result['local'] = res_local['risk']
|
||||
result['reason_local'] = res_local['reason']
|
||||
return result
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
uvicorn.run(app, host="0.0.0.0", port=8009)
|
||||
|
Loading…
x
Reference in New Issue
Block a user