课程通知发布api
This commit is contained in:
parent
3b137dadb8
commit
e1dd4823d5
|
@ -297,6 +297,20 @@ module Mobile
|
|||
present :data,homeworkscore,with: Mobile::Entities::Homeworkscore
|
||||
present :status,0
|
||||
end
|
||||
|
||||
desc '发布课程通知'
|
||||
params do
|
||||
requires :token,type:String
|
||||
requires :course_id,type:Integer,desc:'课程id'
|
||||
requires :title,type:String,desc:'通知标题'
|
||||
requires :desc,type:String,desc:'通知描述'
|
||||
end
|
||||
post ':course_id/create_course_notice' do
|
||||
cs = CoursesService.new
|
||||
news = cs.create_course_notice params,current_user
|
||||
present :data,news,with:Mobile::Entities::News
|
||||
present :status,0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -508,6 +508,12 @@ class CoursesService
|
|||
end
|
||||
end
|
||||
|
||||
def create_course_notice params ,current_user
|
||||
n = News.new(:course_id =>params[:course_id], :author_id => current_user.id,:title =>params[:title],:description=> params[:desc])
|
||||
n.save
|
||||
{:id => n.id,:title => n.title,:author_name => n.author.name,:author_id => n.author.id, :description => n.description,:created_on => format_time(n.created_on),:comments_count => n.comments_count}
|
||||
end
|
||||
|
||||
private
|
||||
def searchmember_by_name members, name
|
||||
#searchPeopleByRoles(project, StudentRoles)
|
||||
|
|
Loading…
Reference in New Issue