Authored by Lixiaodi

图片地址兼容

@@ -65,6 +65,9 @@ public class ImageUrlAssist { @@ -65,6 +65,9 @@ public class ImageUrlAssist {
65 if (((String)imageUrl).startsWith("http://")) { 65 if (((String)imageUrl).startsWith("http://")) {
66 return (String)imageUrl; 66 return (String)imageUrl;
67 } 67 }
  68 + if (((String)imageUrl).startsWith("https://")) {
  69 + return (String)imageUrl;
  70 + }
68 if (StringUtils.isEmpty(background)) { 71 if (StringUtils.isEmpty(background)) {
69 background = INIT_BACKGROUND; 72 background = INIT_BACKGROUND;
70 } 73 }
@@ -191,7 +191,11 @@ public class ProductSearchServiceImpl implements ProductSearchService { @@ -191,7 +191,11 @@ public class ProductSearchServiceImpl implements ProductSearchService {
191 } 191 }
192 } 192 }
193 } 193 }
194 - 194 +
  195 + public static void main(String[] args) {
  196 + System.out.println(fillProductImgUrl("https://img12.static.yhbimg.com/goodsimg/2019/04/17/17/021560b1bd437ded9a66dd15c29c81c53d.jpg"));
  197 + }
  198 +
195 protected void processProductSales(JSONArray productList) { 199 protected void processProductSales(JSONArray productList) {
196 if(CollectionUtils.isEmpty(productList)){ 200 if(CollectionUtils.isEmpty(productList)){
197 return; 201 return;
@@ -270,6 +274,9 @@ public class ProductSearchServiceImpl implements ProductSearchService { @@ -270,6 +274,9 @@ public class ProductSearchServiceImpl implements ProductSearchService {
270 if (imgUrl.startsWith("http://")) { 274 if (imgUrl.startsWith("http://")) {
271 return imgUrl; 275 return imgUrl;
272 } 276 }
  277 + if (imgUrl.startsWith("https://")) {
  278 + return imgUrl;
  279 + }
273 return ImageUrlAssist.getAllProductPicUrl(imgUrl, "goodsimg", "center", "d2hpdGU="); 280 return ImageUrlAssist.getAllProductPicUrl(imgUrl, "goodsimg", "center", "d2hpdGU=");
274 } 281 }
275 282