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

order

... ... @@ -33,13 +33,13 @@ class AdminStatisticsController extends AdminBaseController{
for ($i = 0; $i <= 15; $i++){
$week[15-$i]=strtotime(date('Ymd',strtotime("-$i week")));
}
$where=array();
$Week=array();
for ($i = 0; $i<15; $i++){
$where[$i]=[$week[$i],$week[$i+1]];
$Week[$i]=[$week[$i],$week[$i+1]];
}
$Week_statistics=array();
for ($i = 0; $i<15; $i++){
$Week_statistics[]=Db::name('order')->where('start_time','between',$where[$i])->count();
$Week_statistics[]=Db::name('order')->where('start_time','between',$Week[$i])->count();
}
$this->assign('weekData',json_encode($Week_statistics));
... ... @@ -48,7 +48,18 @@ class AdminStatisticsController extends AdminBaseController{
for ($i = 0; $i <= 24; $i++){
$month[24-$i]=strtotime(date('Y-m-1',strtotime("-$i Month")));
}
dump($month);
$Month=array();
for ($i = 0; $i<24; $i++){
$Month[$i]=[$month[$i],$month[$i+1]];
}
$Month_statistics=array();
for ($i = 0; $i<15; $i++){
$Month_statistics[]=Db::name('order')->where('start_time','between',$Month[$i])->count();
}
$this->assign('monthData',json_encode($Month_statistics));
dump($Month_statistics);
echo strtotime('2018-11-15 10:15:30');
... ...