匿评作品详情接口添加评论的回复输出
This commit is contained in:
parent
f1693e237b
commit
4a672416e3
|
@ -12,7 +12,11 @@ module Mobile
|
|||
end
|
||||
anonymous_works_params_expose :is_teacher
|
||||
anonymous_works_params_expose :m_score
|
||||
anonymous_works_params_expose :jours
|
||||
expose :jours ,using: Mobile::Entities::Jours do |f, opt|
|
||||
if f.is_a?(Hash) && f.key?(:jours)
|
||||
f[:jours]
|
||||
end
|
||||
end
|
||||
expose :teacher_stars,using: Mobile::Entities::HomeworkJours do |f, opt|
|
||||
if f.is_a?(Hash) && f.key?(:teacher_stars)
|
||||
f[:teacher_stars]
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
module Mobile
|
||||
module Entities
|
||||
#带评分的留言(教师评论、学生匿名评分都属于此类)
|
||||
class HomeworkJours < Grape::Entity
|
||||
include Redmine::I18n
|
||||
def self.homework_jours_expose(field)
|
||||
|
@ -18,6 +19,7 @@ module Mobile
|
|||
expose :comment,using: Mobile::Entities::Jours do |f,opt|
|
||||
f[:comment]
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,7 +1,9 @@
|
|||
module Mobile
|
||||
module Entities
|
||||
#普通留言
|
||||
class Jours < Grape::Entity
|
||||
include Redmine::I18n
|
||||
include WordsHelper
|
||||
def self.jours_expose(field)
|
||||
expose field do |f,opt|
|
||||
if f.is_a?(Hash) && f.key?(field)
|
||||
|
@ -12,16 +14,24 @@ module Mobile
|
|||
else
|
||||
f.send(field)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
jours_expose :id
|
||||
expose :user,using: Mobile::Entities::User do |f, opt|
|
||||
f.user
|
||||
end
|
||||
jours_expose :created_on
|
||||
jours_expose :notes
|
||||
|
||||
jours_expose :m_reply_id
|
||||
expose :reply_user,using: Mobile::Entities::User do |f, opt|
|
||||
f.at_user
|
||||
end
|
||||
expose :child_reply,using: Mobile::Entities::Jours do |f, opt|
|
||||
if f.is_a?(::JournalsForMessage)
|
||||
fetch_user_leaveWord_reply(f)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue