forgeplus/app/controllers/admins/import_disciplines_controll...

10 lines
394 B
Ruby
Raw Permalink Normal View History

2020-03-09 00:40:16 +08:00
class Admins::ImportDisciplinesController < Admins::BaseController
def create
return render_error('请上传正确的文件') if params[:file].blank? || !params[:file].is_a?(ActionDispatch::Http::UploadedFile)
result = Admins::ImportDisciplineService.call(params[:file].to_io)
render_ok(result)
rescue Admins::ImportDisciplineService::Error => ex
render_error(ex)
end
end