Browse Source

合并老拉新分支。

Signed-off-by: zouap <zouap@pcl.ac.cn>
tags/v1.22.9.2^2
zouap 3 years ago
parent
commit
a03f84ed07
2 changed files with 5 additions and 5 deletions
  1. +4
    -4
      routers/user/Invitation.go
  2. +1
    -1
      routers/user/auth.go

+ 4
- 4
routers/user/Invitation.go View File

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


+ 1
- 1
routers/user/auth.go View File

@@ -1368,7 +1368,7 @@ func SignUpPost(ctx *context.Context, cpt *captcha.Captcha, form auth.RegisterFo


log.Info("enter here, and form.InvitaionCode =" + invitationCode) log.Info("enter here, and form.InvitaionCode =" + invitationCode)
if invitationCode != "" { if invitationCode != "" {
RegisteUserByInvitaionCode(invitationCode, u.ID)
RegisteUserByInvitaionCode(invitationCode, u.ID, u.PhoneNumber)
} }


err := models.AddEmailAddress(&models.EmailAddress{ err := models.AddEmailAddress(&models.EmailAddress{


Loading…
Cancel
Save