Skip to content

Commit

Permalink
feat: optimize info api
Browse files Browse the repository at this point in the history
  • Loading branch information
devhaozi committed May 26, 2024
1 parent 6e0d932 commit de7d50c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
12 changes: 4 additions & 8 deletions app/http/controllers/info_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions routes/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit de7d50c

Please sign in to comment.