From e18063d7ca0ce2fe113e6e0aeb20364889d5da86 Mon Sep 17 00:00:00 2001 From: xxq250 Date: Tue, 4 Apr 2023 17:20:33 +0800 Subject: [PATCH] =?UTF-8?q?fixed=20bot=E5=AE=89=E8=A3=85=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=8C=89=E5=AE=89=E8=A3=85=E8=80=85=E5=88=86=E7=BB=84,?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/installations/index.json.jbuilder | 10 +++++++++- app/views/installations/show.json.jbuilder | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/app/views/installations/index.json.jbuilder b/app/views/installations/index.json.jbuilder index 9235bd4f8..366bdeeca 100644 --- a/app/views/installations/index.json.jbuilder +++ b/app/views/installations/index.json.jbuilder @@ -2,7 +2,15 @@ json.status 0 json.message "success" json.data do json.array! @install_bots do |install_bot| - json.extract! install_bot, :id, :bot_id, :installer_id + json.extract! install_bot, :id, :bot_id, :installer_id, :create_time, :update_time json.bot_name install_bot&.bot&.name + json.account do + user = User.find_by(id: install_bot.installer_id) + if user.present? + json.partial! "api/v1/users/simple_user", locals: {user: user} + else + json.nil! + end + end end end \ No newline at end of file diff --git a/app/views/installations/show.json.jbuilder b/app/views/installations/show.json.jbuilder index 89db0107b..4ab91c1e4 100644 --- a/app/views/installations/show.json.jbuilder +++ b/app/views/installations/show.json.jbuilder @@ -1,5 +1,13 @@ json.partial! "commons/success" -json.extract! @install_bot, :id, :bot_id, :installer_id +json.extract! @install_bot, :id, :bot_id, :installer_id, :create_time, :update_time json.bot_name @install_bot&.bot&.name +json.account do + user = User.find_by(id: @install_bot.installer_id) + if user.present? + json.partial! "api/v1/users/simple_user", locals: { user: user } + else + json.nil! + end +end