| | |
| | | import java.net.URLEncoder;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Collections;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.Iterator;
|
| | | import java.util.List;
|
| | |
| | | import com.yeshi.fanli.entity.pdd.PDDOrder;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
| | |
|
| | | /**
|
| | | * 多多进宝商品查询
|
| | | * |
| | | * @param sf
|
| | | * @return
|
| | | */
|
| | |
| | | if (sf.getGoodsIdList() != null)
|
| | | map.put("goods_id_list", "[" + StringUtil.concat(sf.getGoodsIdList(), ",") + "]");
|
| | |
|
| | | |
| | | map.put("pid", PID_FANLI);
|
| | | String result = baseRequest(map);
|
| | | JSONObject json = JSONObject.fromObject(result);
|
| | |
| | | return new PDDGoodsResult(totalCount, goodsList);
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 运营频道商品查询API
|
| | | * |
| | | * @param page
|
| | | * @param pageSize
|
| | | * @param channelType 频道类型;0, "1.9包邮", 1, "今日爆款", 2, "品牌清仓", 非必填 ,默认是1
|
| | | * @param channelType
|
| | | * 频道类型;0, "1.9包邮", 1, "今日爆款", 2, "品牌清仓", 非必填 ,默认是1
|
| | | * @return
|
| | | */
|
| | | public static PDDGoodsResult searchByChannelType(Integer page, Integer pageSize, String channelType) {
|
| | |
| | | JSONArray array = root.optJSONArray("goods_cats_list");
|
| | | }
|
| | |
|
| | | |
| | | public static void getThemes(Integer page, Integer pageSize) {
|
| | | Map<String, String> map = new HashMap<>();
|
| | | map.put("type", "pdd.ddk.theme.list.get");
|
| | |
| | | System.out.println(root.optLong("total"));
|
| | | }
|
| | |
|
| | | |
| | | public static void getGoodsOpt() {
|
| | | Map<String, String> map = new HashMap<>();
|
| | | map.put("type", "pdd.goods.opt.get");
|
| | |
| | | JSONArray array = root.optJSONArray("goods_opt_list");
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 多多客获取爆款排行商品接口
|
| | | * @param pid 推广位id (非必填)
|
| | | * @param page 从多少位置开始请求;默认值 : 0 (非必填)
|
| | | * @param pageSize 请求数量;默认值 :20 (非必填)
|
| | | * @param sortType 1-实时热销榜;2-实时收益榜 (非必填)
|
| | | * |
| | | * @param pid
|
| | | * 推广位id (非必填)
|
| | | * @param page
|
| | | * 从多少位置开始请求;默认值 : 0 (非必填)
|
| | | * @param pageSize
|
| | | * 请求数量;默认值 :20 (非必填)
|
| | | * @param sortType
|
| | | * 1-实时热销榜;2-实时收益榜 (非必填)
|
| | | * @return
|
| | | */
|
| | | public static PDDGoodsResult getTopList(String pid, Integer page, Integer pageSize, Integer sortType) {
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | Type type = new TypeToken<List<PDDGoodsDetail>>() {}.getType();
|
| | | Type type = new TypeToken<List<PDDGoodsDetail>>() {
|
| | | }.getType();
|
| | |
|
| | | Gson gson = new GsonBuilder().disableHtmlEscaping().create();
|
| | | List<PDDGoodsDetail> goodsList = gson.fromJson(array.toString(), type);
|
| | |
| | | int totalCount = 400; // 默认设置成400
|
| | | return new PDDGoodsResult(totalCount, goodsList);
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * 商品转链
|
| | |
| | | * 与开始时间不得大于24小时
|
| | | * @return
|
| | | */
|
| | | public static PDDOrderResult getOrders(int page, int pageSize, long startTime, long endTime) {
|
| | | public static PDDOrderResult getOrdersList(int page, int pageSize, long startTime, long endTime) {
|
| | | Map<String, String> map = new HashMap<>();
|
| | | map.put("type", "pdd.ddk.order.list.increment.get");
|
| | | map.put("start_update_time", startTime / 1000 + "");
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 获取商品详情
|
| | | *
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | public static Date getSystemTime() {
|
| | | try {
|
| | | Map<String, String> map = new HashMap<>();
|
| | | map.put("type", "pdd.time.get");
|
| | | String result = baseRequest(map);
|
| | | String time = JSONObject.fromObject(result).optJSONObject("time_get_response").optString("time");
|
| | | return new Date(TimeUtil.convertToTimeTemp(time, "yyyy-MM-dd HH:mm:ss"));
|
| | | } catch (Exception e) {
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | }
|