|
|
@@ -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) |
|
|
|
} |
|
|
|