修复 提交填报 更新 bug

This commit is contained in:
王思川 2021-12-15 16:07:05 +08:00
parent 48c508832f
commit e0afc15164
2 changed files with 12 additions and 4 deletions

View File

@ -78,13 +78,14 @@ def find_risk_data(rid):
return record
def update_rating_records(rid, data):
def update_rating_records(find, data):
"""
更新评价记录
Parameters:
-
find 查询条件
data 更新数据
Returns:
-
"""
collection = client['评价']['评价记录']
collection.update_one({"评价ID": rid}, {"$set": data})
collection.update_one(find, {"$set": data})

View File

@ -223,7 +223,14 @@ def exec_general_rating_scripts(cid):
data = json.dumps({"input_data": rating_inputs})
res = requests.post(url, headers=headers, data=data)
if res.status_code == 200:
update_rating_records({"评价ID": rid}, {"进行状态": "完成"})
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