This commit is contained in:
laodaming 2023-10-16 12:04:27 +08:00
parent ce413c494c
commit b95c2f90d5

View File

@ -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
}