正在显示
2 个修改的文件
包含
9 行增加
和
19 行删除
@@ -28,7 +28,7 @@ use think\Db; | @@ -28,7 +28,7 @@ use think\Db; | ||
28 | class AdminStatisticsController extends AdminBaseController{ | 28 | class AdminStatisticsController extends AdminBaseController{ |
29 | 29 | ||
30 | public function index(){ | 30 | public function index(){ |
31 | - | 31 | + //周统计 |
32 | $week=array(); | 32 | $week=array(); |
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"))); |
@@ -42,8 +42,7 @@ class AdminStatisticsController extends AdminBaseController{ | @@ -42,8 +42,7 @@ class AdminStatisticsController extends AdminBaseController{ | ||
42 | $Week_statistics[]=Db::name('order')->where('start_time','between',$Week[$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 | - | ||
46 | - | 45 | + //月统计 |
47 | $month=array(); | 46 | $month=array(); |
48 | for ($i = 0; $i <= 24; $i++){ | 47 | for ($i = 0; $i <= 24; $i++){ |
49 | $month[24-$i]=strtotime(date('Y-m-1',strtotime("-$i Month"))); | 48 | $month[24-$i]=strtotime(date('Y-m-1',strtotime("-$i Month"))); |
@@ -58,10 +57,9 @@ class AdminStatisticsController extends AdminBaseController{ | @@ -58,10 +57,9 @@ class AdminStatisticsController extends AdminBaseController{ | ||
58 | } | 57 | } |
59 | $this->assign('monthData',json_encode($Month_statistics)); | 58 | $this->assign('monthData',json_encode($Month_statistics)); |
60 | 59 | ||
60 | + //时间段统计 | ||
61 | 61 | ||
62 | - dump($Month_statistics); | ||
63 | 62 | ||
64 | - echo strtotime('2018-11-15 10:15:30'); | ||
65 | 63 | ||
66 | $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'"; | 64 | $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'"; |
67 | $num=Db::query($sql); | 65 | $num=Db::query($sql); |
@@ -93,15 +93,12 @@ | @@ -93,15 +93,12 @@ | ||
93 | 93 | ||
94 | 94 | ||
95 | //虚拟数据 | 95 | //虚拟数据 |
96 | - 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', | ||
97 | - '2016/11/11','2016/11/12','2016/11/13','2016/11/14','2016/11/15','2016/11/16','2016/11/17','2016/11/18' | ||
98 | - ,'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' | ||
99 | - ,'2016/11/28','2016/11/29','2016/11/30']; | 96 | + var date = ['21点-7点','17点-12点','12点-17点','17点-21点']; |
100 | 97 | ||
101 | 98 | ||
102 | function my_data(){ | 99 | function my_data(){ |
103 | var data = []; | 100 | var data = []; |
104 | - for( var i =0; i<30; i++){ | 101 | + for( var i =0; i<5; i++){ |
105 | data.push(Math.round(Math.random() * (500 - 100) + 100)); | 102 | data.push(Math.round(Math.random() * (500 - 100) + 100)); |
106 | }; | 103 | }; |
107 | return data; | 104 | return data; |
@@ -164,24 +161,19 @@ | @@ -164,24 +161,19 @@ | ||
164 | var myChart10 = ec.init(document.getElementById('main10'),'macarons'); | 161 | var myChart10 = ec.init(document.getElementById('main10'),'macarons'); |
165 | var myChart11 = ec.init(document.getElementById('main11'),'macarons'); | 162 | var myChart11 = ec.init(document.getElementById('main11'),'macarons'); |
166 | 163 | ||
164 | + //时间段统计(柱形图) | ||
167 | var option = { | 165 | var option = { |
168 | backgroundColor:'white', | 166 | backgroundColor:'white', |
169 | title:{ | 167 | title:{ |
170 | - text : '新老客户分析', | 168 | + text : '时间段统计', |
171 | y: '15' | 169 | y: '15' |
172 | }, | 170 | }, |
173 | tooltip : { | 171 | tooltip : { |
174 | trigger: 'axis', | 172 | trigger: 'axis', |
175 | formatter : function(data){ | 173 | formatter : function(data){ |
176 | //console.log(data); | 174 | //console.log(data); |
177 | - var str = data[1].name ; | ||
178 | - str += '</br>新客户人数:' + data[1].value + ' 占比:' + bl; | ||
179 | - str += '</br>新客户销售额:' + data[1].value + ' 占比:' + bl; | ||
180 | - str += '</br>新客户成交笔数:' + data[1].value + ' 占比:' + bl; | ||
181 | - str += '</br>老客户人数:' + data[1].value + ' 占比:' + bl; | ||
182 | - str += '</br>老客户销售额:' + data[1].value + ' 占比:' + bl; | ||
183 | - str += '</br>老客户成交笔数:' + data[1].value + ' 占比:' + bl; | ||
184 | - | 175 | + var str = data[0].name ; |
176 | + str += '</br>总人数:' + data[0].value + ' 占比:' + bl; | ||
185 | return str; | 177 | return str; |
186 | } | 178 | } |
187 | }, | 179 | }, |
-
请 注册 或 登录 后发表评论