Browse Source

下单清用户缓存

licailing 4 years ago
parent
commit
4fa2427270
1 changed files with 2 additions and 0 deletions
  1. 2 0
      src/main/java/com/izouma/nineth/service/OrderService.java

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

@@ -336,6 +336,7 @@ public class OrderService {
             if (usePoint > 0) {
                 // 扣除积分
                 userRepo.addVipPoint(userId, -usePoint);
+                cacheService.clearUserMy(userId);
             }
             rocketMQTemplate.syncSend(generalProperties.getUpdateStockTopic(), collectionId, 10000);
             log.info("订单创建完成, id={}, {}ms", order.getId(), System.currentTimeMillis() - t);
@@ -345,6 +346,7 @@ public class OrderService {
             if (usePoint > 0) {
                 // 扣除积分
                 userRepo.addVipPoint(userId, usePoint);
+                cacheService.clearUserMy(userId);
                 log.info("订单失败加积分用户ID:{}, 积分:{}", userId, usePoint);
             }
             if (vip) {