From 00815979d2117dd40f457d50c859d9c17c7c5816 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Thu, 11 Jul 2024 02:59:33 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8F=91=E5=B8=83v2.2.20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/http/controllers/setting_controller.go | 16 +++++++--------- config/panel.go | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/app/http/controllers/setting_controller.go b/app/http/controllers/setting_controller.go index 0067199db1..9f671fc1d7 100644 --- a/app/http/controllers/setting_controller.go +++ b/app/http/controllers/setting_controller.go @@ -45,13 +45,10 @@ func (r *SettingController) List(ctx http.Context) http.Response { return ErrorSystem(ctx) } + userID := cast.ToUint(ctx.Value("user_id")) var user models.User - err = facades.Auth(ctx).User(&user) - if err != nil { - facades.Log().Request(ctx.Request()).Tags("面板", "面板设置").With(map[string]any{ - "error": err.Error(), - }).Info("获取用户信息失败") - return ErrorSystem(ctx) + if err = facades.Orm().Query().Where("id", userID).Get(&user); err != nil { + return Error(ctx, http.StatusInternalServerError, "获取用户信息失败") } port, err := shell.Execf(`cat /www/panel/panel.conf | grep APP_PORT | awk -F '=' '{print $2}' | tr -d '\n'`) @@ -129,11 +126,12 @@ func (r *SettingController) Update(ctx http.Context) http.Response { return ErrorSystem(ctx) } + userID := cast.ToUint(ctx.Value("user_id")) var user models.User - err = facades.Auth(ctx).User(&user) - if err != nil { - return ErrorSystem(ctx) + if err = facades.Orm().Query().Where("id", userID).Get(&user); err != nil { + return Error(ctx, http.StatusInternalServerError, "获取用户信息失败") } + user.Username = updateRequest.UserName user.Email = updateRequest.Email if len(updateRequest.Password) > 0 { diff --git a/config/panel.go b/config/panel.go index cc76e8977f..2e3ac84fd8 100644 --- a/config/panel.go +++ b/config/panel.go @@ -8,7 +8,7 @@ func init() { config := facades.Config() config.Add("panel", map[string]any{ "name": "耗子面板", - "version": "v2.2.19", + "version": "v2.2.20", "ssl": config.Env("APP_SSL", false), }) }