|
|
@@ -55,48 +55,6 @@ class Table_index_day_k extends Table {
|
|
|
//-------------------------------
|
|
|
|
|
|
|
|
|
-
|
|
|
- /***
|
|
|
- * @param $code
|
|
|
- * @param $date
|
|
|
- * @return array
|
|
|
- * wanggangtao
|
|
|
- * 获取某天的指数代码
|
|
|
- */
|
|
|
- public function get_current_day_index($code,$date)
|
|
|
- {
|
|
|
- //查询语句必须用sql_check_input检查参数
|
|
|
- $stock_code = $this->pdo->sql_check_input(array('string', $code));//类型是字符串,那一定要在条件中将数据使用引号引用起来,否则不使用索引
|
|
|
- $sql = "select * from ". $this->table_fullname ;
|
|
|
-
|
|
|
- $where=" where 1=1 ";
|
|
|
- $where.=" and index_day_k_code=".$stock_code ;
|
|
|
-
|
|
|
- if($date==0){//获取的是当天的数据,最近一天的交易日的数据
|
|
|
- $date = date("Ymd",time());
|
|
|
- $where.=" and index_day_k_date <= ".$date;
|
|
|
-
|
|
|
- }else{//获取某一天的数据,不是交易日则返回空
|
|
|
- $date = $this->pdo->sql_check_input(array('number', $date));
|
|
|
- $where.=" and index_day_k_date =".$date;
|
|
|
- }
|
|
|
- $sql.=$where;
|
|
|
- $order=" order by index_day_k_date desc limit 1 ";
|
|
|
- $sql.=$order;
|
|
|
-
|
|
|
- $rs = $this->pdo->sqlQuery($sql);
|
|
|
- $r = array();
|
|
|
- if($rs){
|
|
|
- foreach($rs as $key => $val){
|
|
|
-
|
|
|
- $r[$key] = $this->dataToAttr($val);
|
|
|
- }
|
|
|
- return $r[0];
|
|
|
- }else{
|
|
|
- return $r;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
/****
|
|
|
* @param $start_date
|
|
|
* @param $end_date
|