Skip to content

Commit

Permalink
[BE] FIX: saveValue 조건문 수정 (#1316)
Browse files Browse the repository at this point in the history
  • Loading branch information
yubinquitous committed Aug 25, 2023
1 parent c502fa8 commit 7ebedbe
Showing 1 changed file with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
package org.ftclub.cabinet.redis;

import java.util.ArrayList;
import java.util.Map;
import java.util.Objects;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import org.ftclub.cabinet.exception.ExceptionStatus;
import org.ftclub.cabinet.exception.ServiceException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.Map;
import java.util.Objects;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

@Component
public class TicketingSharedCabinet {

Expand All @@ -24,7 +25,7 @@ public class TicketingSharedCabinet {

@Autowired
public TicketingSharedCabinet(RedisTemplate<Long, ?> valueRedisTemplate,
RedisTemplate<Long, Integer> shadowKeyRedisTemplate) {
RedisTemplate<Long, Integer> shadowKeyRedisTemplate) {
this.valueRedisTemplate = valueRedisTemplate;
this.valueHashOperations = this.valueRedisTemplate.opsForHash();
this.shadowKeyRedisTemplate = shadowKeyRedisTemplate;
Expand All @@ -49,13 +50,13 @@ public TicketingSharedCabinet(RedisTemplate<Long, ?> valueRedisTemplate,
// }

/**
* @param key : cabinetId
* @param hashKey : userId
* @param shareCode : 초대코드
* @param isFirstLent : 최초 대여인지 아닌지 여부
* @param key : cabinetId
* @param hashKey : userId
* @param shareCode : 초대코드
* @param hasShadowKey : 최초 대여인지 아닌지 여부
*/
public void saveValue(Long key, Long hashKey, Integer shareCode, boolean isFirstLent) {
if (isFirstLent || isValidShareCode(key, shareCode)) { // 방장이거나 초대코드를 맞게 입력한 경우
public void saveValue(Long key, Long hashKey, Integer shareCode, boolean hasShadowKey) {
if (!hasShadowKey || isValidShareCode(key, shareCode)) { // 방장이거나 초대코드를 맞게 입력한 경우
valueHashOperations.put(key, hashKey, -1);
} else { // 초대코드가 틀린 경우
int trialCount =
Expand Down

0 comments on commit 7ebedbe

Please sign in to comment.