Przeglądaj źródła

销量问题

(cherry picked from commit 3a133a63e43f5d98b4d04693719bcc505174e622)
xiongzhu 3 lat temu
rodzic
commit
35a23ee5c1

+ 2 - 2
src/main/java/com/izouma/nineth/service/CollectionService.java

@@ -384,7 +384,7 @@ public class CollectionService {
     public synchronized Long increaseSale(Long id, int number) {
         BoundValueOperations<String, Object> ops = redisTemplate.boundValueOps(RedisKeys.COLLECTION_SALE + id);
         if (ops.get() == null) {
-            Boolean success = ops.setIfAbsent(Optional.ofNullable(collectionRepo.getStock(id))
+            Boolean success = ops.setIfAbsent(Optional.ofNullable(collectionRepo.getSale(id))
                     .orElse(0), 7, TimeUnit.DAYS);
             log.info("创建redis销量:{}", success);
         }
@@ -394,7 +394,7 @@ public class CollectionService {
     }
 
     public synchronized Long decreaseSale(Long id, int number) {
-        return increaseStock(id, -number);
+        return increaseSale(id, -number);
     }
 
     @Debounce(key = "#id", delay = 500)