yujian
2019-12-28 c3f10da9aa6f4d8fecccc1c9574567ee0766ab48
fanli/src/main/java/com/yeshi/fanli/util/taobao/DaTaoKeUtil.java
@@ -381,6 +381,8 @@
      } catch (IOException e1) {
         e1.printStackTrace();
      }
      if (doc == null)
         return new ArrayList<>();
      Elements els = doc.getElementsByTag("script");
      for (int i = 0; i < els.size(); i++) {
         String content = els.get(i).html();
@@ -388,7 +390,8 @@
            ScriptEngineManager manager = new ScriptEngineManager();
            ScriptEngine engine = manager.getEngineByName("javascript");
            try {
               String js = "function getData(){return  JSON.stringify(dataDef);} var test1='--';function test2(res){};" + content.replace("$(window).load", "test2").replace("window.location.search.", "test1.");
               String js = "function getData(){return  JSON.stringify(dataDef);} var test1='--';function test2(res){};"
                     + content.replace("$(window).load", "test2").replace("window.location.search.", "test1.");
               engine.eval(js);
               if (engine instanceof Invocable) {
                  Invocable in = (Invocable) engine;
@@ -580,7 +583,7 @@
      return detail;
   }
   public static List<String> getDingDongQiangTime(Calendar nowDate) {
   public static List<DingDongTime> getDingDongQiangTime(Calendar nowDate) {
      // 获取当前的小时数
      DingDongTime[] times = new DingDongTime[] { new DingDongTime("0", "00:00"), new DingDongTime("8", "08:00"),
@@ -611,39 +614,38 @@
      List<DingDongTime> list = new ArrayList<>();
      //获取当前时间之前的5个数据
      // 获取当前时间之前的5个数据
      for (int i = 5; i >= 0; i--) {
         int p = pos - i < 0 ? (times.length + pos - i) : pos - i;
         DingDongTime itemData = new DingDongTime(times[p].getKey(), times[p].getValue());
         DingDongTime itemData = new DingDongTime(times[p].getKey(), times[p].getValue(), -1);
         if (pos - i < 0)
            itemData.setTime(
                  preDay + "" + (itemData.getKey().length() < 2 ? ("0" + itemData.getKey()) : itemData.getKey()));
         else
            itemData.setTime(
                  nowDay + "" + (itemData.getKey().length() < 2 ? ("0" + itemData.getKey()) : itemData.getKey()));
         if (pos == p)
            itemData.setState(0);
         list.add(itemData);
      }
      //向后添加剩下的
      // 向后添加剩下的
      if (pos + 1 < times.length)
         for (int i = pos + 1; i < times.length; i++) {
            DingDongTime itemData = new DingDongTime(times[i].getKey(), times[i].getValue());
            DingDongTime itemData = new DingDongTime(times[i].getKey(), times[i].getValue(), 1);
            itemData.setTime(
                  nowDay + "" + (itemData.getKey().length() < 2 ? ("0" + itemData.getKey()) : itemData.getKey()));
            list.add(itemData);
         }
      if (times.length - (pos + 1) < 2) {
         DingDongTime itemData = new DingDongTime(times[0].getKey(), times[0].getValue());
         DingDongTime itemData = new DingDongTime(times[0].getKey(), times[0].getValue(), 1);
         itemData.setTime(
               nextDay + "" + (itemData.getKey().length() < 2 ? ("0" + itemData.getKey()) : itemData.getKey()));
         list.add(itemData);
      }
      List<String> finalTimeList = new ArrayList<>();
      for (DingDongTime time : list)
         finalTimeList.add(time.getTime());
      return finalTimeList;
      return list;
   }
}