info
This commit is contained in:
parent
c272a9de77
commit
21196c62ee
|
@ -121,32 +121,3 @@ func (m *FsUserInfoModel) FindOneByUser(ctx context.Context, userId, guestId int
|
||||||
}
|
}
|
||||||
return resp, err
|
return resp, err
|
||||||
}
|
}
|
||||||
func (m *FsUserInfoModel) GetProfileByUserIdGuestId(ctx context.Context, pkey string, userId, guestId int64) (map[string]any, error) {
|
|
||||||
|
|
||||||
var baseinfo map[string]any
|
|
||||||
tname := fssql.GetGormTableName(m.db, FsUserInfo{})
|
|
||||||
|
|
||||||
if pkey == "." {
|
|
||||||
pkey = ""
|
|
||||||
} else {
|
|
||||||
pkey = "." + pkey
|
|
||||||
}
|
|
||||||
|
|
||||||
rawsql := fmt.Sprintf("select JSON_EXTRACT(metadata,'$%s') as query from %s where user_id = ? and guest_id = ? and module = 'profile' order by ctime DESC limit 1", pkey, tname)
|
|
||||||
err := m.db.WithContext(ctx).Raw(rawsql, userId, guestId).Take(&baseinfo).Error
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
v, ok := baseinfo["query"].(string)
|
|
||||||
if !ok {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var info map[string]any
|
|
||||||
err = json.Unmarshal([]byte(v), &info)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return info, nil
|
|
||||||
}
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ func (l *UserGetProfileLogic) UserGetProfile(req *types.QueryProfileRequest, use
|
||||||
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
|
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
|
||||||
// userinfo 传入值时, 一定不为null
|
// userinfo 传入值时, 一定不为null
|
||||||
|
|
||||||
profileBase, err := l.svcCtx.AllModels.FsUserInfo.GetProfile(l.ctx, req.TopKey, userinfo.UserId)
|
profileBase, err := l.svcCtx.AllModels.FsUserInfo.GetProfile(l.ctx, req.TopKey, userinfo.UserId, userinfo.GuestId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return resp.SetStatusWithMessage(basic.CodeApiErr, err.Error())
|
return resp.SetStatusWithMessage(basic.CodeApiErr, err.Error())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user