zhijiezhao vor 3 Jahren
Ursprung
Commit
1298b229c4

+ 21 - 5
src/main/java/com/caimei365/commodity/service/impl/SearchProductServiceImpl.java

@@ -90,8 +90,11 @@ public class SearchProductServiceImpl implements SearchProductService {
             filter += "p_time > " + time;
         }
         if (promotionFlag == 1) {
-//            p_promotions_id > 0
-            filter += "AND p_promotions_id > 0";
+            if (newFlag == 1) {
+                filter += "AND p_promotions_id > 0";
+            } else {
+                filter += "p_promotions_id > 0";
+            }
         }
         // 阿里云搜索
         ResponseJson<String> result = queryProduct(queryStr, filter, identity, pageNum, pageSize, sortField, sortType);
@@ -140,8 +143,11 @@ public class SearchProductServiceImpl implements SearchProductService {
             filter += "p_time > " + time;
         }
         if (promotionFlag == 1) {
-//            p_promotions_id > 0
-            filter += "AND p_promotions_id > 0";
+            if (newFlag == 1) {
+                filter += "AND p_promotions_id > 0";
+            } else {
+                filter += "p_promotions_id > 0";
+            }
         }
         SearchParams searchParams = searchOpenService.getParams(queryStr, identity, filter);
         ResponseJson<Set<HashMap<String, Object>>> result = getBrandResult(searchParams, queryStr);
@@ -164,6 +170,11 @@ public class SearchProductServiceImpl implements SearchProductService {
                         map.put("id", brandId);
                         map.put("name", brandName);
                         maps.add(map);
+                    }else{
+                        HashMap<String, Object> map = new HashMap<>();
+                        map.put("id", brandId);
+                        map.put("name", "其他");
+                        maps.add(map);
                     }
                 }
                 // 阿里云查询出json转换成商品pojo
@@ -226,7 +237,12 @@ public class SearchProductServiceImpl implements SearchProductService {
             filter += "p_time > " + time;
         }
         if (promotionFlag == 1) {
-            filter += "AND p_promotions_id > 0";
+            if (newFlag == 1) {
+                filter += "AND p_promotions_id > 0";
+            } else {
+                filter += "p_promotions_id > 0";
+            }
+
         }
         SearchParams searchParams = searchOpenService.getScrollProductParams(queryStr, identity, requestPageSize, sortField, sortType);
         String thisFilter = searchParams.getFilter();