Aslee před 3 roky
rodič
revize
9c789ded73

+ 5 - 0
src/main/java/com/caimei365/commodity/model/vo/BaikeProductVo.java

@@ -55,4 +55,9 @@ public class BaikeProductVo implements Serializable {
      * 问题列表
      */
     private List<String> questionList;
+
+    /**
+     * 跳转链接
+     */
+    private String link;
 }

+ 4 - 0
src/main/java/com/caimei365/commodity/service/impl/PageServiceImpl.java

@@ -286,6 +286,10 @@ public class PageServiceImpl implements PageService {
         map.put("liveImage", liveAdvertisingImage);
         // 热门百科导航
         List <BaikeProductVo> baikeList = pageMapper.getSidebarBaike();
+        baikeList.forEach(baikeProduct->{
+            String commodityType = baikeProduct.getCommodityType() == 1 ? "product-" : "instrument-";
+            baikeProduct.setLink(domain + "/encyclopedia/" + commodityType + baikeProduct.getProductId() + ".html");
+        });
         map.put("baikeList", baikeList);
         return ResponseJson.success(map);
     }

+ 13 - 1
src/main/java/com/caimei365/commodity/utils/AppletsLinkUtil.java

@@ -138,6 +138,14 @@ public class AppletsLinkUtil {
      * 25商品资料库列表
      */
     public static final Pattern pattern41 = Pattern.compile("/document/beauty-archive.html");
+    /**
+     * 26采美百科产品详情页
+     */
+    public static final Pattern pattern42 = Pattern.compile("/encyclopedia/product-");
+    /**
+     * 26采美百科仪器详情页
+     */
+    public static final Pattern pattern43 = Pattern.compile("/encyclopedia/instrument-");
 
     /**
      * 根据链接判断链接类型
@@ -196,6 +204,10 @@ public class AppletsLinkUtil {
                 return 24;
             } else if (pattern41.matcher(link).find()) {
                 return 25;
+            } else if (pattern42.matcher(link).find()) {
+                return 26;
+            } else if (pattern43.matcher(link).find()) {
+                return 27;
             } else {
                 return -1;
             }
@@ -224,7 +236,7 @@ public class AppletsLinkUtil {
                 split3 = split1[split1.length - 1].split("\\.");
             }
         }
-        if (linkType == 3 || linkType == 5 || linkType == 20 || linkType == 22 || linkType == 23) {
+        if (linkType == 3 || linkType == 5 || linkType == 20 || linkType == 22 || linkType == 23 || linkType == 26 || linkType == 27) {
             //-{id}.html
             if (split3 != null && split3.length == 2) {
                 map.put("id", split3[0]);

+ 1 - 1
src/main/resources/mapper/PageMapper.xml

@@ -726,7 +726,7 @@
         </if>
     </select>
     <select id="getBaikeQuestionList" resultType="java.lang.String">
-        select question from cm_baike_product_question where productId = #{productId}
+        select question from cm_baike_product_question where productId = #{productId} limit 3
     </select>
 
 </mapper>