AdminStatisticsController.php
1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
/**
* Created by PhpStorm.
* User: ruidiudiu
* Date: 2018/11/21
* Time: 17:20
*/
namespace app\portal\controller;
use cmf\controller\AdminBaseController;
use think\Db;
/**
* Class AdminStatisticsController
* @package app\portal\controller
* @adminMenuRoot(
* 'name' =>'数据统计',
* 'action' =>'index',
* 'parent' =>'',
* 'display'=> true,
* 'order' => 1,
* 'icon' =>'th',
* 'remark' =>'数据统计'
* )
*/
class AdminStatisticsController extends AdminBaseController{
public function index(){
$week=array();
for ($i = 0; $i <= 15; $i++){
$week[15-$i]=strtotime(date('Ymd',strtotime("-$i week")));
}
dump($week);
$month=array();
for ($i = 0; $i <= 24; $i++){
$month[24-$i]=strtotime(date('Y-m-1',strtotime("-$i Month")));
}
dump($month);
echo strtotime('2017-12-8 10:15:30');
$where['start_time']=['between',[strtotime(date('Y-m-d 7:i:s')),strtotime(date('Y-m-d 12:i:s'))]];
$num=Db::name('order')->where($where)->count();
dump($num);
return $this->fetch();
}
}