|
|
|
@ -1,9 +1,9 @@
|
|
|
|
|
class HackUserLastestCodesController < ApplicationController
|
|
|
|
|
before_action :require_login, except: [:listen_result]
|
|
|
|
|
before_action :find_my_hack, only: [:show, :code_debug, :code_submit, :update_code,
|
|
|
|
|
:listen_result, :result, :submit_records]
|
|
|
|
|
:listen_result, :result, :submit_records, :restore_initial_code]
|
|
|
|
|
before_action :update_user_hack_status, only: [:code_debug, :code_submit]
|
|
|
|
|
before_action :require_auth_identity, only: [:update_code]
|
|
|
|
|
before_action :require_auth_identity, only: [:update_code, :restore_initial_code]
|
|
|
|
|
before_action :require_manager_identity, only: [:update_code]
|
|
|
|
|
|
|
|
|
|
def show
|
|
|
|
@ -14,6 +14,11 @@ class HackUserLastestCodesController < ApplicationController
|
|
|
|
|
@my_hack.update_attribute(:code, params[:code])
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 回复初始代码
|
|
|
|
|
def restore_initial_code
|
|
|
|
|
@my_hack.update_attribute(:code, @hack.code)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 调试代码
|
|
|
|
|
def code_debug
|
|
|
|
|
exec_mode = "debug"
|
|
|
|
|