Browse Source

修改bug

chenbo 4 years ago
parent
commit
9e66ee68d7
1 changed files with 13 additions and 2 deletions
  1. 13 2
      lib/input_163.class.php

+ 13 - 2
lib/input_163.class.php

@@ -37,6 +37,17 @@ class Input_163
         return $preNum.$code;
     }
 
+    //深市返回的成交量以个为单位,需转换为以手为单位
+    static private function getAmountForIndexDayK($code, $amount)
+    {
+        $newAmount = $amount;
+        $index = Index::getInfoByCode($code);
+        if ($index['exchange'] == STOCK_EXCHANGE_SZ) {
+            $newAmount = round($amount / 100);
+        }
+        return $newAmount;
+    }
+
     //获取指定时间段指数的历史数据
     static private function getPartIndexDayK($code, $start_date, $end_date)
     {
@@ -61,8 +72,8 @@ class Input_163
             $data['highest_price'] = floatval($item[4]);
             $data['lowest_price'] = floatval($item[5]);
             $data['close_price'] = floatval($item[6]);
-            $data['value'] = floatval($item[7]);
-            $data['amount'] = floatval($item[8]);
+            $data['value'] = (int)$item[7];
+            $data['amount'] = self::getAmountForIndexDayK($data['code'],(int)$item[8]);
             $data['increase_price'] = floatval($item[9]);
             $data['increase_ratio'] = floatval($item[10]);
             if ($data['close_price'] == 0) {                    //当收盘价为0的时候,表示此时的基于9-15点,所以不存储