AdminStatisticsController.php 1.2 KB
<?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('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);


        dump($num);

        return $this->fetch();
    }




}