wanggangtao 5 år sedan
förälder
incheckning
f2529cd582
2 ändrade filer med 4 tillägg och 5 borttagningar
  1. 3 4
      lib/input163HistoryDayK.class.php
  2. 1 1
      lib/table/table_day_k.class.php

+ 3 - 4
lib/input163HistoryDayK.class.php

@@ -18,9 +18,9 @@ class Input163HistoryDayK
     {
         $f = substr($code, 0, 1);
         if ($f == "6") {
-            $stock_code = "1" . $code;
-        } else {
             $stock_code = "0" . $code;
+        } else {
+            $stock_code = "1" . $code;
         }
         return $stock_code;
     }
@@ -55,8 +55,6 @@ class Input163HistoryDayK
         $code = self::stock_block($stock_code);
         $url = "http://quotes.money.163.com/service/chddata.html?code=" . $code . "&start=" . $start_date . "&end=" . $end_date . "&fields=TOPEN;HIGH;LOW;TCLOSE;VATURNOVER;VOTURNOVER;CHG;PCHG";
         //构建所要发送的url
-        var_dump($url);
-        die;
         $content1=self::curl_get_data($url);
         if (!empty($content1[1])) {
             for ($i = count($content1) - 1; $i >0; $i--) {//排除日期,代码等标题栏
@@ -84,6 +82,7 @@ class Input163HistoryDayK
                 if ($data['close_price'] == 0) {//当收盘价为0的时候,表示此时的基于9-3点,所以不存储
                     continue;
                 }
+
                 if (!empty($data)) {
                     $msg= Day_k::HistoryDayK($data);//将这支股票的历史数据存入数据库
 

+ 1 - 1
lib/table/table_day_k.class.php

@@ -120,7 +120,7 @@ class Table_day_k extends Table {
     public function HistoryDayK($attr){
         $param = array (
             'day_k_timestamp '         => array('number', $attr['timestamp']),
-            'day_k_date'               => array('number', strtotime($attr['date'])),
+            'day_k_date'               => array('number', $attr['date']),
             'day_k_code'               => array('string', $attr['code']),
             'day_k_name'               => array('string', $attr['name']),
             'day_k_open_price'         => array('number', $attr['open_price']),