小程序接口

dev_home
cxt 5 years ago
parent 28f88b258e
commit 39d3312f8d

@ -1,6 +1,6 @@
class Weapps::CoursesController < Weapps::BaseController
# before_action :require_wechat_login!
before_action :teacher_allowed, except: [:create, :show]
before_action :teacher_allowed, except: [:create, :show, :shixun_homework_category]
def create
return render_error("只有老师身份才能创建课堂") unless current_user.is_teacher?
@ -26,6 +26,10 @@ class Weapps::CoursesController < Weapps::BaseController
@current_user = current_user
end
def shixun_homework_category
@categories = current_course.shixun_course_modules.first&.course_second_categories
end
private
def course_params

@ -0,0 +1,3 @@
json.categories @categories.each do |category|
json.(category, :id, :name)
end

@ -880,7 +880,11 @@ Rails.application.routes.draw do
post :cancel_sticky, on: :collection
end
resources :courses, only: [:create, :update, :edit, :show]
resources :courses, only: [:create, :update, :edit, :show] do
member do
get :shixun_homework_category
end
end
end
resources :users_for_partners, only: [:index]

Loading…
Cancel
Save