From 46289fd85061e4f84a1cfc6b4f3773370033f381 Mon Sep 17 00:00:00 2001 From: P3ngSaM <61768364+P3ngSaM@users.noreply.github.com> Date: Tue, 1 Mar 2022 09:56:33 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E7=94=9F=E6=88=90=E8=AF=81=E4=B9=A6?= =?UTF-8?q?=E5=8A=A0=E5=85=A5ESG=E8=AF=84=E4=BB=B7=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- esg/esg_impl.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/esg/esg_impl.py b/esg/esg_impl.py index f2167ae..f9e905d 100644 --- a/esg/esg_impl.py +++ b/esg/esg_impl.py @@ -240,6 +240,27 @@ def exec_esg_rating_scripts(cid): else: return False + # 生成证书 + def gen_certified(): + url = "http://139.9.249.34:51012/tfse_rating/certificate/generate_certificate" + token = "X0gSlC!YE8jmr2jJr&ilcjS83j!tsoh5" + headers = {'token': token, "Content-Type": "application/json;charset=UTF-8"} + data = { + "company": rating_inputs['企业名称'], + "cid": rating_inputs['企业ID'], + "rid": rating_inputs['评价ID'], + "type": "esg" + } + res = requests.post(url, headers=headers, data=json.dumps(data)) + if res.status_code == 200: + update_data = { + "证书fid": json.loads(res.text)['result']['FileID'] + } + update_rating_records({"评价ID": rid}, update_data) + return True + else: + return False + # 生成企业主页数据 def esg_index(): url = "http://139.9.249.34:51011/etl_tfse/company/esg_index_etl" @@ -260,6 +281,9 @@ def exec_esg_rating_scripts(cid): if not gen_report(): return False, "生成报告失败" + if not gen_certified(): + return False, "生成证书失败" + if not esg_index(): return False, "准备主页数据失败"