diff --git a/input/InputForm.py b/input/InputForm.py index 87cfc0c..420950c 100644 --- a/input/InputForm.py +++ b/input/InputForm.py @@ -49,10 +49,11 @@ class InputForm: Returns: 评分执行结果 """ - if exec_general_rating_scripts(self.cid)[0]: + res, info = exec_general_rating_scripts(self.cid) + if res: return "评分成功,请前往主页查看", 200 else: - return "评分失败,请检查数据,或联系管理员", 210 + return info, 210 @staticmethod def choose_industry_obj(): diff --git a/input/scripts.py b/input/scripts.py index 797e61b..c317161 100644 --- a/input/scripts.py +++ b/input/scripts.py @@ -205,8 +205,7 @@ def exec_general_rating_scripts(cid): record = find_rating_records({"企业ID": cid, "进行状态": "进行"}) if not record: - info = "没有正在进行的评价" - return info + return False, "没有正在进行的评价" # Parameters rid = record[0]["评价ID"] @@ -226,8 +225,7 @@ def exec_general_rating_scripts(cid): if res.status_code == 200: update_data = { "评价结果": 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) return True @@ -281,4 +279,6 @@ def exec_general_rating_scripts(cid): if not company_index(): return False, "准备企业主页数据失败" + update_rating_records({"评价ID": rid}, {"进行状态": "完成"}) + return True, "执行成功"