From a96f6b6f14ccb5f4faebe0e3b28e87b6007d2fd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=80=9D=E5=B7=9D?= Date: Thu, 30 Dec 2021 14:24:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E6=8F=90=E5=89=8D=E5=AE=8C=E6=88=90BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- input/InputForm.py | 5 +++-- input/scripts.py | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) 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, "执行成功"