提交 2cffbc94 authored 作者: Whispa's avatar Whispa

improvements

上级 60348b2e
...@@ -105,18 +105,15 @@ public class CartController extends Controller { ...@@ -105,18 +105,15 @@ public class CartController extends Controller {
if (targetUrl != null && itemSkuId == null){ if (targetUrl != null && itemSkuId == null){
try { try {
JSONObject detail = spiderService.getItemDetail(targetUrl); JSONObject detail = spiderService.getItemDetail(targetUrl);
System.out.println(detail.toString());
JSONObject data = detail.containsKey("data") ? detail.getJSONObject("data") : null; if( !detail.containsKey("originalPriceList"))
logger.debug(data == null ? null : data.toString());
if( data != null && data.containsKey("originalPriceList") ){
JSONArray priceList = data.getJSONArray("originalPriceList");
if( priceList.isEmpty() ){
return skuNotFound;
}else
price = BigDecimal.valueOf(priceList.getJSONObject(0).getDouble("price"));
}else {
return skuNotFound; return skuNotFound;
}
JSONArray priceList = detail.getJSONArray("originalPriceList");
if( priceList.isEmpty() ){
return skuNotFound;
}else
price = BigDecimal.valueOf(priceList.getJSONObject(0).getDouble("price"));
} catch (InterruptedException | IOException | ExecutionException | URISyntaxException | TimeoutException e) { } catch (InterruptedException | IOException | ExecutionException | URISyntaxException | TimeoutException e) {
logger.debug(e.getMessage()); logger.debug(e.getMessage());
return skuNotFound; return skuNotFound;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论