22 lines
617 B
Ruby
22 lines
617 B
Ruby
#coding=utf-8
|
|
module Mobile
|
|
module Apis
|
|
class Comments < Grape::API
|
|
resource :comments do
|
|
desc '课程通知评论'
|
|
params do
|
|
requires :token, type: String
|
|
requires :comment, type: String
|
|
end
|
|
post ':id' do
|
|
cs = CommentService.new
|
|
comments = cs.news_comments params,current_user
|
|
raise "create comments failed #{comments.errors.full_messages}" if comments.new_record?
|
|
present :data, comments, with: Mobile::Entities::Comment
|
|
present :status, 0
|
|
end
|
|
|
|
end
|
|
end
|
|
end
|
|
end |