This commit is contained in:
eson 2023-10-26 11:45:52 +08:00
parent f9ae25ace5
commit a6cdd880c8

View File

@ -53,7 +53,7 @@ func (m *FsUserInfoModel) MergeMetadata(userId int64, meta any) error {
func (m *FsUserInfoModel) GetDefaultProfile(ctx context.Context, tname string) (map[string]any, error) { func (m *FsUserInfoModel) GetDefaultProfile(ctx context.Context, tname string) (map[string]any, error) {
var baseinfo map[string]any var baseinfo map[string]any
condUser := "user_id = 0 and guest_id = 0" condUser := "user_id = 0 and guest_id = 0"
rawsql := fmt.Sprintf("select JSON_EXTRACT(metadata,'$.*') as query from %s where %s and module = 'profile' order by ctime DESC limit 1", tname, condUser) rawsql := fmt.Sprintf("select JSON_EXTRACT(metadata,'$') as query from %s where %s and module = 'profile' order by ctime DESC limit 1", tname, condUser)
err := m.db.WithContext(ctx).Raw(rawsql).Take(&baseinfo).Error err := m.db.WithContext(ctx).Raw(rawsql).Take(&baseinfo).Error
if err != nil { if err != nil {
return nil, err return nil, err