作者 董瑞恩
1 个管道 的构建 通过 耗费 0 秒

order

@@ -50,28 +50,34 @@ class AdminStatisticsController extends AdminBaseController{ @@ -50,28 +50,34 @@ class AdminStatisticsController extends AdminBaseController{
50 for ($i = 0; $i <= 30; $i++){ 50 for ($i = 0; $i <= 30; $i++){
51 $week[30-$i]=strtotime(date('Ymd',strtotime("-$i week"))); 51 $week[30-$i]=strtotime(date('Ymd',strtotime("-$i week")));
52 } 52 }
53 - $Week=array(); 53 + $Week_interval=array();
54 for ($i = 0; $i<30; $i++){ 54 for ($i = 0; $i<30; $i++){
55 - $Week[$i]=[$week[$i],$week[$i+1]]; 55 + $Week_interval[$i]=[$week[$i],$week[$i+1]];
56 } 56 }
57 $Week_statistics=array(); 57 $Week_statistics=array();
  58 + $Week=array();
58 for ($i = 0; $i<30; $i++){ 59 for ($i = 0; $i<30; $i++){
59 - $Week_statistics[]=Db::name('order')->where('start_time','between',$Week[$i])->count(); 60 + $Week[]=date('Y-m-d',$Week_interval[$i][1]);
  61 + $Week_statistics[]=Db::name('order')->where('start_time','between',$Week_interval[$i])->count();
60 } 62 }
  63 + $this->assign('weed',json_encode($Week));
61 $this->assign('weekData',json_encode($Week_statistics)); 64 $this->assign('weekData',json_encode($Week_statistics));
62 //月统计 65 //月统计
63 $month=array(); 66 $month=array();
64 for ($i = 0; $i <= 24; $i++){ 67 for ($i = 0; $i <= 24; $i++){
65 $month[24-$i]=strtotime(date('Y-m-1',strtotime("-$i Month"))); 68 $month[24-$i]=strtotime(date('Y-m-1',strtotime("-$i Month")));
66 } 69 }
67 - $Month=array(); 70 + $month_interval=array();
68 for ($i = 0; $i<24; $i++){ 71 for ($i = 0; $i<24; $i++){
69 - $Month[$i]=[$month[$i],$month[$i+1]]; 72 + $month_interval[$i]=[$month[$i],$month[$i+1]];
70 } 73 }
71 $Month_statistics=array(); 74 $Month_statistics=array();
  75 + $Month=array();
72 for ($i = 0; $i<24; $i++){ 76 for ($i = 0; $i<24; $i++){
73 - $Month_statistics[]=Db::name('order')->where('start_time','between',$Month[$i])->count(); 77 + $Month[]=date('Y-m-d',$month_interval[$i][1]);
  78 + $Month_statistics[]=Db::name('order')->where('start_time','between',$month_interval[$i])->count();
74 } 79 }
  80 + $this->assign('month',json_encode($Month));
75 $this->assign('monthData',json_encode($Month_statistics)); 81 $this->assign('monthData',json_encode($Month_statistics));
76 82
77 //时间段统计 83 //时间段统计
@@ -106,16 +106,11 @@ @@ -106,16 +106,11 @@
106 106
107 107
108 //周统计数据 108 //周统计数据
109 - var weekDataX = ["第一周","第二周","第三周","第四周","第五周","第六周", "第七周",  
110 - "第八周","第九周","第十周","第十一周","第十二周","第十三周","第十四周","第十五周",  
111 - "第十六周","第十七周","第十八周","第十九周","第二十周","第二十一周", "第二十二周",  
112 - "第二十三周", "第二十四周","第二十五周","第二十六周","第二十七周","第二十八周","第二十九周","第三十周"]; 109 + var weekDataX = JSON.parse('{$week}');
113 var weekDataY = JSON.parse('{$weekData}'); 110 var weekDataY = JSON.parse('{$weekData}');
114 111
115 //月统计数据 112 //月统计数据
116 - var monthDataX = ["第一月","第二月","第三月","第四月","第五月","第六月", "第七月",  
117 - "第八月","第九月","第十月","第十一月","第十二月","第十三月","第十四月","第十五月",  
118 - "第十六月","第十七月","第十八月","第十九月","第二十月","第二十一月","第二十二月","第二十三月","第二十四月"]; 113 + var monthDataX = JSON.parse('{$month}');
119 var monthDataY = JSON.parse('{$monthData}'); 114 var monthDataY = JSON.parse('{$monthData}');
120 115
121 116