|
@@ -42,23 +42,29 @@ class Jiankangdata extends Api
|
|
public function data(){
|
|
public function data(){
|
|
$type = $this->request->post('type','week','trim');
|
|
$type = $this->request->post('type','week','trim');
|
|
|
|
|
|
|
|
+ $page = $this->request->post('page',1,'intval');
|
|
|
|
+ if($page < 1){ $page = 1;}
|
|
|
|
+
|
|
if($type == 'week'){
|
|
if($type == 'week'){
|
|
- $start_date = date('Y-m-d', strtotime('monday this week'));
|
|
|
|
- $ended_date = date('Y-m-d', strtotime('sunday this week'));
|
|
|
|
|
|
+ $start_time = strtotime('monday this week') - (7 * 86400 * ($page - 1));
|
|
|
|
+ $ended_time = strtotime('sunday this week') - (7 * 86400 * ($page - 1));
|
|
|
|
+ $start_date = date('Y-m-d', $start_time);
|
|
|
|
+ $ended_date = date('Y-m-d', $ended_time);
|
|
|
|
|
|
$days = 7;
|
|
$days = 7;
|
|
for($i=0;$i<$days;$i++){
|
|
for($i=0;$i<$days;$i++){
|
|
- $date_array[] = date('m.d', 86400*$i + strtotime('monday this week'));
|
|
|
|
|
|
+ $date_array[] = date('m.d', 86400*$i + $start_time);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
if($type == 'month'){
|
|
if($type == 'month'){
|
|
- $start_date = date('Y-m-01');
|
|
|
|
- $ended_date = date('Y-m-t');
|
|
|
|
|
|
+ $start_time = strtotime('first day of -'.($page - 1).' month');
|
|
|
|
+ $start_date = date('Y-m-01',$start_time);
|
|
|
|
+ $ended_date = date('Y-m-t', $start_time);
|
|
|
|
|
|
- $days = date('t');
|
|
|
|
|
|
+ $days = date('t',$start_time);
|
|
for($i=0;$i<$days;$i++){
|
|
for($i=0;$i<$days;$i++){
|
|
- $date_array[] = date('m.d', 86400*$i + strtotime(date('Y-m-01')));
|
|
|
|
|
|
+ $date_array[] = date('m.d', 86400*$i + strtotime($start_date));
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|