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

order

@@ -33,13 +33,13 @@ class AdminStatisticsController extends AdminBaseController{ @@ -33,13 +33,13 @@ class AdminStatisticsController extends AdminBaseController{
33 for ($i = 0; $i <= 15; $i++){ 33 for ($i = 0; $i <= 15; $i++){
34 $week[15-$i]=strtotime(date('Ymd',strtotime("-$i week"))); 34 $week[15-$i]=strtotime(date('Ymd',strtotime("-$i week")));
35 } 35 }
36 - $where=array(); 36 + $Week=array();
37 for ($i = 0; $i<15; $i++){ 37 for ($i = 0; $i<15; $i++){
38 - $where[$i]=[$week[$i],$week[$i+1]]; 38 + $Week[$i]=[$week[$i],$week[$i+1]];
39 } 39 }
40 $Week_statistics=array(); 40 $Week_statistics=array();
41 for ($i = 0; $i<15; $i++){ 41 for ($i = 0; $i<15; $i++){
42 - $Week_statistics[]=Db::name('order')->where('start_time','between',$where[$i])->count(); 42 + $Week_statistics[]=Db::name('order')->where('start_time','between',$Week[$i])->count();
43 } 43 }
44 $this->assign('weekData',json_encode($Week_statistics)); 44 $this->assign('weekData',json_encode($Week_statistics));
45 45
@@ -48,7 +48,18 @@ class AdminStatisticsController extends AdminBaseController{ @@ -48,7 +48,18 @@ class AdminStatisticsController extends AdminBaseController{
48 for ($i = 0; $i <= 24; $i++){ 48 for ($i = 0; $i <= 24; $i++){
49 $month[24-$i]=strtotime(date('Y-m-1',strtotime("-$i Month"))); 49 $month[24-$i]=strtotime(date('Y-m-1',strtotime("-$i Month")));
50 } 50 }
51 - dump($month); 51 + $Month=array();
  52 + for ($i = 0; $i<24; $i++){
  53 + $Month[$i]=[$month[$i],$month[$i+1]];
  54 + }
  55 + $Month_statistics=array();
  56 + for ($i = 0; $i<15; $i++){
  57 + $Month_statistics[]=Db::name('order')->where('start_time','between',$Month[$i])->count();
  58 + }
  59 + $this->assign('monthData',json_encode($Month_statistics));
  60 +
  61 +
  62 + dump($Month_statistics);
52 63
53 echo strtotime('2018-11-15 10:15:30'); 64 echo strtotime('2018-11-15 10:15:30');
54 65