diff --git a/config/config.go b/config/config.go index e0b0328..51ef9d0 100644 --- a/config/config.go +++ b/config/config.go @@ -21,7 +21,7 @@ const ( var ( NameSpace string = "gim" - MySQL string = "root:Fnuo123com@@tcp(119.23.182.117:3306)/gim?charset=utf8&parseTime=true" + MySQL string = "root:Fnuo123com@@tcp(119.23.182.117:3306)/gim?charset=utf8&parseTime=true&loc=Local" RedisIP string = "120.24.28.6:32572" RedisPassword string = "" diff --git a/internal/logic/domain/device/device_service.go b/internal/logic/domain/device/device_service.go index 81518df..8c7ab19 100644 --- a/internal/logic/domain/device/device_service.go +++ b/internal/logic/domain/device/device_service.go @@ -41,9 +41,16 @@ func (*deviceService) SignIn(ctx context.Context, userId, deviceId int64, token masterId, _ := grpclib.GetCtxMasterId(ctx) cacheKey := fmt.Sprintf(SignInKey, masterId, utils.Int64ToStr(userId)) if db.RedisUtil.Exists(cacheKey) { + utils.FilePutContents("sign_in", utils.SerializeStr(map[string]interface{}{ + "user_id": userId, + "device_id": deviceId, + "token": token, + "conn_addr": connAddr, + "client_addr": clientAddr, + })) return errors.New("限频!!!") } else { - err := db.RedisUtil.Set(SignInKey, "already", SignInExpire) + err := db.RedisUtil.Set(cacheKey, "already", SignInExpire) if err != nil { return gerrors.WrapError(err) }