|
|
@@ -32,6 +32,38 @@ class Table_index_day_k extends Table {
|
|
|
return $attr;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ public function index_recent_days($code,$start_date,$traceback_days,$order)
|
|
|
+ {
|
|
|
+ //查询语句必须用sql_check_input检查参数
|
|
|
+ $stock_code = $this->pdo->sql_check_input(array('string', $code));//类型是字符串,那一定要在条件中将数据使用引号引用起来,否则不使用索引
|
|
|
+ $sql = "select * from ". $this->table_fullname ." where 1=1 ";
|
|
|
+ $where =" and index_day_k_code=".$stock_code." and index_day_k_date <=".$start_date ;
|
|
|
+ $sql.=$where;
|
|
|
+ $orderInfo=" ORDER BY index_day_k_date desc";
|
|
|
+ $sql.=$orderInfo;
|
|
|
+ $limit=" limit ".$traceback_days;
|
|
|
+ $sql.=$limit;
|
|
|
+ if($order==1){
|
|
|
+ $sql= " SELECT a.* FROM "."($sql) a ORDER BY a.index_day_k_date desc ";
|
|
|
+
|
|
|
+ }else{
|
|
|
+ $sql= " SELECT a.* FROM "."($sql) a ORDER BY a.index_day_k_date asc";
|
|
|
+ }
|
|
|
+ $rs = $this->pdo->sqlQuery($sql);
|
|
|
+ $r = array();
|
|
|
+ if($rs){
|
|
|
+ foreach($rs as $key => $val){
|
|
|
+
|
|
|
+ $r[$key] = $this->dataToAttr($val);
|
|
|
+ }
|
|
|
+ return $r;
|
|
|
+ }else{
|
|
|
+ return $r;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/***
|
|
|
* @param $code
|
|
|
* @param $date
|