|
|
@ -6,11 +6,14 @@ module Mobile
|
|
|
|
desc '课程通知评论'
|
|
|
|
desc '课程通知评论'
|
|
|
|
params do
|
|
|
|
params do
|
|
|
|
requires :token, type: String
|
|
|
|
requires :token, type: String
|
|
|
|
requires :comment, type: String
|
|
|
|
requires :comments, type: String
|
|
|
|
end
|
|
|
|
end
|
|
|
|
post ':id' do
|
|
|
|
post ':id' do
|
|
|
|
cs = CommentService.new
|
|
|
|
cs = CommentService.new
|
|
|
|
comments = cs.news_comments params,current_user
|
|
|
|
cs_params = {
|
|
|
|
|
|
|
|
id: params[:id],
|
|
|
|
|
|
|
|
comment: params.reject{|k,v| [:id].include?(k)}}
|
|
|
|
|
|
|
|
comments = cs.news_comments cs_params,current_user
|
|
|
|
raise "create comments failed #{comments.errors.full_messages}" if comments.new_record?
|
|
|
|
raise "create comments failed #{comments.errors.full_messages}" if comments.new_record?
|
|
|
|
present :data, comments, with: Mobile::Entities::Comment
|
|
|
|
present :data, comments, with: Mobile::Entities::Comment
|
|
|
|
present :status, 0
|
|
|
|
present :status, 0
|
|
|
|