* Date: 2015/8/3
 * Time: 19:48
 * Mail每天各小时段登录次数汇总
 */
require '../../include/init.inc.php';
$method = $start_date = $end_date = $width = $height = $search = $ajaxMethod = '';
$_GET['width'] = empty($_GET['width']) ? 1280 : $_GET['width'];
$_GET['height'] = empty($_GET['height']) ? 600 : $_GET['height'];
$_GET['start_date'] = empty($_GET['start_date']) ? date("Y-m-d", time() - 86400) : $_GET['start_date'];
$_GET['end_date'] = empty($_GET['end_date']) ? date("Y-m-d", time() + 86400) : $_GET['end_date'];
$_GET['ajaxMethod'] = empty($_GET['ajaxMethod']) ? '' : $_GET['ajaxMethod'];
extract($_GET, EXTR_IF_EXISTS);
//ajax请求
if (isset($_SERVER["HTTP_X_REQUESTED_WITH"]) && strtolower($_SERVER["HTTP_X_REQUESTED_WITH"]) == "xmlhttprequest") {
    if ($ajaxMethod == 'showChart') {
        $detail = MailStatistics::getLoginCountForHoursData($start_date, $end_date);
        $list = array();
        foreach ($detail as $item) {
            $list['DAYS'][] = $item['MAIL_TIME'] . str_pad($item['HOURS'], 2, '0', STR_PAD_LEFT);
            $list['NUMS'][] = $item['NUM'];
        }
        $res = array();
        $res['list'] = $list;
        $res = json_encode($res);
        exit($res);
    }
    if ($ajaxMethod == 'showImg') {
        $data = MailStatistics::getLoginCountForHours($start_date, $end_date, $width, $height);
        $jpg = $data[0]['IMAGE'];
        if (!empty($jpg)) {
            $filename = 'LoginCountForHours.png';