diff --git a/app/api/mobile/apis/comments.rb b/app/api/mobile/apis/comments.rb index 3f252070f..a7eea735d 100644 --- a/app/api/mobile/apis/comments.rb +++ b/app/api/mobile/apis/comments.rb @@ -38,6 +38,22 @@ module Mobile present :status, 0 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 '回复留言' params do requires :token, type: String diff --git a/app/services/comment_service.rb b/app/services/comment_service.rb index 5a5667a92..42dc8c415 100644 --- a/app/services/comment_service.rb +++ b/app/services/comment_service.rb @@ -36,6 +36,12 @@ class CommentService @bid.set_commit(@feedback_count) jfm 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