From de7d50ce51ca7210214da828fe45ad67c111e489 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Sun, 26 May 2024 14:14:48 +0800 Subject: [PATCH] feat: optimize info api --- app/http/controllers/info_controller.go | 12 ++++-------- routes/api.go | 3 +-- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/app/http/controllers/info_controller.go b/app/http/controllers/info_controller.go index 57e0516c..d238fbb0 100644 --- a/app/http/controllers/info_controller.go +++ b/app/http/controllers/info_controller.go @@ -34,18 +34,14 @@ func NewInfoController() *InfoController { } } -// Name 获取面板名称 -func (r *InfoController) Name(ctx http.Context) http.Response { +// Panel 获取面板信息 +func (r *InfoController) Panel(ctx http.Context) http.Response { return Success(ctx, http.Json{ - "name": r.setting.Get(models.SettingKeyName), + "name": r.setting.Get(models.SettingKeyName), + "language": facades.Config().GetString("app.locale"), }) } -// Language 获取面板语言 -func (r *InfoController) Language(ctx http.Context) http.Response { - return Success(ctx, facades.Config().GetString("app.locale")) -} - // HomePlugins 获取首页插件 func (r *InfoController) HomePlugins(ctx http.Context) http.Response { var plugins []models.Plugin diff --git a/routes/api.go b/routes/api.go index 5b194baa..9030c8ed 100644 --- a/routes/api.go +++ b/routes/api.go @@ -12,8 +12,7 @@ func Api() { facades.Route().Prefix("api/panel").Group(func(r route.Router) { r.Prefix("info").Group(func(r route.Router) { infoController := controllers.NewInfoController() - r.Get("name", infoController.Name) - r.Get("language", infoController.Language) + r.Get("panel", infoController.Panel) r.Middleware(middleware.Jwt()).Get("homePlugins", infoController.HomePlugins) r.Middleware(middleware.Jwt()).Get("nowMonitor", infoController.NowMonitor) r.Middleware(middleware.Jwt()).Get("systemInfo", infoController.SystemInfo)