0 and (ts_code not like '7%' and ts_code not like '1%') and length(trade_id)=5 order by ts_code EOF; }elseif($_REQUEST['t_vendor']=='长江证券'){ //length(0+ts_name)!=length(ts_name) 判断ts_name 不能为纯数字 $sql= <<< EOF select distinct(ts_code) ts_code,ts_name from trade_record_cj where tprice>0 and ts_code not like '7%' and length(0+ts_name)!=length(ts_name) order by ts_code EOF; } $result = $mysqli->query($sql); $data = $result->fetch_all(MYSQLI_ASSOC); echo json_encode(array( "status" => "1", 'stocks'=> $data, "company"=>$_REQUEST['t_vendor'], ),JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE); } /** * AJAX get finance Data from getFianceData class */ if($_REQUEST['t']=='financeData'){ include_once __DIR__."/getFinanceData.class.php"; include_once __DIR__."/getBasic.inc.php"; $years=yearList($_REQUEST['yst'],$_REQUEST['yed']); $fina = new getFinance(); $fina->ts_code=$_REQUEST['ts_code']; $dataAll=array(); foreach($years as $year){ $fina->finDate=$year; $dataAll[] =$fina->getFinanceData(); } for($i=0;$i$val){ $n++; if(strlen($n)<2) $n='0'.$n; if($key=='ts_code') { $key=$n.'.股票代码'; $val=tscodeToName($val); $n--; continue; //不显示股票代码 }elseif($key=='period') { $key=$n.'.报告期'; $val=yearToname($val); $n--; continue; //不显示报告期 }else $key=$n.'.'.$key; if($i==0) $data[$n][]=$key; //首列加 $data[$n][]=$val; } } //strip key from array $data //dataTable must NOT have any key of json $data=array_values($data); echo json_encode(array("data"=>$data),JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE); } /* *esfTBD: 二手房Trade By Day */ if($_REQUEST['t']=='esfTBD'){ $dataTrade=esfTradeDaily(); $dataList=esfListDaily(); echo json_encode(array( "status" => "1", 'dataTrade'=> $dataTrade, 'dataList'=>$dataList ),JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE); } /* *esfListDaily: 二手房每日挂牌数量 */ if($_REQUEST['t']=='esfListDaily'){ $data=esfListDaily(); echo json_encode(array( "status" => "1", 'datas'=> $data ),JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE); } function esfTradeDaily(){ global $mysqli; if($_REQUEST['dm']=='Daily'){ $sql= <<='{$_REQUEST['t_start']}' and ej.tdate<='{$_REQUEST['t_end']}') order by ej.tdate asc EOF; } if($_REQUEST['dm']=='Monthly'){ $where=""; if($_REQUEST['t_start']) $where .=" and ej.tdate>='{$_REQUEST['t_start']}-01'"; if($_REQUEST['t_end']) { $endDate = new DateTime($_REQUEST['t_end']); $endDate->modify('last day of this month'); $where .=" and ej.tdate<='{$endDate->format('Y-m-d')}'"; } $sql= <<query($sql); $data = $result->fetch_all(MYSQLI_ASSOC); return $data; } function esfListDaily(){ global $mysqli; if($_REQUEST['dm']=='Daily'){ $sql= <<='{$_REQUEST['t_start']}' and ej.tdate<='{$_REQUEST['t_end']}') order by ej.tdate asc EOF; } if($_REQUEST['dm']=='Monthly'){ $where=""; if($_REQUEST['t_start']) $where .=" and ej.tdate>='{$_REQUEST['t_start']}-01'"; if($_REQUEST['t_end']) { $endDate = new DateTime($_REQUEST['t_end']); $endDate->modify('last day of this month'); $where .=" and ej.tdate<='{$endDate->format('Y-m-d')}'"; } $sql= <<query($sql); $data = $result->fetch_all(MYSQLI_ASSOC); return $data; } /* *newTBD: 新房Trade By Day */ if($_REQUEST['t']=='newTBD'){ if($_REQUEST['dm']=='Daily'){ $sql= <<='{$_REQUEST['t_start']}' and ej.tdate<='{$_REQUEST['t_end']}') order by date_format(tdate,'%Y-%m-%d') asc EOF; } if($_REQUEST['dm']=='Monthly'){ $where=""; if($_REQUEST['t_start']) $where .=" and ej.tdate>='{$_REQUEST['t_start']}-01'"; if($_REQUEST['t_end']) { $endDate = new DateTime($_REQUEST['t_end']); $endDate->modify('last day of this month'); $where .=" and ej.tdate<='{$endDate->format('Y-m-d')}'"; } $sql= <<query($sql); $data = $result->fetch_all(MYSQLI_ASSOC); if($_REQUEST['dm']=='Daily'){ $sql= <<='{$_REQUEST['t_start']}' and ej.tdate<='{$_REQUEST['t_end']}') order by date_format(tdate,'%Y-%m-%d') asc EOF; } if($_REQUEST['dm']=='Monthly'){ $where=""; if($_REQUEST['t_start']) $where .=" and ej.tdate>='{$_REQUEST['t_start']}-01'"; if($_REQUEST['t_end']) { $endDate = new DateTime($_REQUEST['t_end']); $endDate->modify('last day of this month'); $where .=" and ej.tdate<='{$endDate->format('Y-m-d')}'"; } $sql= <<query($sql); $data2 = $result->fetch_all(MYSQLI_ASSOC); echo json_encode(array( "status" => "1", 'datas'=> $data, 'dataExt'=> $data2 ),JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE); }