From b1903dba116716a2470fcef3fab6d99dd4e9c98e Mon Sep 17 00:00:00 2001 From: z9hang Date: Fri, 6 Feb 2015 10:35:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AF=BE=E7=A8=8B=E7=95=99?= =?UTF-8?q?=E8=A8=80=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/comments.rb | 16 ++++++++++++++++ app/services/comment_service.rb | 6 ++++++ 2 files changed, 22 insertions(+) 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