2016-03-30 17:47:44 +08:00
|
|
|
#coding=utf-8
|
|
|
|
|
|
|
|
module Mobile
|
|
|
|
module Apis
|
|
|
|
class Issues< Grape::API
|
|
|
|
resources :issues do
|
2016-04-01 18:23:12 +08:00
|
|
|
include IssuesHelper
|
2016-03-30 17:47:44 +08:00
|
|
|
|
|
|
|
desc "get special issuse"
|
2016-07-20 13:34:58 +08:00
|
|
|
post ':id' do
|
2016-08-09 10:55:16 +08:00
|
|
|
begin
|
|
|
|
# authenticate!
|
|
|
|
user = current_user
|
2016-07-20 13:34:58 +08:00
|
|
|
|
2016-08-09 17:01:06 +08:00
|
|
|
#is_public true 公开 false 私有 1公开 0私有
|
|
|
|
|
2016-08-09 10:55:16 +08:00
|
|
|
#0一级回复的更多 1 二级回复的更多
|
|
|
|
type = params[:type] || 0
|
|
|
|
page = params[:page] || 0
|
2016-08-25 09:45:23 +08:00
|
|
|
|
|
|
|
is_public = 1
|
|
|
|
|
|
|
|
if type == 0
|
|
|
|
issue = Issue.find params[:id]
|
|
|
|
issue.project.is_public
|
|
|
|
present :data, issue, with: Mobile::Entities::Issue,user: user,type: type,page: page
|
|
|
|
else
|
|
|
|
jour = Journal.find params[:id]
|
|
|
|
present :data, jour, with: Mobile::Entities::Issue,user: user,type: type,page: page
|
|
|
|
end
|
|
|
|
|
2016-08-09 10:55:16 +08:00
|
|
|
present :type, type
|
|
|
|
present :page, page
|
2016-08-25 09:45:23 +08:00
|
|
|
present :is_public,is_public
|
2016-08-09 10:55:16 +08:00
|
|
|
present :status, 0
|
|
|
|
rescue Exception=>e
|
|
|
|
present :status, -1
|
|
|
|
present :message, e.message
|
|
|
|
end
|
2016-03-30 17:47:44 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|