添加课程留言接口

This commit is contained in:
z9hang 2015-02-06 10:35:38 +08:00
parent 0dfa428377
commit b1903dba11
2 changed files with 22 additions and 0 deletions

View File

@ -38,6 +38,22 @@ module Mobile
present :status, 0 present :status, 0
end end
desc '课程留言'
params do
requires :token, type: String
requires :course_message,type: String, desc: '留言'
end
post ':id/leave_course_message' do
cs_params = {
id: params[:id],
token: params[:token],
new_form: params.reject{|k,v| [:id,:token].include?(k)}}
cs = CommentService.new
message = cs.leave_course_message cs_params,current_user
present :data, message, with: Mobile::Entities::Jours
present :status, 0
end
desc '回复留言' desc '回复留言'
params do params do
requires :token, type: String requires :token, type: String

View File

@ -36,6 +36,12 @@ class CommentService
@bid.set_commit(@feedback_count) @bid.set_commit(@feedback_count)
jfm jfm
end end
#课程留言接口
def leave_course_message params,current_user
message = params[:new_form][:course_message]
feedback = Course.add_new_jour(current_user, message, params[:id])
feedback
end
#回复留言接口 #回复留言接口
def create_reply params,current_user def create_reply params,current_user