|
|
|
@ -73,14 +73,20 @@ class HackUserLastestCodesController < ApplicationController
|
|
|
|
|
|
|
|
|
|
def oj_evaluate exec_mode, error_status, error_msg
|
|
|
|
|
request_url = "#{edu_setting('cloud_bridge')}/bridge/ojs/evaluate"
|
|
|
|
|
testCases = Base64.urlsafe_encode64({input: params[:input]}.to_json)
|
|
|
|
|
test_sets =
|
|
|
|
|
if exec_mode == "normal"
|
|
|
|
|
@hack.hack_sets.map{|set| {input: set.input, output: set.output, caseId: set.id}}
|
|
|
|
|
else
|
|
|
|
|
{input: params[:input]}
|
|
|
|
|
end
|
|
|
|
|
testCases = Base64.urlsafe_encode64(test_sets.to_json)
|
|
|
|
|
debug_params = {execMode: exec_mode,
|
|
|
|
|
tpiID: @my_hack.identifier,
|
|
|
|
|
testCases: testCases,
|
|
|
|
|
platform: @my_hack.language,
|
|
|
|
|
codeFileContent: @my_hack.code,
|
|
|
|
|
timeLimit: @hack.time_limit,
|
|
|
|
|
sec_key: Time.now.to_s}
|
|
|
|
|
sec_key: Time.now.to_i}
|
|
|
|
|
interface_post request_url, debug_params, error_status, error_msg
|
|
|
|
|
# 每次评测提交数增加
|
|
|
|
|
@hack.increment!(:submit_num)
|
|
|
|
|