mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-08-07 11:40:01 +08:00
fix code
This commit is contained in:
parent
37193c48d9
commit
7f252909fc
@ -44,17 +44,14 @@ func QueryIPRegister(c *gin.Context) {
|
|||||||
resp.UserIDList = userIDList
|
resp.UserIDList = userIDList
|
||||||
ipLimit, err := imdb.QueryIPLimits(req.IP)
|
ipLimit, err := imdb.QueryIPLimits(req.IP)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if gorm.IsRecordNotFoundError(err) {
|
log.NewError(req.OperationID, "QueryIPLimits failed", req.IP, err.Error())
|
||||||
resp.Status = 0
|
|
||||||
} else {
|
|
||||||
log.NewError(req.OperationID, "QueryIPLimits failed", req.IP, err.Error())
|
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": constant.ErrDB.ErrCode, "errMsg": "QueryIPLimits error!"})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if ipLimit.Ip != "" {
|
if ipLimit != nil {
|
||||||
resp.Status = 1
|
if ipLimit.Ip != "" {
|
||||||
|
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})
|
||||||
|
@ -34,7 +34,7 @@ func IsLimitUserLoginIp(userID string, LoginIp string) (bool, error) {
|
|||||||
|
|
||||||
func QueryIPLimits(ip string) (*db.IpLimit, error) {
|
func QueryIPLimits(ip string) (*db.IpLimit, error) {
|
||||||
var ipLimit db.IpLimit
|
var ipLimit db.IpLimit
|
||||||
err := db.DB.MysqlDB.DefaultGormDB().Model(&db.IpLimit{}).Where("ip=?", ip).Find(&ip).Error
|
err := db.DB.MysqlDB.DefaultGormDB().Model(&db.IpLimit{}).Where("ip=?", ip).First(&ip).Error
|
||||||
return &ipLimit, err
|
return &ipLimit, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user