代码加密功能

dev_daiao
daiao 5 years ago
parent 292c3777d1
commit df6d956bdc

@ -51,9 +51,9 @@ class HackUserLastestCodesController < ApplicationController
# debug 与submit 公用的参数 # debug 与submit 公用的参数
ds_params = {input: testCase['input'], output: testCase['output'], hack_id: @hack.id, 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'], code: ojEvaResult['codeFileContent'], user_id: @my_hack.user_id, error_line: error_line,
error_msg: ojEvaResult['outPut'], execute_time: ojEvaResult['executeTime'], status: ojEvaResult['status'], error_msg: ojEvaResult['outPut'],
execute_memory: ojEvaResult['executeMem']} execute_time: ojEvaResult['executeTime'], execute_memory: ojEvaResult['executeMem']}
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
# debug模式与submit模式 # debug模式与submit模式
if ojEvaResult['execMode'] == "debug" if ojEvaResult['execMode'] == "debug"
@ -64,6 +64,7 @@ class HackUserLastestCodesController < ApplicationController
# 评测完成后,还原评测中的状态 # 评测完成后,还原评测中的状态
@my_hack.update_attribute(:submit_status, 0) @my_hack.update_attribute(:submit_status, 0)
end end
render_ok
rescue Exception => e rescue Exception => e
logger.error("#########listen_result: #{e.message}") logger.error("#########listen_result: #{e.message}")
end end

@ -24,9 +24,9 @@ class Hack < ApplicationRecord
def code def code
if hack_codes.count == 1 if hack_codes.count == 1
hack_codes.first.code tran_base64_decode64(hack_codes.first.code)
else else
hack_codes.pluck(:code) tran_base64_decode64(hack_codes.pluck(:code))
end end
end end

Loading…
Cancel
Save