| | |
| | | import com.google.gson.FieldAttributes;
|
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | | import com.yeshi.fanli.dto.dataoke.DaTaoKeApiResult;
|
| | | import com.yeshi.fanli.dto.dataoke.DaTaoKeGoodsResult;
|
| | | import com.yeshi.fanli.dto.taobao.TaoBaoShopDTO;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoKeAppInfo;
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetail;
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetailV2;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
| | | return result;
|
| | | }
|
| | |
|
| | | public static DaTaoKeApiResult goodsList(int page) {
|
| | | List<DaTaoKeDetail> list = new ArrayList<>();
|
| | | String url = String.format("http://api.dataoke.com/index.php?r=Port/index&type=total&appkey=%s&v=2&page=%s",
|
| | | Math.random() > 0.5 ? API_KEY : API_KEY_2, page + "");
|
| | | String result = request(url);
|
| | |
|
| | | JSONObject resultJson = JSONObject.fromObject(result);
|
| | | System.out.println(resultJson);
|
| | | JSONArray array = resultJson.optJSONArray("result");
|
| | | for (int i = 0; i < array.size(); i++) {
|
| | | list.add(gson.fromJson(array.optJSONObject(i).toString(), DaTaoKeDetail.class));
|
| | | }
|
| | |
|
| | | for (DaTaoKeDetail dt : list)
|
| | | if (!dt.getPic().startsWith("http"))
|
| | | dt.setPic("https:" + dt.getPic());
|
| | |
|
| | | return new DaTaoKeApiResult(resultJson.optJSONObject("data").optInt("total_num"),
|
| | | resultJson.optJSONObject("data").optString("update_time"), list);
|
| | | }
|
| | |
|
| | | public static DaTaoKeDetail getGoodsDetailV1(Long id) {
|
| | | String url = String.format("http://api.dataoke.com/index.php?r=Port/index&type=total&appkey=%s&v=2&id=%s",
|
| | | Math.random() > 0.5 ? API_KEY : API_KEY_2, id + "");
|
| | | String result = request(url);
|
| | | JSONObject resultJson = JSONObject.fromObject(result);
|
| | | return gson.fromJson(resultJson.optJSONArray("result").optJSONObject(0).toString(), DaTaoKeDetail.class);
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 获取大淘客品牌优选 品牌id
|
| | |
| | | }
|
| | | }
|
| | | return hotWords;
|
| | | }
|
| | |
|
| | | class DaTaoKeResult {
|
| | | Date updateTime;
|
| | | List<DaTaoKeDetail> dataList;
|
| | |
|
| | | public DaTaoKeResult(Date updateTime, List<DaTaoKeDetail> dataList) {
|
| | | this.updateTime = updateTime;
|
| | | this.dataList = dataList;
|
| | | }
|
| | |
|
| | | public DaTaoKeResult() {
|
| | |
|
| | | }
|
| | | }
|
| | | }
|