|
|
@ -61,7 +61,7 @@ class HacksController < ApplicationController
|
|
|
|
hack_codes = hack.hack_codes.new(hack_code_params)
|
|
|
|
hack_codes = hack.hack_codes.new(hack_code_params)
|
|
|
|
hack_codes.modify_time = Time.now
|
|
|
|
hack_codes.modify_time = Time.now
|
|
|
|
hack_codes.save!
|
|
|
|
hack_codes.save!
|
|
|
|
new_item_params = item_params.merge({container: hack, item_type: 'PROGRAM', difficulty: params[:difficult], user_id: current_user.id})
|
|
|
|
new_item_params = item_params.merge({container: hack, item_type: 'PROGRAM', difficulty: params[:hack][:difficult], user_id: current_user.id})
|
|
|
|
ItemBank.create!(new_item_params)
|
|
|
|
ItemBank.create!(new_item_params)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
render_ok({identifier: hack.identifier})
|
|
|
|
render_ok({identifier: hack.identifier})
|
|
|
@ -95,7 +95,7 @@ class HacksController < ApplicationController
|
|
|
|
|
|
|
|
|
|
|
|
# 更新题库相关记录
|
|
|
|
# 更新题库相关记录
|
|
|
|
if @hack.item_bank.present?
|
|
|
|
if @hack.item_bank.present?
|
|
|
|
update_item_params = item_params.merge({difficulty: params[:difficult]})
|
|
|
|
update_item_params = item_params.merge({difficulty: params[:hack][:difficult]})
|
|
|
|
@hack.item_bank.update!(update_item_params)
|
|
|
|
@hack.item_bank.update!(update_item_params)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|