详情api
This commit is contained in:
parent
6f9fcbe1a7
commit
313d415a15
|
@ -8,7 +8,7 @@ module Mobile
|
||||||
desc "get special topic"
|
desc "get special topic"
|
||||||
get ':id' do
|
get ':id' do
|
||||||
blog = BlogComment.find params[:id]
|
blog = BlogComment.find params[:id]
|
||||||
present :blog, message, with: Mobile::Entities::BlogComment
|
present :data, blog, with: Mobile::Entities::BlogComment
|
||||||
present :status, 0
|
present :status, 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,10 +15,12 @@ module Mobile
|
||||||
u.send(f)
|
u.send(f)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
# case f
|
case f
|
||||||
# when :xx
|
when :blog_praise_count
|
||||||
# #
|
get_activity_praise_num(u)
|
||||||
# end
|
when :lasted_comment
|
||||||
|
time_from_now(u.created_at)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -35,7 +37,9 @@ module Mobile
|
||||||
blog_comment_expose :content
|
blog_comment_expose :content
|
||||||
blog_comment_expose :comments_count
|
blog_comment_expose :comments_count
|
||||||
blog_comment_expose :created_at
|
blog_comment_expose :created_at
|
||||||
|
blog_comment_expose :lasted_comment
|
||||||
blog_comment_expose :id
|
blog_comment_expose :id
|
||||||
|
blog_comment_expose :blog_praise_count
|
||||||
expose :blog_comment_children, using:Mobile::Entities::BlogComment do |c,opt|
|
expose :blog_comment_children, using:Mobile::Entities::BlogComment do |c,opt|
|
||||||
if c.is_a? (::BlogComment)
|
if c.is_a? (::BlogComment)
|
||||||
c.children
|
c.children
|
||||||
|
|
|
@ -15,9 +15,9 @@ module Mobile
|
||||||
f.send(field)
|
f.send(field)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
case f
|
case field
|
||||||
when :course_name
|
when :lasted_comment
|
||||||
f[:jour_type] == "Course" ? f.course.name : ""
|
time_from_now f.created_on
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -29,6 +29,7 @@ module Mobile
|
||||||
f.user
|
f.user
|
||||||
end
|
end
|
||||||
jours_expose :created_on
|
jours_expose :created_on
|
||||||
|
jours_expose :lasted_comment
|
||||||
jours_expose :notes
|
jours_expose :notes
|
||||||
jours_expose :m_reply_id
|
jours_expose :m_reply_id
|
||||||
jours_expose :m_parent_id
|
jours_expose :m_parent_id
|
||||||
|
|
|
@ -15,10 +15,16 @@ module Mobile
|
||||||
u.send(f)
|
u.send(f)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
# case f
|
case f
|
||||||
# when :xx
|
when :course_project_name
|
||||||
# #
|
if u.board.project_id == -1
|
||||||
# end
|
u.course.name
|
||||||
|
else
|
||||||
|
u.project.name
|
||||||
|
end
|
||||||
|
when :lasted_comment
|
||||||
|
time_from_now u.created_on
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -30,12 +36,14 @@ module Mobile
|
||||||
c.author
|
c.author
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
message_expose :course_project_name
|
||||||
message_expose :board_id
|
message_expose :board_id
|
||||||
message_expose :subject
|
message_expose :subject
|
||||||
message_expose :content
|
message_expose :content
|
||||||
message_expose :replies_count
|
message_expose :replies_count
|
||||||
message_expose :created_on
|
message_expose :created_on
|
||||||
message_expose :id
|
message_expose :id
|
||||||
|
message_expose :lasted_comment
|
||||||
expose :message_children,using:Mobile::Entities::Message do |c,opt|
|
expose :message_children,using:Mobile::Entities::Message do |c,opt|
|
||||||
if c.is_a? (::Message)
|
if c.is_a? (::Message)
|
||||||
c.children
|
c.children
|
||||||
|
|
|
@ -7,10 +7,17 @@ module Mobile
|
||||||
if f.is_a?(Hash) && f.key?(field)
|
if f.is_a?(Hash) && f.key?(field)
|
||||||
f[field]
|
f[field]
|
||||||
elsif f.is_a?(::News)
|
elsif f.is_a?(::News)
|
||||||
if field == :created_on
|
if f.respond_to?(field)
|
||||||
format_time(f.send(field)) if f.respond_to?(field)
|
if field == :created_on
|
||||||
|
format_time(f.send(field))
|
||||||
|
else
|
||||||
|
f.send(field)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
f.send(field) if f.respond_to?(field)
|
case field
|
||||||
|
when :course_name
|
||||||
|
Course.find(f.course_id).name unless f.course_id == nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
elsif f.is_a?(Hash) && !f.key?(field)
|
elsif f.is_a?(Hash) && !f.key?(field)
|
||||||
n = f[:news]
|
n = f[:news]
|
||||||
|
@ -52,6 +59,8 @@ module Mobile
|
||||||
news_expose :created_on
|
news_expose :created_on
|
||||||
#评论数量
|
#评论数量
|
||||||
news_expose :comments_count
|
news_expose :comments_count
|
||||||
|
#课程名字
|
||||||
|
news_expose :course_name
|
||||||
#评论
|
#评论
|
||||||
expose :comments, using: Mobile::Entities::Comment do |f, opt|
|
expose :comments, using: Mobile::Entities::Comment do |f, opt|
|
||||||
if f.is_a?(Hash) && f.key?(:comments)
|
if f.is_a?(Hash) && f.key?(:comments)
|
||||||
|
|
|
@ -32,14 +32,14 @@ module Mobile
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
student_work_expose :student_id
|
student_work_expose :student_id
|
||||||
student_work_expose :id
|
student_work_expose :id
|
||||||
student_work_expose :name
|
student_work_expose :name
|
||||||
student_work_expose :description
|
student_work_expose :description
|
||||||
student_work_expose :final_score
|
student_work_expose :final_score
|
||||||
student_work_expose :teacher_score
|
student_work_expose :teacher_score
|
||||||
student_work_expose :student_score
|
student_work_expose :student_score
|
||||||
student_work_expose :teacher_asistant_score
|
student_work_expose :teacher_asistant_score
|
||||||
student_work_expose :created_at
|
student_work_expose :created_at
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -8,14 +8,14 @@ module Mobile
|
||||||
def self.whomework_expose(f)
|
def self.whomework_expose(f)
|
||||||
expose f do |wh, opt|
|
expose f do |wh, opt|
|
||||||
if wh.is_a?(Hash) && wh.key?(f)
|
if wh.is_a?(Hash) && wh.key?(f)
|
||||||
if f == :created_at
|
wh[f]
|
||||||
format_time(wh[f])
|
|
||||||
else
|
|
||||||
wh[f]
|
|
||||||
end
|
|
||||||
elsif wh.is_a?(::HomeworkCommon)
|
elsif wh.is_a?(::HomeworkCommon)
|
||||||
if wh.respond_to?(f)
|
if wh.respond_to?(f)
|
||||||
wh.send(f)
|
if f == :created_at
|
||||||
|
format_time(wh.send(f))
|
||||||
|
else
|
||||||
|
wh.send(f)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
case f
|
case f
|
||||||
when :absence_penalty
|
when :absence_penalty
|
||||||
|
@ -28,6 +28,8 @@ module Mobile
|
||||||
get_activity_praise_num(wh)
|
get_activity_praise_num(wh)
|
||||||
when :whomework_journal_count
|
when :whomework_journal_count
|
||||||
wh.journals_for_messages.count
|
wh.journals_for_messages.count
|
||||||
|
when :course_name
|
||||||
|
wh.course.name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -49,6 +51,7 @@ module Mobile
|
||||||
expose :anonymous_comment
|
expose :anonymous_comment
|
||||||
expose :quotes
|
expose :quotes
|
||||||
expose :is_open
|
expose :is_open
|
||||||
|
whomework_expose :course_name
|
||||||
whomework_expose :created_at
|
whomework_expose :created_at
|
||||||
whomework_expose :absence_penalty
|
whomework_expose :absence_penalty
|
||||||
whomework_expose :evaluation_start
|
whomework_expose :evaluation_start
|
||||||
|
|
Loading…
Reference in New Issue