chenbo 4 år sedan
förälder
incheckning
2c5eb125a1
2 ändrade filer med 19 tillägg och 3 borttagningar
  1. 13 1
      lib/input_163.class.php
  2. 6 2
      task/task_get_index_day_k.php

+ 13 - 1
lib/input_163.class.php

@@ -69,13 +69,25 @@ class Input_163
                 continue;
             }
             if (!empty($data['name'])) {                       //判断非法股票代码
-                Index_day_k::addOrUpdateByCodeDate($data);
+                Index_day_k::addOrUpdateByCodeDate($data)
             }
         }
 
         return;
     }
 
+    //获取自20140101到前一天的指定的指数数据
+    static public function getIndexDayK()
+    {
+        $indexList = Index::getAllList();
+        $start_date = 20210106;
+        $end_date = (int)date('Ymd', time());
+        foreach($indexList as $item) {
+            self::getPartIndexDayK($item['code'], $start_date, $end_date);
+        }
+        return;
+    }
+
 }
 
 ?>

+ 6 - 2
task/task_get_index_day_k.php

@@ -8,7 +8,11 @@
  */
 require('../init.php');
 
-$indexList = Index::getAllList();//获取指数代码
-Input_sina_detail::getIndexDayK($indexList);
+//获取历史数据
+Input_163::getIndexDayK();
+
+//获取当天数据
+//$indexList = Index::getAllList();//获取指数代码
+//Input_sina_detail::getIndexDayK($indexList);
 
 ?>