继续写这个接口的商品信息,够用了

This commit is contained in:
Leo
2025-04-02 22:09:56 +08:00
parent 3e614aab58
commit 370c446bfd

View File

@@ -455,10 +455,17 @@ public class JDUtil {
if (order.startsWith("转链")) {
content = new StringBuilder();
order = order.replace("转链", "");
String[] split = order.split("\r\n");
for (String s : split) {
content.append("https://item.jd.com/").append(s.trim()).append(".html").append("\r\n");
String jsonString;
try {
GoodsQueryResult goodsQueryResult = queryProductInfoByUJDUrl(order);
jsonString = JSON.toJSONString(goodsQueryResult);
content.append(jsonString);
} catch (Exception e) {
content.append(e);
throw new RuntimeException(e);
}
contents.add(content);
}
} else {
@@ -1160,8 +1167,8 @@ private void handleUserInteraction(String fromWxid, String message) {
return client.execute(request);
}
public GoodsQueryResult queryProductInfoByUJDUrl(String skuId) throws Exception {
UnionOpenGoodsQueryResponse response = getUnionOpenGoodsQueryRequest(skuId);
public GoodsQueryResult queryProductInfoByUJDUrl(String uJDUrl) throws Exception {
UnionOpenGoodsQueryResponse response = getUnionOpenGoodsQueryRequest(uJDUrl);
if (response == null || response.getQueryResult() == null) {
return null;
}