admin
2024-03-08 0f704a4650edd60cea2e57778b6703509376a42c
fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java
@@ -121,6 +121,38 @@
        map.put("method", "taobao.tbk.item.info.get");
        map.put("num_iids", id + "");
        String resultStr =   TaoKeBaseUtil.baseRequestForThreeTimes(map, true);
        System.out.println(resultStr);
        JSONObject data = JSONObject.fromObject(resultStr);
        // 商品下架
        if (data.optJSONObject("error_response") != null && data.optJSONObject("error_response").optInt("code") == 15
                && data.optJSONObject("error_response").optInt("sub_code") == 50001) {
            throw new TaobaoGoodsDownException(data.optJSONObject("error_response").optInt("code"), "商品下架");
        }
        //TODO 修改临时接口 tbk_item_info_get_response
        if (data.optJSONObject("tbk_item_info_get_response") == null)
            return null;
        JSONArray array = data.optJSONObject("tbk_item_info_get_response").optJSONObject("results")
                .optJSONArray("n_tbk_item");
        if (array != null && array.size() > 0) {
            JSONObject item = array.optJSONObject(0);
            TaoBaoGoodsBrief goods = parseSimpleGoodsInfo(item);
            if(goods!=null&&!NumberUtil.isNumeric(id)){
                goods.setAuctionId(id);
            }
            return goods;
        }
        return null;
    }
    // 获取商品详情自购
    public static TaoBaoGoodsBrief getSimpleGoodsInfoForOwnBuy(String id) throws TaobaoGoodsDownException {
        Map<String, String> map = new HashMap<>();
        map.put("method", "taobao.tbk.item.info.get");
        map.put("num_iids", id + "");
        String resultStr = null;
        if(!NumberUtil.isNumeric(id)){
            resultStr =   TaoKeBaseUtil.baseRequestForThreeTimes(map, true);