继续写这个接口的商品信息,够用了
This commit is contained in:
@@ -455,10 +455,17 @@ public class JDUtil {
|
|||||||
if (order.startsWith("转链")) {
|
if (order.startsWith("转链")) {
|
||||||
content = new StringBuilder();
|
content = new StringBuilder();
|
||||||
order = order.replace("转链", "");
|
order = order.replace("转链", "");
|
||||||
String[] split = order.split("\r\n");
|
String jsonString;
|
||||||
for (String s : split) {
|
try {
|
||||||
content.append("https://item.jd.com/").append(s.trim()).append(".html").append("\r\n");
|
GoodsQueryResult goodsQueryResult = queryProductInfoByUJDUrl(order);
|
||||||
|
jsonString = JSON.toJSONString(goodsQueryResult);
|
||||||
|
content.append(jsonString);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
content.append(e);
|
||||||
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
contents.add(content);
|
contents.add(content);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -1160,8 +1167,8 @@ private void handleUserInteraction(String fromWxid, String message) {
|
|||||||
return client.execute(request);
|
return client.execute(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GoodsQueryResult queryProductInfoByUJDUrl(String skuId) throws Exception {
|
public GoodsQueryResult queryProductInfoByUJDUrl(String uJDUrl) throws Exception {
|
||||||
UnionOpenGoodsQueryResponse response = getUnionOpenGoodsQueryRequest(skuId);
|
UnionOpenGoodsQueryResponse response = getUnionOpenGoodsQueryRequest(uJDUrl);
|
||||||
if (response == null || response.getQueryResult() == null) {
|
if (response == null || response.getQueryResult() == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user