更新邀请码绑定的判断逻辑
This commit is contained in:
parent
7dabf560b9
commit
b4105ab312
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user