整合接口临时存储

This commit is contained in:
王思川 2021-12-24 16:59:37 +08:00
parent a4affdfd48
commit 9b6a4a0030
1 changed files with 23 additions and 18 deletions

View File

@ -216,21 +216,26 @@ def exec_general_rating_scripts(cid):
risks["风险数据"].pop('评价ID')
rating_inputs = {**inputs, **risks}
# main
url = "http://139.9.249.34:51012/tfse_rating/rating/general_model"
token = "X0gSlC!YE8jmr2jJr&ilcjS83j!tsoh5"
headers = {'token': token, "Content-Type": "application/json;charset=UTF-8"}
data = json.dumps({"input_data": rating_inputs})
res = requests.post(url, headers=headers, data=data)
if res.status_code == 200:
update_data = {
"评价结果": json.loads(res.text)['result'],
"评价时间": time.strftime("%Y-%m-%d", time.localtime()),
"进行状态": "完成",
"报告fid": "xxx",
"证书fid": "xxx"
}
update_rating_records({"评价ID": rid}, update_data)
return True
else:
return False
# 打分模型
def general_model():
url = "http://139.9.249.34:51012/tfse_rating/rating/general_model"
token = "X0gSlC!YE8jmr2jJr&ilcjS83j!tsoh5"
headers = {'token': token, "Content-Type": "application/json;charset=UTF-8"}
data = json.dumps({"input_data": rating_inputs})
res = requests.post(url, headers=headers, data=data)
if res.status_code == 200:
update_data = {
"评价结果": json.loads(res.text)['result'],
"评价时间": time.strftime("%Y-%m-%d", time.localtime()),
"进行状态": "完成",
"报告fid": None,
"证书fid": None
}
update_rating_records({"评价ID": rid}, update_data)
return True
else:
return False
# 生成报告
def gen_report():
pass