优化下代码
This commit is contained in:
parent
4a672416e3
commit
b2396df68c
|
@ -1,5 +1,6 @@
|
|||
module Mobile
|
||||
module Entities
|
||||
#匿评作品页面相关参数
|
||||
class AnonymousWorksParams < Grape::Entity
|
||||
def self.anonymous_works_params_expose(field)
|
||||
expose field do |f,opt|
|
||||
|
@ -12,6 +13,8 @@ module Mobile
|
|||
end
|
||||
anonymous_works_params_expose :is_teacher
|
||||
anonymous_works_params_expose :m_score
|
||||
anonymous_works_params_expose :is_anonymous_comments
|
||||
anonymous_works_params_expose :cur_type
|
||||
expose :jours ,using: Mobile::Entities::Jours do |f, opt|
|
||||
if f.is_a?(Hash) && f.key?(:jours)
|
||||
f[:jours]
|
||||
|
@ -27,9 +30,6 @@ module Mobile
|
|||
f[:student_stars]
|
||||
end
|
||||
end
|
||||
anonymous_works_params_expose :is_anonymous_comments
|
||||
anonymous_works_params_expose :cur_type
|
||||
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue