42 lines
1.1 KiB
Ruby
42 lines
1.1 KiB
Ruby
#coding=utf-8
|
|
|
|
module Mobile
|
|
module Apis
|
|
class JournalForMessages< Grape::API
|
|
resources :journal_for_messages do
|
|
|
|
desc "get special journal"
|
|
post ':id' do
|
|
begin
|
|
# authenticate!
|
|
user = current_user
|
|
|
|
#0一级回复的更多 1 二级回复的更多
|
|
type = params[:type] || 0
|
|
page = params[:page] || 0
|
|
|
|
jour = JournalsForMessage.find params[:id]
|
|
|
|
is_public = 1
|
|
|
|
if jour.jour_type == "Project"
|
|
is_public = jour.project.is_public
|
|
elsif jour.jour_type == "Course"
|
|
is_public = jour.course.is_public
|
|
end
|
|
|
|
present :data, jour, with: Mobile::Entities::Jours,user: user,type: type,page: page
|
|
present :type, type
|
|
present :page, page
|
|
present :is_public, is_public
|
|
present :status, 0
|
|
rescue Exception=>e
|
|
present :status, -1
|
|
present :message, e.message
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|