mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-08 02:55:58 +08:00
邀请码功能
1、新增邀请码功能 needInvitationCode: false 改成 true 后生效 2、完善后台用户注册 修改相关
This commit is contained in:
@@ -8,12 +8,12 @@ import (
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/common/utils"
|
||||
"fmt"
|
||||
"github.com/gin-gonic/gin"
|
||||
"gopkg.in/gomail.v2"
|
||||
"math/rand"
|
||||
"net/http"
|
||||
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"gopkg.in/gomail.v2"
|
||||
)
|
||||
|
||||
var sms SMS
|
||||
@@ -73,6 +73,15 @@ func SendVerificationCode(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": constant.HasRegistered, "errMsg": "The phone number has been registered"})
|
||||
return
|
||||
}
|
||||
//需要邀请码
|
||||
if config.Config.Demo.NeedInvitationCode {
|
||||
err = im_mysql_model.CheckInvitationCode(params.InvitationCode)
|
||||
if err != nil {
|
||||
log.NewError(params.OperationID, "邀请码错误", params)
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": constant.InvitationError, "errMsg": "邀请码错误"})
|
||||
return
|
||||
}
|
||||
}
|
||||
accountKey = accountKey + "_" + constant.VerificationCodeForRegisterSuffix
|
||||
ok, err := db.DB.JudgeAccountEXISTS(accountKey)
|
||||
if ok || err != nil {
|
||||
|
||||
Reference in New Issue
Block a user