|
|
@@ -63,14 +63,14 @@ func InviationTpl(ctx *context.Context) { |
|
|
ctx.HTML(200, tplInvitation) |
|
|
ctx.HTML(200, tplInvitation) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func RegisteUserByInvitaionCode(invitationcode string, newUserId int64) error { |
|
|
|
|
|
|
|
|
func RegisteUserByInvitaionCode(invitationcode string, newUserId int64, newPhoneNumber string) error { |
|
|
user := parseInvitaionCode(invitationcode) |
|
|
user := parseInvitaionCode(invitationcode) |
|
|
if user == nil { |
|
|
if user == nil { |
|
|
return errors.New("The invitated user not existed.") |
|
|
return errors.New("The invitated user not existed.") |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if user.PhoneNumber != "" { |
|
|
|
|
|
re := models.QueryInvitaionByPhone(user.PhoneNumber) |
|
|
|
|
|
|
|
|
if newPhoneNumber != "" { |
|
|
|
|
|
re := models.QueryInvitaionByPhone(newPhoneNumber) |
|
|
if re != nil { |
|
|
if re != nil { |
|
|
if len(re) > 0 { |
|
|
if len(re) > 0 { |
|
|
log.Info("The phone has been invitated. so ingore it.") |
|
|
log.Info("The phone has been invitated. so ingore it.") |
|
|
@@ -84,7 +84,7 @@ func RegisteUserByInvitaionCode(invitationcode string, newUserId int64) error { |
|
|
invitation := &models.Invitation{ |
|
|
invitation := &models.Invitation{ |
|
|
SrcUserID: user.ID, |
|
|
SrcUserID: user.ID, |
|
|
UserID: newUserId, |
|
|
UserID: newUserId, |
|
|
Phone: user.PhoneNumber, |
|
|
|
|
|
|
|
|
Phone: newPhoneNumber, |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
err := models.InsertInvitaion(invitation) |
|
|
err := models.InsertInvitaion(invitation) |
|
|
|