|
|
|
@ -1,13 +1,14 @@
|
|
|
|
|
class HackUserLastestCodesController < ApplicationController
|
|
|
|
|
before_action :require_login, except: [:listen_result]
|
|
|
|
|
before_action :find_my_hack, only: [:show, :code_debug, :code_submit, :update_code,
|
|
|
|
|
before_action :find_my_hack, only: [:show, :code_debug, :code_submit, :update_code, :sync_code,
|
|
|
|
|
: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, :restore_initial_code]
|
|
|
|
|
before_action :require_auth_identity, only: [:update_code, :restore_initial_code, :sync_code]
|
|
|
|
|
before_action :require_manager_identity, only: [:update_code]
|
|
|
|
|
|
|
|
|
|
def show
|
|
|
|
|
@my_hack.update_attribute(:submit_status, 0) if @my_hack.submit_status == 1
|
|
|
|
|
@modify = @my_hack.modify_time.to_i < @hack.modify_time.to_i
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def update_code
|
|
|
|
@ -20,6 +21,11 @@ class HackUserLastestCodesController < ApplicationController
|
|
|
|
|
@my_hack.update_attribute(:code, @hack.code)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 同步代码
|
|
|
|
|
def sync_code
|
|
|
|
|
@my_hack.update_attributes(code: @hack.code, modify_time: @hack.modify_time)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 调试代码
|
|
|
|
|
def code_debug
|
|
|
|
|
exec_mode = "debug"
|
|
|
|
|