Kaynağa Gözat

统一返回接口

blumonilr 5 yıl önce
ebeveyn
işleme
3f807e7adb
2 değiştirilmiş dosya ile 3 ekleme ve 3 silme
  1. 2 2
      web/app.py
  2. 1 1
      web/judgement.py

+ 2 - 2
web/app.py

@@ -30,8 +30,8 @@ def judge():
     memory_limit = int(data['memoryLimit'])
     input_list = data['inputList']
     output_list = data['outputList']
-    if len(input_list)!=len(output_list):
-        return {'result': "System Error",
+    if len(input_list) != len(output_list):
+        return {"result_list": [{'result': "System Error"}],
                 'message': 'test data incompleted'}
     td_total = len(input_list)
     save_test_cases(input_list, output_list, td_total)

+ 1 - 1
web/judgement.py

@@ -64,7 +64,7 @@ def run(args, in_path, out_path, time_limit, memory_limit):
         ftemp.close()
         os.remove('temp.out')
         if crst != 0:
-            return {'result': crst}
+            return {"result_list:" : [{'result': crst}]}
 
     return rst