pull/271/head
wangchuxiao 2 years ago
parent 1747ae8984
commit 37193c48d9

@ -42,7 +42,7 @@ func QueryIPRegister(c *gin.Context) {
resp.IP = req.IP resp.IP = req.IP
resp.RegisterNum = len(userIDList) resp.RegisterNum = len(userIDList)
resp.UserIDList = userIDList resp.UserIDList = userIDList
_, err = imdb.QueryIPLimits(req.IP) ipLimit, err := imdb.QueryIPLimits(req.IP)
if err != nil { if err != nil {
if gorm.IsRecordNotFoundError(err) { if gorm.IsRecordNotFoundError(err) {
resp.Status = 0 resp.Status = 0
@ -52,9 +52,10 @@ func QueryIPRegister(c *gin.Context) {
return return
} }
} else { } else {
if ipLimit.Ip != "" {
resp.Status = 1 resp.Status = 1
} }
}
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp:", resp) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp:", resp)
c.JSON(http.StatusOK, gin.H{"errCode": 0, "errMsg": "", "data": resp}) c.JSON(http.StatusOK, gin.H{"errCode": 0, "errMsg": "", "data": resp})
} }

@ -57,12 +57,17 @@ func Login(c *gin.Context) {
} else { } else {
userID = r.Account 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]) url := fmt.Sprintf("http://%s:%d/auth/user_token", utils.ServerIP, config.Config.Api.GinPort[0])
openIMGetUserToken := api.UserTokenReq{} openIMGetUserToken := api.UserTokenReq{}
openIMGetUserToken.OperationID = params.OperationID openIMGetUserToken.OperationID = params.OperationID
openIMGetUserToken.Platform = params.Platform openIMGetUserToken.Platform = params.Platform
openIMGetUserToken.Secret = config.Config.Secret openIMGetUserToken.Secret = config.Config.Secret
openIMGetUserToken.UserID = userID openIMGetUserToken.UserID = userID
openIMGetUserToken.LoginIp = ip
loginIp := c.Request.Header.Get("X-Forward-For") loginIp := c.Request.Header.Get("X-Forward-For")
if loginIp == "" { if loginIp == "" {
loginIp = c.ClientIP() loginIp = c.ClientIP()

@ -107,11 +107,8 @@ func SetPassword(c *gin.Context) {
openIMRegisterReq.Nickname = params.Nickname openIMRegisterReq.Nickname = params.Nickname
openIMRegisterReq.Secret = config.Config.Secret openIMRegisterReq.Secret = config.Config.Secret
openIMRegisterReq.FaceURL = params.FaceURL openIMRegisterReq.FaceURL = params.FaceURL
createIp := c.Request.Header.Get("X-Forward-For") openIMRegisterReq.CreateIp = ip
if createIp == "" { openIMRegisterReq.LastLoginIp = ip
createIp = c.ClientIP()
}
openIMRegisterReq.CreateIp = createIp
openIMRegisterReq.InvitationCode = params.InvitationCode openIMRegisterReq.InvitationCode = params.InvitationCode
openIMRegisterResp := api.UserRegisterResp{} openIMRegisterResp := api.UserRegisterResp{}
log.NewDebug(params.OperationID, utils.GetSelfFuncName(), "register req:", openIMRegisterReq) log.NewDebug(params.OperationID, utils.GetSelfFuncName(), "register req:", openIMRegisterReq)

Loading…
Cancel
Save