更新邀请码绑定的判断逻辑

This commit is contained in:
徐俊杰 2023-03-31 11:18:56 +08:00
parent 7dabf560b9
commit b4105ab312

View File

@ -168,12 +168,12 @@ func (a *ArtistInfoUserProvider) GetUserMsg(ctx context.Context, req *artistInfo
// 绑定邀请人和受邀请人的账号,并加入到次数统计
func (a *ArtistInfoUserProvider) BindInviteInvitedAccount(ctx context.Context, in *artistInfoUser.BindInviteInvitedAccountRequest) (res *artistInfoUser.BindInviteInvitedAccountRespond, err error) {
// 查询邀请人是否存在
// 查询邀请人是否存在
var thisUser model.User
if in.InvitedUserId == 0 {
if err = db.DB.Where("id = ? AND invite_code = ?", in.InvitedUserId, in.InviteCode).First(&thisUser).Error; err != nil {
if err = db.DB.Where("invited_code = ?", in.InviteCode).First(&thisUser).Error; err != nil {
if err == gorm.ErrRecordNotFound {
return nil, errors.New("邀请人不存在")
return nil, errors.New("邀请人不存在")
} else {
return nil, err
}