From 18c29630b95ab94834284d42dea64842f187c53d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A6=E6=9E=97=E9=BE=99?= <10182100242@stu.ecnu.edu.cn> Date: Sat, 30 Jan 2021 20:07:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?= =?UTF-8?q?=20'be'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- be/app.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/be/app.py b/be/app.py index eb9e897..fd76f14 100644 --- a/be/app.py +++ b/be/app.py @@ -18,7 +18,7 @@ db = pymysql.connect(host='192.168.0.89', user='root', password='2020yunjisuan!', db='shuishan', - charset='utf8') + charset='utf8mb4') @app.route('/get-problem-items/') @@ -77,8 +77,13 @@ def get_problem_description(_id: str): def case_test_(): pid: str = request.json.get("pid") code: str = request.json.get("code") + + pid = str(pid) + code = str(code) with open('wulin.txt', 'w', encoding='utf-8', newline='') as f: - f.write(pid) + f.write(pid+"\n") + f.write(code + "\n") + f.close() results = testcase.submit_handler(code, pid, 'C') @@ -108,8 +113,11 @@ def check_logic_error(): def submit(): pid: str = request.json.get("pid") code: str = request.json.get("code") + pid = str(pid) + code = str(code) with open('wulin2.txt', 'w', encoding='utf-8', newline='') as f: - f.write(pid) + f.write(pid + "\n") + f.write(code + "\n") f.close() results = mysubmit.submit_handler(code, pid, 'C')