修复 流程提前完成BUG

This commit is contained in:
王思川 2021-12-30 14:24:16 +08:00
parent 486dcd0bce
commit a96f6b6f14
2 changed files with 7 additions and 6 deletions

View File

@ -49,10 +49,11 @@ class InputForm:
Returns: Returns:
评分执行结果 评分执行结果
""" """
if exec_general_rating_scripts(self.cid)[0]: res, info = exec_general_rating_scripts(self.cid)
if res:
return "评分成功,请前往主页查看", 200 return "评分成功,请前往主页查看", 200
else: else:
return "评分失败,请检查数据,或联系管理员", 210 return info, 210
@staticmethod @staticmethod
def choose_industry_obj(): def choose_industry_obj():

View File

@ -205,8 +205,7 @@ def exec_general_rating_scripts(cid):
record = find_rating_records({"企业ID": cid, "进行状态": "进行"}) record = find_rating_records({"企业ID": cid, "进行状态": "进行"})
if not record: if not record:
info = "没有正在进行的评价" return False, "没有正在进行的评价"
return info
# Parameters # Parameters
rid = record[0]["评价ID"] rid = record[0]["评价ID"]
@ -226,8 +225,7 @@ def exec_general_rating_scripts(cid):
if res.status_code == 200: if res.status_code == 200:
update_data = { update_data = {
"评价结果": json.loads(res.text)['result'], "评价结果": json.loads(res.text)['result'],
"评价时间": time.strftime("%Y-%m-%d", time.localtime()), "评价时间": time.strftime("%Y-%m-%d", time.localtime())
"进行状态": "完成"
} }
update_rating_records({"评价ID": rid}, update_data) update_rating_records({"评价ID": rid}, update_data)
return True return True
@ -281,4 +279,6 @@ def exec_general_rating_scripts(cid):
if not company_index(): if not company_index():
return False, "准备企业主页数据失败" return False, "准备企业主页数据失败"
update_rating_records({"评价ID": rid}, {"进行状态": "完成"})
return True, "执行成功" return True, "执行成功"