更新 profile

This commit is contained in:
eson 2023-11-24 11:40:36 +08:00
parent fb2bcd87eb
commit 963940c367

View File

@ -9,6 +9,7 @@ import (
"fusenapi/utils/fssql" "fusenapi/utils/fssql"
"fusenapi/utils/handlers" "fusenapi/utils/handlers"
"github.com/tidwall/gjson"
"gorm.io/gorm" "gorm.io/gorm"
) )
@ -113,26 +114,18 @@ func (m *FsUserInfoModel) GetProfile(ctx context.Context, pkey string, userId in
return m.getDefaultProfile(ctx, tname) return m.getDefaultProfile(ctx, tname)
} }
if logoSelected, ok := info["logo_selected"]; ok { if logoSelected := gjson.Get(v, "logo_selected"); logoSelected.Exists() {
if version, ok := logoSelected.(map[string]any)["version"]; ok { if ver := logoSelected.Get("version"); ver.Exists() && ver.String() == versionML {
if ver, ok := version.(string); ok { return info, nil
if ver != versionML {
defaultUserInfo, err := m.getDefaultProfile(ctx, tname)
if err != nil {
return nil, err
}
info["logo_selected"] = defaultUserInfo["logo_selected"]
}
}
} }
} else {
defaultUserInfo, err := m.getDefaultProfile(ctx, tname)
if err != nil {
return nil, err
}
info["logo_selected"] = defaultUserInfo["logo_selected"]
} }
defaultUserInfo, err := m.getDefaultProfile(ctx, tname)
if err != nil {
return nil, err
}
info["logo_selected"] = defaultUserInfo["logo_selected"]
return info, nil return info, nil
} }