From 921655567a55cfdfb8f5e0e90fca469dcdf5c3a8 Mon Sep 17 00:00:00 2001 From: "sylor_huang@126.com" Date: Thu, 15 Oct 2020 14:47:48 +0800 Subject: [PATCH] change my_interested bugs --- app/helpers/api_index_helper.rb | 2 +- app/services/memos_service.rb | 2 +- app/services/my_memos_service.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/helpers/api_index_helper.rb b/app/helpers/api_index_helper.rb index 3abd1802..22308655 100644 --- a/app/helpers/api_index_helper.rb +++ b/app/helpers/api_index_helper.rb @@ -264,7 +264,7 @@ module ApiIndexHelper def get_all_sections(sections) section_item = [] sections.each do |tag| - children_tags = tag.children.as_json(only: [:id, :title]).map{|k| k["forum_section"]} + children_tags = tag.children.as_json(only: [:id, :title]) section_item.push({ id: tag.id, title: tag.title, diff --git a/app/services/memos_service.rb b/app/services/memos_service.rb index 8e18e528..67c69a43 100644 --- a/app/services/memos_service.rb +++ b/app/services/memos_service.rb @@ -162,7 +162,7 @@ class MemosService current_login: current_user.try(:login), is_current_user: memo.author_id == current_user.try(:id) } - recent_memos = memo_author_memos.posts.where("id != ?", params[:id].to_i).order_index("published_at").select([:id,:subject]).limit(3).as_json.map{|k| k["memo"]} + recent_memos = memo_author_memos.posts.where("id != ?", params[:id].to_i).order_index("published_at").select([:id,:subject]).limit(3).as_json memo_info = {id: memo.id, subject: memo.subject, diff --git a/app/services/my_memos_service.rb b/app/services/my_memos_service.rb index 9a98fd32..8a75a0a8 100644 --- a/app/services/my_memos_service.rb +++ b/app/services/my_memos_service.rb @@ -51,7 +51,7 @@ class MyMemosService end forum_sections_count = forum_sections.size # 帖子的总数 forum_sections = forum_sections.limit(index_limit).offset(offset) - all_forum_sections = forum_sections.as_json.map{|k,v| k["forum_section"]} + all_forum_sections = forum_sections.as_json { count: forum_sections_count, forum_details: all_forum_sections,