From 07d77b2cd0ba082cd80c4f4e086fc962315d472a Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 18 Nov 2019 19:21:36 +0800 Subject: [PATCH] 1 --- .../hack_user_lastest_codes_controller.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/controllers/hack_user_lastest_codes_controller.rb b/app/controllers/hack_user_lastest_codes_controller.rb index efdbccf73..f17c65270 100644 --- a/app/controllers/hack_user_lastest_codes_controller.rb +++ b/app/controllers/hack_user_lastest_codes_controller.rb @@ -41,16 +41,18 @@ class HackUserLastestCodesController < ApplicationController def listen_result logger.info("###########listen_result:#{params}") begin - msg = JSON.parse(params[:msg]) + ojEvaResult = JSON.parse(params[:ojEvaResult]) + testCase = ojEvaResult['testCase'] # 只有编译出错时,才正则匹配错误行数 error_line= if params[:status] == "-4" - regular_match_error_line params[:outPut], @my_hack.hack.language + regular_match_error_line ojEvaResult['outPut'], @my_hack.hack.language end # debug 与submit 公用的参数 - ds_params = {input: msg['input'], output: msg['output'], hack_id: @hack.id, user_id: @my_hack.user_id, - error_line: error_line, status: params[:status], error_msg: params[:outPut], - execute_time: params[:executeTime], execute_memory: params[:executeMem]} + ds_params = {input: testCase['input'], output: testCase['output'], hack_id: @hack.id, + user_id: @my_hack.user_id, error_line: error_line, status: ojEvaResult['status'], + error_msg: ojEvaResult[:outPut], execute_time: ojEvaResult['executeTime'], + execute_memory: ojEvaResult['executeMem']} ActiveRecord::Base.transaction do # debug模式与submit模式 if params[:execMode] == "debug"