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

order

... ... @@ -28,7 +28,7 @@ use think\Db;
class AdminStatisticsController extends AdminBaseController{
public function index(){
//周统计
$week=array();
for ($i = 0; $i <= 15; $i++){
$week[15-$i]=strtotime(date('Ymd',strtotime("-$i week")));
... ... @@ -42,8 +42,7 @@ class AdminStatisticsController extends AdminBaseController{
$Week_statistics[]=Db::name('order')->where('start_time','between',$Week[$i])->count();
}
$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")));
... ... @@ -58,10 +57,9 @@ class AdminStatisticsController extends AdminBaseController{
}
$this->assign('monthData',json_encode($Month_statistics));
//时间段统计
dump($Month_statistics);
echo strtotime('2018-11-15 10:15:30');
$sql="SELECT count(*) as num FROM sleep_order where FROM_UNIXTIME(start_time,'%H:%i:%S')>'06:00:00' AND FROM_UNIXTIME(start_time,'%H:%i:%S')<'11:00:00'";
$num=Db::query($sql);
... ...
... ... @@ -93,15 +93,12 @@
//虚拟数据
var date = ['2016/11/1','2016/11/2','2016/11/3','2016/11/4','2016/11/5','2016/11/6','2016/11/7','2016/11/8','2016/11/9','2016/11/10',
'2016/11/11','2016/11/12','2016/11/13','2016/11/14','2016/11/15','2016/11/16','2016/11/17','2016/11/18'
,'2016/11/19','2016/11/20','2016/11/21','2016/11/22','2016/11/23','2016/11/24','2016/11/25','2016/11/26','2016/11/27'
,'2016/11/28','2016/11/29','2016/11/30'];
var date = ['21点-7点','17点-12点','12点-17点','17点-21点'];
function my_data(){
var data = [];
for( var i =0; i<30; i++){
for( var i =0; i<5; i++){
data.push(Math.round(Math.random() * (500 - 100) + 100));
};
return data;
... ... @@ -164,24 +161,19 @@
var myChart10 = ec.init(document.getElementById('main10'),'macarons');
var myChart11 = ec.init(document.getElementById('main11'),'macarons');
//时间段统计(柱形图)
var option = {
backgroundColor:'white',
title:{
text : '新老客户分析',
text : '时间段统计',
y: '15'
},
tooltip : {
trigger: 'axis',
formatter : function(data){
//console.log(data);
var str = data[1].name ;
str += '</br>新客户人数:' + data[1].value + ' 占比:' + bl;
str += '</br>新客户销售额:' + data[1].value + ' 占比:' + bl;
str += '</br>新客户成交笔数:' + data[1].value + ' 占比:' + bl;
str += '</br>老客户人数:' + data[1].value + ' 占比:' + bl;
str += '</br>老客户销售额:' + data[1].value + ' 占比:' + bl;
str += '</br>老客户成交笔数:' + data[1].value + ' 占比:' + bl;
var str = data[0].name ;
str += '</br>总人数:' + data[0].value + ' 占比:' + bl;
return str;
}
},
... ...