zoujiajian 2 years ago
parent
commit
4e93d901e6

+ 2 - 1
netflix-dao/src/main/java/com/cyksj/model/views/GoodsFrontListView.java

@@ -1,6 +1,7 @@
 package com.cyksj.model.views;
 
 import com.cyksj.model.entity.GoodsDon;
+import com.cyksj.model.entity.GoodsDonSpec;
 import com.ejlchina.searcher.bean.DbField;
 import com.ejlchina.searcher.bean.DbIgnore;
 import com.ejlchina.searcher.bean.SearchBean;
@@ -127,7 +128,7 @@ public class GoodsFrontListView {
 	private List<GoodsDonSkuFrontView> skuList;
 
 	@DbIgnore
-	private GoodsDonSpecFrontView specs;
+	private GoodsDonSpec specs;
 
 	@DbIgnore
 	private OrderCommentFrontView comments;

+ 16 - 1
netflix-service/src/main/java/com/cyksj/redis/RedisService.java

@@ -3,9 +3,11 @@ package com.cyksj.redis;
 import com.cyksj.common.util.StringUtil;
 import lombok.AllArgsConstructor;
 import lombok.Getter;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.PostConstruct;
 import javax.annotation.Resource;
 import java.util.Arrays;
 import java.util.List;
@@ -26,6 +28,17 @@ public class RedisService {
     @Resource
     private RedisTemplate<String, Object> redisTemplate;
 
+    public static String env = "dev";
+
+    @Value("${spring.profiles.active}")
+    private String active;
+
+    @PostConstruct
+    public void init(){
+        env = active + ":";
+    }
+
+
     /**
      * 指定缓存失效时间
      *
@@ -645,7 +658,9 @@ public class RedisService {
 
         private long timeout;
 
-
+        public String getEnvName() {
+            return this.name + env;
+        }
         public String getNameFormat(Object ... str) {
             return String.format(this.getName(), str);
         }

+ 5 - 5
netflix-web/src/main/java/com/cyksj/web/controller/goods/GoodsDonController.java

@@ -159,7 +159,7 @@ public class GoodsDonController {
     @GetMapping("/get/list")
     public Result<List<GoodsFrontListView>> getGoodsList() {
         List<Long> filter_goodsIds = getFilterGoodsIds();
-        String pcCacheKey = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "PC";
+        String pcCacheKey = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "PC";
         if (CollUtil.isNotEmpty(filter_goodsIds)) {
             pcCacheKey += ":hz-ip";
         }
@@ -214,7 +214,7 @@ public class GoodsDonController {
     @GetMapping("/get/homePage")
     public Result<List<GoodsFrontListView>> getGoodsHomePage() {
         List<Long> filter_goodsIds = getFilterGoodsIds();
-        String h5CacheKey = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "H5";
+        String h5CacheKey = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "H5";
         if (CollUtil.isNotEmpty(filter_goodsIds)) {
             h5CacheKey += ":hz-ip";
         }
@@ -254,7 +254,7 @@ public class GoodsDonController {
      */
     @GetMapping("/get/register")
     public Result<List<RegisterGoodsDonView>> getRegisterGoodsDon() {
-        String registerCacheKey = RedisService.key.REGISTER_HOME_PAGE_CACHE.getName();
+        String registerCacheKey = RedisService.key.REGISTER_HOME_PAGE_CACHE.getEnvName();
         Object value = redisService.get(registerCacheKey);
         if (value != null) {
             try {
@@ -321,7 +321,7 @@ public class GoodsDonController {
      */
     @GetMapping("/get/recommend/{id}")
     public Result<List<GoodsFrontListView>> getRecommendGoodsByGid(@PathVariable Long id) throws Exception {
-        String key = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "recommend:" + id;
+        String key = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "recommend:" + id;
         Object value = redisService.get(key);
         Long fUid = StpUserUtil.getUserIdAfterLogin();
         if (value != null) {
@@ -487,7 +487,7 @@ public class GoodsDonController {
             list.forEach(data -> {
                 if (data.getIsSp()) {
                     //查找所有特定规格最小价格 满足条件
-                    String specificGoodsKey = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "specific:" + data.getId();
+                    String specificGoodsKey = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "specific:" + data.getId();
                     Object speciObj = redisService.get(specificGoodsKey);
                     List<GoodsDonSku> specificSkus = null;
                     if (speciObj != null) {

File diff suppressed because it is too large
+ 0 - 0
netflix-web/src/main/resources/application-prd.yml


+ 1 - 1
netflix-web/src/main/resources/application.yml

@@ -1 +1 @@
-spring:
  profiles:
    active:
      - ${activeProfile}
+spring:
  profiles:
    active: pre

Some files were not shown because too many files changed in this diff