From b95c2f90d5e06580a8fdee48c062591185d7bc5e Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Mon, 16 Oct 2023 12:04:27 +0800 Subject: [PATCH] fix --- model/gmodel/fs_user_info_logic.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/model/gmodel/fs_user_info_logic.go b/model/gmodel/fs_user_info_logic.go index 52af5439..0521b912 100644 --- a/model/gmodel/fs_user_info_logic.go +++ b/model/gmodel/fs_user_info_logic.go @@ -80,6 +80,10 @@ func (m *FsUserInfoModel) GetProfile(ctx context.Context, pkey string, userId in return info, nil } func (m *FsUserInfoModel) FindOneByUser(ctx context.Context, userId, guestId int64) (resp *FsUserInfo, err error) { - err = m.db.WithContext(ctx).Model(&FsUserInfo{}).Where("user_id = ? and guest_id = ?", userId, guestId).Take(&resp).Error + if userId > 0 { + err = m.db.WithContext(ctx).Model(&FsUserInfo{}).Where("user_id = ?", userId).Take(&resp).Error + } else { + err = m.db.WithContext(ctx).Model(&FsUserInfo{}).Where("user_id = ? and guest_id = ?", userId, guestId).Take(&resp).Error + } return resp, err }