Your Name 2 年之前
父节点
当前提交
0f62a4bfea
共有 1 个文件被更改,包括 27 次插入1 次删除
  1. 27 1
      service/mail/lib/Manage.php

+ 27 - 1
service/mail/lib/Manage.php

@@ -28,6 +28,7 @@ class Manage
         $data['start'] = date('Y-m-d',$start);
         $data['day'] = $this->content_api($where,1);
         $data['money'] = $this->c_api($where);
+        $data['week'] = $this->zhou_api($start);
         $data['all'] = $this->content_api($w,2);
         $data['all_money'] = $this->c_api($w);
         $data['time'] = $this->day_time_api($w);
@@ -36,7 +37,7 @@ 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);
 	}
 
@@ -155,6 +156,14 @@ class Manage
     }
     #数据趋势
     public function day_time_api($w){
+        $time = date('m',time()) - date('m',$w['fstart']);
+        $start = date('Y-m-01',$w['fstart']);
+        if($time<=0){
+            $w['fend'] = time();
+        }elseif($time>0){
+            $w['fend'] = strtotime(date('Y-m-d 23:59:59',
+                strtotime($start."+1 month - 1 day")));
+        }
       $days = ($w['fend']-$w['fstart'])/86400+1;
       // 保存每天日期
       $day = array();
@@ -172,6 +181,7 @@ class Manage
         $where['status'] = 4;
         $res['num'][] = Dever::db('agent/order')->getNum($where);
       }
+      // print_R($where);die;
       $data = array();
       $data['name'] = '数量';
       $data['type'] = 'line';
@@ -181,6 +191,14 @@ class Manage
     }
     #金额趋势
     public function money_time_api($w){
+        $time = date('m',time()) - date('m',$w['fstart']);
+        $start = date('Y-m-01',$w['fstart']);
+        if($time<=0){
+            $w['fend'] = time();
+        }elseif($time>0){
+            $w['fend'] = strtotime(date('Y-m-d 23:59:59',
+                strtotime($start."+1 month - 1 day")));
+        }
       $days = ($w['fend']-$w['fstart'])/86400+1;
       // 保存每天日期
       $day = array();
@@ -210,6 +228,14 @@ class Manage
     }
     #趋势底部日期
     public function button_day_api($w,$type){
+        $time = date('m',time()) - date('m',$w['fstart']);
+        $start = date('Y-m-01',$w['fstart']);
+        if($time<=0){
+            $w['fend'] = time();
+        }elseif($time>0){
+            $w['fend'] = strtotime(date('Y-m-d 23:59:59',
+                strtotime($start."+1 month - 1 day")));
+        }
         $days = ($w['fend']-$w['fstart'])/86400+1;
         if($type ==1){
             $daysd = $days-1;