|
|
@@ -136,23 +136,36 @@ class Table_day_k extends Table {
|
|
|
return $msg;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- public function stock_recent_days($code,$start_date,$traceback_days,$order)
|
|
|
+ /****
|
|
|
+ * @param $code
|
|
|
+ * @param $start_date
|
|
|
+ * @param $traceback_days
|
|
|
+ * @param $order
|
|
|
+ * @return array
|
|
|
+ * wanggangtao
|
|
|
+ * 获取最近n天的数据
|
|
|
+ */
|
|
|
+ public function stock_recent_days($code,$start_date,$traceback_days,$order,$fq_price)
|
|
|
{
|
|
|
- //查询语句必须用sql_check_input检查参数
|
|
|
- $stock_code = $this->pdo->sql_check_input(array('string', $code));//类型是字符串,那一定要在条件中将数据使用引号引用起来,否则不使用索引
|
|
|
- $sql = "select * from ". $this->table_fullname ." where 1=1 ";
|
|
|
- $where =" and day_k_code=".$stock_code." and day_k_timestamp <=".$start_date ;
|
|
|
- $sql.=$where;
|
|
|
- $orderInfo=" ORDER BY day_k_date desc";
|
|
|
- $sql.=$orderInfo;
|
|
|
- $limit=" limit ".$traceback_days;
|
|
|
- $sql.=$limit;
|
|
|
- if($order==1){
|
|
|
- $sql= " SELECT a.* FROM "."($sql) a ORDER BY a.day_k_timestamp desc ";
|
|
|
|
|
|
- }else{
|
|
|
- $sql= " SELECT a.* FROM "."($sql) a ORDER BY a.day_k_timestamp asc";
|
|
|
+ if($fq_price==1){//前复权
|
|
|
+
|
|
|
+ }else{//不复权
|
|
|
+ //查询语句必须用sql_check_input检查参数
|
|
|
+ $stock_code = $this->pdo->sql_check_input(array('string', $code));
|
|
|
+ $sql = "select * from ". $this->table_fullname ." where 1=1 ";
|
|
|
+ $where =" and day_k_code=".$stock_code." and day_k_timestamp <=".$start_date ;
|
|
|
+ $sql.=$where;
|
|
|
+ $orderInfo=" ORDER BY day_k_date desc";
|
|
|
+ $sql.=$orderInfo;
|
|
|
+ $limit=" limit ".$traceback_days;
|
|
|
+ $sql.=$limit;
|
|
|
+ if($order==1){
|
|
|
+ $sql= " SELECT a.* FROM "."($sql) a ORDER BY a.day_k_date desc ";
|
|
|
+
|
|
|
+ }else{
|
|
|
+ $sql= " SELECT a.* FROM "."($sql) a ORDER BY a.day_k_date asc";
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
$rs = $this->pdo->sqlQuery($sql);
|