diff --git a/app/controllers/hack_user_lastest_codes_controller.rb b/app/controllers/hack_user_lastest_codes_controller.rb index d3471e229..f2682c445 100644 --- a/app/controllers/hack_user_lastest_codes_controller.rb +++ b/app/controllers/hack_user_lastest_codes_controller.rb @@ -51,9 +51,9 @@ class HackUserLastestCodesController < ApplicationController # debug 与submit 公用的参数 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']} + code: ojEvaResult['codeFileContent'], 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 ojEvaResult['execMode'] == "debug" @@ -64,6 +64,7 @@ class HackUserLastestCodesController < ApplicationController # 评测完成后,还原评测中的状态 @my_hack.update_attribute(:submit_status, 0) end + render_ok rescue Exception => e logger.error("#########listen_result: #{e.message}") end diff --git a/app/models/hack.rb b/app/models/hack.rb index 9a6298f7c..1256aa53f 100644 --- a/app/models/hack.rb +++ b/app/models/hack.rb @@ -24,9 +24,9 @@ class Hack < ApplicationRecord def code if hack_codes.count == 1 - hack_codes.first.code + tran_base64_decode64(hack_codes.first.code) else - hack_codes.pluck(:code) + tran_base64_decode64(hack_codes.pluck(:code)) end end