|
@@ -7,17 +7,26 @@ class Manage
|
|
|
{
|
|
|
|
|
|
public function day_api(){
|
|
|
- $start=mktime(0,0,0,date('m'),date('d')-1,date('Y'));
|
|
|
- $end=mktime(0,0,0,date('m'),date('d'),date('Y'))-1;
|
|
|
+ $day = Dever::input('day');
|
|
|
+ if($day){
|
|
|
+ $start = strtotime($day);
|
|
|
+ $end = $start+86400-1;
|
|
|
+ }else{
|
|
|
+ $start=mktime(0,0,0,date('m'),date('d')-1,date('Y'));
|
|
|
+ $end=mktime(0,0,0,date('m'),date('d'),date('Y'))-1;
|
|
|
+ }
|
|
|
+
|
|
|
$time = Dever::maketime(date('Y-m-d'),'00:00:00');
|
|
|
$where = array();
|
|
|
$where['fstart'] = $start;
|
|
|
$where['fend'] = $end;
|
|
|
+
|
|
|
$w = array();
|
|
|
$fstart = Dever::input('start', date('Y-m-01', strtotime('-0 month')));
|
|
|
$w['fstart'] = Dever::maketime($fstart . ' 00:00:00');
|
|
|
$w['fend'] = $end;
|
|
|
$data = array();
|
|
|
+ $data['start'] = date('Y-m-d',$start);
|
|
|
$data['day'] = $this->content_api($where,1);
|
|
|
$data['money'] = $this->c_api($where);
|
|
|
$data['all'] = $this->content_api($w,2);
|
|
@@ -28,60 +37,29 @@ class Manage
|
|
|
$data['qu_money'] = Dever::json_encode($data['money_time']);
|
|
|
$data['xzhou'] = $this->button_day_api($w,1);
|
|
|
$data['zhou'] = Dever::json_encode($data['xzhou']);
|
|
|
+ $data['week'] = $this->zhou_api($start);
|
|
|
return Dever::render('census', $data);
|
|
|
}
|
|
|
-
|
|
|
- public function zhou_api(){
|
|
|
- $start=mktime(0,0,0,date('m'),date('d')-date('w')+1-7,date('Y'));
|
|
|
- $end=mktime(23,59,59,date('m'),date('d')-date('w')+7-7,date('Y'));
|
|
|
+
|
|
|
+ public function zhou_api($time='',$format="Y-m-d"){
|
|
|
+ $time = $time != '' ? $time : time();
|
|
|
+ $week = date('w', $time);
|
|
|
+ $date = [];
|
|
|
+ for ($i=1; $i<=7; $i++){
|
|
|
+ $date[$i] = date($format ,strtotime( '+' . $i-$week .' days', $time));
|
|
|
+ }
|
|
|
+ $start = strtotime($date[1]);
|
|
|
+ $end = strtotime($date[7])+86400-1;
|
|
|
$where = array();
|
|
|
$where['fstart'] = $start;
|
|
|
$where['fend'] = $end;
|
|
|
- $w = array();
|
|
|
- $fstart = Dever::input('start', date('Y-m-01', strtotime('-0 month')));
|
|
|
- $w['fstart'] = Dever::maketime($fstart . ' 00:00:00');
|
|
|
- $w['fend'] = $end;
|
|
|
+
|
|
|
$data = array();
|
|
|
- $data['day'] = $this->content_api($where,1);
|
|
|
- $data['money'] = $this->c_api($where);
|
|
|
- $data['all'] = $this->content_api($w,2);
|
|
|
- $data['all_money'] = $this->c_api($w);
|
|
|
- $data['time'] = $this->day_time_api($w);
|
|
|
- $data['data'] = Dever::json_encode($data['time']);
|
|
|
- $data['money_time'] = $this->money_time_api($w);
|
|
|
- $data['qu_money'] = Dever::json_encode($data['money_time']);
|
|
|
- $data['xzhou'] = $this->button_day_api($w,1);
|
|
|
- $data['zhou'] = Dever::json_encode($data['xzhou']);
|
|
|
- return Dever::render('census', $data);
|
|
|
+ $data['week'] = date('Y.m.d',$start).' - '.date('Y.m.d',$end);
|
|
|
+ $data['all'] = $this->content_api($where,2);
|
|
|
+ $data['all_money'] = $this->c_api($where);
|
|
|
+ return $data;
|
|
|
}
|
|
|
-
|
|
|
- public function month_api(){
|
|
|
- $num = Dever::input('num',1);
|
|
|
- $start = Dever::input('start', date('Y-m-01', strtotime('-'.$num.' month')));
|
|
|
- $end = date('Y-m-d', strtotime($start." +1 month -1 day"));
|
|
|
- $time = Dever::maketime(date('Y-m-01'),'00:00:00');
|
|
|
- $start = Dever::maketime($start . ' 00:00:00');
|
|
|
- $end = Dever::maketime($end . ' 23:59:59');
|
|
|
- $where = array();
|
|
|
- $where['fstart'] = $start;
|
|
|
- $where['fend'] = $end;
|
|
|
- $w = array();
|
|
|
- $fstart = Dever::input('start', date('Y-m-01', strtotime('-1 month')));
|
|
|
- $w['fstart'] = Dever::maketime($fstart . ' 00:00:00');
|
|
|
- $w['fend'] = $end;
|
|
|
- $data = array();
|
|
|
- $data['day'] = $this->content_api($where,1);
|
|
|
- $data['money'] = $this->c_api($where);
|
|
|
- $data['all'] = $this->content_api($w,2);
|
|
|
- $data['all_money'] = $this->c_api($w);
|
|
|
- $data['time'] = $this->day_time_api($w);
|
|
|
- $data['data'] = Dever::json_encode($data['time']);
|
|
|
- $data['money_time'] = $this->money_time_api($w);
|
|
|
- $data['qu_money'] = Dever::json_encode($data['money_time']);
|
|
|
- $data['xzhou'] = $this->button_day_api($w,2);
|
|
|
- $data['zhou'] = Dever::json_encode($data['xzhou']);
|
|
|
- return Dever::render('census', $data);
|
|
|
- }
|
|
|
|
|
|
public function content_api($where,$type){
|
|
|
$data = array();
|