forgeplus/app/controllers/admins/import_course_members_contr...

10 lines
400 B
Ruby

class Admins::ImportCourseMembersController < Admins::BaseController
def create
return render_error('请上传正确的文件') if params[:file].blank? || !params[:file].is_a?(ActionDispatch::Http::UploadedFile)
result = Admins::ImportCourseMemberService.call(params[:file].to_io)
render_ok(result)
rescue Admins::ImportCourseMemberService::Error => ex
render_error(ex)
end
end