wanggangtao 5 years ago
parent
commit
a0b7c26c7d

+ 0 - 1
data/get_stock_static_data.php

@@ -15,7 +15,6 @@ if (empty($codeList))
     throw new Exception('参数列表不能为空', 102);
 }
 //遍历股票代码
-
 foreach($codeList as $key => $val){
         $code=intval($val);
         FinanceTencent::get_stock_data($code);

+ 0 - 1
init.php

@@ -10,7 +10,6 @@
 
 //加载配置文件
 require('config.inc.php');
-
 //定义文件路径
 $FILE_PATH = str_replace('\\','/',dirname(__FILE__)).'/'; //网站根目录路径
 $LIB_PATH        = $FILE_PATH.'lib/';

+ 0 - 1
lib/common/mypdo.class.php

@@ -226,7 +226,6 @@ class MyPdo {
 		}
 		$params_str = implode(',', $params);
 		$sql .= $params_str;
-
 		$wheres = array();
 		foreach($where as $key => $val){
 			$wheres[] = $key.'='.$this->sql_check_input($val);

+ 1 - 1
lib/financeTencent.class.php

@@ -76,6 +76,6 @@ class FinanceTencent
             $data["pe_static"] = floatval($content1[53]);//静态市盈率
         }
 
-        return Stock::update($stock_code,$data);
+        return Stock::updateByCode($stock_code,$data);
     }
 }

+ 10 - 2
lib/stock.class.php

@@ -19,11 +19,19 @@ class Stock {
         return $Table_stock->getInfoById($id);
     }
 
-    static public function update($stock_code,$attrs)
+    static public function update($stock_id,$attrs)
     {
         if (empty($attrs)) throw new Exception('参数不能为空', 102);
         $Table_stock = new Table_stock();
-        $id = $Table_stock->update($stock_code,$attrs);
+        $id = $Table_stock->update($stock_id,$attrs);
+        return $id;
+    }
+
+    static public function updateByCode($stock_code,$attrs)
+    {
+        if (empty($attrs)) throw new Exception('参数不能为空', 102);
+        $Table_stock = new Table_stock();
+        $id = $Table_stock->updateByCode($stock_code,$attrs);
         return $id;
     }
 

+ 16 - 0
lib/table/table_stock.class.php

@@ -58,6 +58,22 @@ class Table_stock extends Table {
         return $this->pdo->sqlinsert($this->table_fullname, $param);
     }
 
+
+    public function updateByCode($stock_code, $attrs)
+    {
+        $params = array();
+        foreach ($attrs as $key => $value) {
+            //$type = self::getTypeByAttr($key);
+            $params[$this->table_name.'_'.$key] = array('string', $value);
+
+        }
+        //where条件
+        $where = array( "stock_code" => array("number", $stock_code));
+        //返回结果
+        $r = $this->pdo->sqlupdate($this->table_fullname, $params, $where);
+        return $r;
+    }
+
     /***
      * @param array $filter
      * @param int $count