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

order

... ... @@ -50,28 +50,34 @@ class AdminStatisticsController extends AdminBaseController{
for ($i = 0; $i <= 30; $i++){
$week[30-$i]=strtotime(date('Ymd',strtotime("-$i week")));
}
$Week=array();
$Week_interval=array();
for ($i = 0; $i<30; $i++){
$Week[$i]=[$week[$i],$week[$i+1]];
$Week_interval[$i]=[$week[$i],$week[$i+1]];
}
$Week_statistics=array();
$Week=array();
for ($i = 0; $i<30; $i++){
$Week_statistics[]=Db::name('order')->where('start_time','between',$Week[$i])->count();
$Week[]=date('Y-m-d',$Week_interval[$i][1]);
$Week_statistics[]=Db::name('order')->where('start_time','between',$Week_interval[$i])->count();
}
$this->assign('weed',json_encode($Week));
$this->assign('weekData',json_encode($Week_statistics));
//月统计
$month=array();
for ($i = 0; $i <= 24; $i++){
$month[24-$i]=strtotime(date('Y-m-1',strtotime("-$i Month")));
}
$Month=array();
$month_interval=array();
for ($i = 0; $i<24; $i++){
$Month[$i]=[$month[$i],$month[$i+1]];
$month_interval[$i]=[$month[$i],$month[$i+1]];
}
$Month_statistics=array();
$Month=array();
for ($i = 0; $i<24; $i++){
$Month_statistics[]=Db::name('order')->where('start_time','between',$Month[$i])->count();
$Month[]=date('Y-m-d',$month_interval[$i][1]);
$Month_statistics[]=Db::name('order')->where('start_time','between',$month_interval[$i])->count();
}
$this->assign('month',json_encode($Month));
$this->assign('monthData',json_encode($Month_statistics));
//时间段统计
... ...
... ... @@ -106,16 +106,11 @@
//周统计数据
var weekDataX = ["第一周","第二周","第三周","第四周","第五周","第六周", "第七周",
"第八周","第九周","第十周","第十一周","第十二周","第十三周","第十四周","第十五周",
"第十六周","第十七周","第十八周","第十九周","第二十周","第二十一周", "第二十二周",
"第二十三周", "第二十四周","第二十五周","第二十六周","第二十七周","第二十八周","第二十九周","第三十周"];
var weekDataX = JSON.parse('{$week}');
var weekDataY = JSON.parse('{$weekData}');
//月统计数据
var monthDataX = ["第一月","第二月","第三月","第四月","第五月","第六月", "第七月",
"第八月","第九月","第十月","第十一月","第十二月","第十三月","第十四月","第十五月",
"第十六月","第十七月","第十八月","第十九月","第二十月","第二十一月","第二十二月","第二十三月","第二十四月"];
var monthDataX = JSON.parse('{$month}');
var monthDataY = JSON.parse('{$monthData}');
... ...