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')