dev_jupyter
cxt 5 years ago
parent 2ac99588ac
commit 58482e5f9e

@ -23,6 +23,7 @@ class ApplicationController < ActionController::Base
# 所有请求必须合法签名 # 所有请求必须合法签名
def check_sign def check_sign
unless Rails.env.development?
Rails.logger.info("66666 #{params}") Rails.logger.info("66666 #{params}")
suffix = request.url.split(".").last.split("?").first suffix = request.url.split(".").last.split("?").first
suffix_arr = ["xls", "xlsx", "pdf"] # excel文件先注释 suffix_arr = ["xls", "xlsx", "pdf"] # excel文件先注释
@ -39,6 +40,7 @@ class ApplicationController < ActionController::Base
end end
end end
end end
end
# 全局配置参数 # 全局配置参数
# 返回name对应的value # 返回name对应的value

@ -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

@ -7,7 +7,7 @@ class ItemBanksController < ApplicationController
def index def index
items = ItemBankQuery.call(params) items = ItemBankQuery.call(params)
@items_count = items.size @items_count = items.size
@items = paginate items.includes(:item_analysis, :user) @items = paginate items.includes(:item_analysis, :user, :container)
@item_basket_ids = current_user.item_baskets.pluck(:item_bank_id) @item_basket_ids = current_user.item_baskets.pluck(:item_bank_id)
end end

@ -4,3 +4,8 @@ json.choices item.item_choices do |choice|
json.choice_text choice.choice_text json.choice_text choice.choice_text
json.is_answer choice.is_answer json.is_answer choice.is_answer
end end
if item.item_type == "PROGRAM"
json.program_attr do
json.(item.container, :description, :language, :difficult)
end
end
Loading…
Cancel
Save