mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
fix code
This commit is contained in:
parent
1747ae8984
commit
37193c48d9
@ -42,7 +42,7 @@ func QueryIPRegister(c *gin.Context) {
|
||||
resp.IP = req.IP
|
||||
resp.RegisterNum = len(userIDList)
|
||||
resp.UserIDList = userIDList
|
||||
_, err = imdb.QueryIPLimits(req.IP)
|
||||
ipLimit, err := imdb.QueryIPLimits(req.IP)
|
||||
if err != nil {
|
||||
if gorm.IsRecordNotFoundError(err) {
|
||||
resp.Status = 0
|
||||
@ -52,9 +52,10 @@ func QueryIPRegister(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
} else {
|
||||
resp.Status = 1
|
||||
if ipLimit.Ip != "" {
|
||||
resp.Status = 1
|
||||
}
|
||||
}
|
||||
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp:", resp)
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": 0, "errMsg": "", "data": resp})
|
||||
}
|
||||
|
@ -57,12 +57,17 @@ func Login(c *gin.Context) {
|
||||
} else {
|
||||
userID = r.Account
|
||||
}
|
||||
ip := c.Request.Header.Get("X-Forward-For")
|
||||
if ip == "" {
|
||||
ip = c.ClientIP()
|
||||
}
|
||||
url := fmt.Sprintf("http://%s:%d/auth/user_token", utils.ServerIP, config.Config.Api.GinPort[0])
|
||||
openIMGetUserToken := api.UserTokenReq{}
|
||||
openIMGetUserToken.OperationID = params.OperationID
|
||||
openIMGetUserToken.Platform = params.Platform
|
||||
openIMGetUserToken.Secret = config.Config.Secret
|
||||
openIMGetUserToken.UserID = userID
|
||||
openIMGetUserToken.LoginIp = ip
|
||||
loginIp := c.Request.Header.Get("X-Forward-For")
|
||||
if loginIp == "" {
|
||||
loginIp = c.ClientIP()
|
||||
|
@ -107,11 +107,8 @@ func SetPassword(c *gin.Context) {
|
||||
openIMRegisterReq.Nickname = params.Nickname
|
||||
openIMRegisterReq.Secret = config.Config.Secret
|
||||
openIMRegisterReq.FaceURL = params.FaceURL
|
||||
createIp := c.Request.Header.Get("X-Forward-For")
|
||||
if createIp == "" {
|
||||
createIp = c.ClientIP()
|
||||
}
|
||||
openIMRegisterReq.CreateIp = createIp
|
||||
openIMRegisterReq.CreateIp = ip
|
||||
openIMRegisterReq.LastLoginIp = ip
|
||||
openIMRegisterReq.InvitationCode = params.InvitationCode
|
||||
openIMRegisterResp := api.UserRegisterResp{}
|
||||
log.NewDebug(params.OperationID, utils.GetSelfFuncName(), "register req:", openIMRegisterReq)
|
||||
|
Loading…
x
Reference in New Issue
Block a user