Commit 78978de5 by ivan Lan

Add catalog tree & Fix series controller

parent 95b0dcd0
...@@ -43,6 +43,10 @@ module Shotengai ...@@ -43,6 +43,10 @@ module Shotengai
raise Shotengai::WebError.new('Illegality catalge name chain', '-1', '400') raise Shotengai::WebError.new('Illegality catalge name chain', '-1', '400')
end end
def tree
where(super_catalog_id: nil).map(&:tree)
end
# def input_from_file # def input_from_file
# end # end
end end
...@@ -64,5 +68,14 @@ module Shotengai ...@@ -64,5 +68,14 @@ module Shotengai
def brothers def brothers
super_catalog.sub_catalogs super_catalog.sub_catalogs
end end
def tree
{
name: name,
iamge: iamge,
level_type: level_type,
sub_catalogs: sub_catalogs.map(&:tree)
}
end
end end
end end
...@@ -6,6 +6,8 @@ module Shotengai ...@@ -6,6 +6,8 @@ module Shotengai
self.template_dir = 'shotengai/merchant/series/' self.template_dir = 'shotengai/merchant/series/'
before_action :manager_auth before_action :manager_auth
skip_before_action :set_resource, only: :batch_event
# add_actions :batch_event # add_actions :batch_event
def default_query resources def default_query resources
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment