| | |
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | import org.yeshi.utils.taobao.TbImgUtil;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | |
| | | goods.setProvcity(item.optString("provcity"));
|
| | | goods.setPictUrl(item.optString("pict_url"));
|
| | | goods.setShopTitle(item.optString("nick"));
|
| | | goods.setSellerId(item.optLong("seller_id"));
|
| | |
|
| | | String optString = item.optString("shop_dsr");
|
| | | if (!StringUtil.isNullOrEmpty(optString)) {
|
| | |
| | | }
|
| | | return null;
|
| | | }
|
| | | |
| | | |
| | | public static List<TaoBaoGoodsBrief> getBatchGoodsInfo(List<Long> listId) throws TaoKeApiException,TaobaoGoodsDownException {
|
| | | if (listId == null || listId.size() == 0) {
|
| | | throw new TaobaoGoodsDownException(1,"淘宝商品ID不能为空");
|
| | | }
|
| | | |
| | | if ( listId.size() > 40) {
|
| | | throw new TaobaoGoodsDownException(1,"淘宝商品ID不能超过40个");
|
| | | }
|
| | | |
| | | StringBuffer ids = new StringBuffer();
|
| | | for (Long id: listId) {
|
| | | ids.append(id + ",");
|
| | | }
|
| | | |
| | | return getBatchGoodsInfos(ids.substring(0, ids.length() -1));
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 获取商品详情,简版
|
| | |
| | |
|
| | | if (filter.getEndTkRate() > 0)
|
| | | map.put("end_tk_rate", filter.getEndTkRate() + "");
|
| | | |
| | |
|
| | | if (filter.getStartKaTkRate() > 0)
|
| | | map.put("start_ka_tk_rate", filter.getStartKaTkRate() + "");
|
| | |
| | | * @return
|
| | | */
|
| | | public static String getTKToken(String logo, String text, String url) {
|
| | | if (text == null)
|
| | | return null;
|
| | | if (text.length() < 5)
|
| | | text = "好货:" + text;
|
| | |
|
| | | Map<String, String> map = new HashMap<>();
|
| | | map.put("method", "taobao.tbk.tpwd.create");
|
| | | map.put("url", url);
|
| | |
| | | return list;
|
| | | JSONArray array = data.optJSONObject("tbk_item_recommend_get_response").optJSONObject("results")
|
| | | .optJSONArray("n_tbk_item");
|
| | | for (int i = 0; i < array.size(); i++) {
|
| | | JSONObject item = array.optJSONObject(i);
|
| | | TaoBaoGoodsBrief goods = new TaoBaoGoodsBrief();
|
| | | goods.setAuctionId(item.optLong("num_iid"));
|
| | | goods.setTitle(item.optString("title"));
|
| | | goods.setZkPrice(new BigDecimal(item.optString("zk_final_price")));
|
| | | goods.setAuctionUrl(item.optString("item_url"));
|
| | | goods.setPictUrl(item.optString("pict_url"));
|
| | | list.add(goods);
|
| | | }
|
| | | if (array != null)
|
| | | for (int i = 0; i < array.size(); i++) {
|
| | | JSONObject item = array.optJSONObject(i);
|
| | | TaoBaoGoodsBrief goods = new TaoBaoGoodsBrief();
|
| | | goods.setAuctionId(item.optLong("num_iid"));
|
| | | goods.setTitle(item.optString("title"));
|
| | | goods.setZkPrice(new BigDecimal(item.optString("zk_final_price")));
|
| | | goods.setAuctionUrl(item.optString("item_url"));
|
| | | goods.setPictUrl(item.optString("pict_url"));
|
| | | list.add(goods);
|
| | | }
|
| | | }
|
| | | return list;
|
| | | }
|