dev_daiao
daiao 5 years ago
parent dd9eedd93b
commit 07d77b2cd0

@ -41,16 +41,18 @@ class HackUserLastestCodesController < ApplicationController
def listen_result def listen_result
logger.info("###########listen_result#{params}") logger.info("###########listen_result#{params}")
begin begin
msg = JSON.parse(params[:msg]) ojEvaResult = JSON.parse(params[:ojEvaResult])
testCase = ojEvaResult['testCase']
# 只有编译出错时,才正则匹配错误行数 # 只有编译出错时,才正则匹配错误行数
error_line= error_line=
if params[:status] == "-4" 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 end
# debug 与submit 公用的参数 # debug 与submit 公用的参数
ds_params = {input: msg['input'], output: msg['output'], hack_id: @hack.id, user_id: @my_hack.user_id, ds_params = {input: testCase['input'], output: testCase['output'], hack_id: @hack.id,
error_line: error_line, status: params[:status], error_msg: params[:outPut], user_id: @my_hack.user_id, error_line: error_line, status: ojEvaResult['status'],
execute_time: params[:executeTime], execute_memory: params[:executeMem]} error_msg: ojEvaResult[:outPut], execute_time: ojEvaResult['executeTime'],
execute_memory: ojEvaResult['executeMem']}
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
# debug模式与submit模式 # debug模式与submit模式
if params[:execMode] == "debug" if params[:execMode] == "debug"

Loading…
Cancel
Save