コード例 #1
0
ファイル: member_increase.php プロジェクト: ChainBoy/wxfx
    $charttitle = "最近{$days}天增长趋势图";
    for ($i = $days; $i >= 0; $i--) {
        $time = date("Y-m-d", strtotime("-" . $i . " day"));
        $condition = " and uniacid=:uniacid and {$timefield}>=:starttime and {$timefield}<=:endtime";
        $params = array(':uniacid' => $_W['uniacid'], ':starttime' => strtotime("{$time} 00:00:00"), ':endtime' => strtotime("{$time} 23:59:59"));
        $datas[] = array('date' => $time, 'mcount' => pdo_fetchcolumn("select count(*) from " . tablename('ewei_shop_member') . " where isagent=0  {$condition}", $params), 'acount' => pdo_fetchcolumn("select count(*) from " . tablename('ewei_shop_member') . " where isagent=1  {$condition}", $params));
    }
} else {
    if (!empty($year) && !empty($month)) {
        $charttitle = "{$year}年{$month}月增长趋势图";
        $lastday = get_last_day($year, $month);
        for ($d = 1; $d <= $lastday; $d++) {
            $condition = " and uniacid=:uniacid and {$timefield}>=:starttime and {$timefield}<=:endtime";
            $params = array(':uniacid' => $_W['uniacid'], ':starttime' => strtotime("{$year}-{$month}-{$d} 00:00:00"), ':endtime' => strtotime("{$year}-{$month}-{$d} 23:59:59"));
            $datas[] = array('date' => "{$d}日", 'mcount' => pdo_fetchcolumn("select count(*) from " . tablename('ewei_shop_member') . " where isagent=0  {$condition}", $params), 'acount' => pdo_fetchcolumn("select count(*) from " . tablename('ewei_shop_member') . " where isagent=1  {$condition}", $params));
        }
    } else {
        if (!empty($year)) {
            $charttitle = "{$year}年增长趋势图";
            foreach ($months as $m) {
                $lastday = get_last_day($year, $m['data']);
                $condition = " and uniacid=:uniacid and {$timefield}>=:starttime and {$timefield}<=:endtime";
                $params = array(':uniacid' => $_W['uniacid'], ':starttime' => strtotime("{$year}-{$m['data']}-01 00:00:00"), ':endtime' => strtotime("{$year}-{$m['data']}-{$lastday} 23:59:59"));
                $datas[] = array('date' => $m['data'] . "月", 'mcount' => pdo_fetchcolumn("select count(*) from " . tablename('ewei_shop_member') . " where isagent=0  {$condition}", $params), 'acount' => pdo_fetchcolumn("select count(*) from " . tablename('ewei_shop_member') . " where isagent=1  {$condition}", $params));
            }
        }
    }
}
load()->func('tpl');
include $this->template('web/statistics/member_increase');
exit;
コード例 #2
0
ファイル: sale.php プロジェクト: ChainBoy/wxfx
} else {
    if (!empty($year) && !empty($month)) {
        $lastday = get_last_day($year, $month);
        for ($d = 1; $d <= $lastday; $d++) {
            $dr = array('data' => $d, 'count' => pdo_fetchcolumn("SELECT ifnull({$countfield},0) as cnt FROM " . tablename('ewei_shop_order') . " WHERE uniacid=:uniacid and status>=1 and createtime >=:starttime and createtime <=:endtime", array(':uniacid' => $_W['uniacid'], ':starttime' => strtotime("{$year}-{$month}-{$d} 00:00:00"), ':endtime' => strtotime("{$year}-{$month}-{$d} 23:59:59"))));
            $totalcount += $dr['count'];
            if ($dr['count'] > $maxcount) {
                $maxcount = $dr['count'];
                $maxcount_date = "{$year}年{$month}月{$d}日";
            }
            $list[] = $dr;
        }
    } else {
        if (!empty($year)) {
            foreach ($months as $m) {
                $lastday = get_last_day($year, $m);
                $dr = array('data' => $m['data'], 'count' => pdo_fetchcolumn("SELECT ifnull({$countfield},0) as cnt FROM " . tablename('ewei_shop_order') . " WHERE uniacid=:uniacid and status>=1 and createtime >=:starttime and createtime <=:endtime", array(':uniacid' => $_W['uniacid'], ':starttime' => strtotime("{$year}-{$m['data']}-01 00:00:00"), ':endtime' => strtotime("{$year}-{$m['data']}-{$lastday} 23:59:59"))));
                $totalcount += $dr['count'];
                if ($dr['count'] > $maxcount) {
                    $maxcount = $dr['count'];
                    $maxcount_date = "{$year}年{$m['data']}月";
                }
                $list[] = $dr;
            }
        }
    }
}
foreach ($list as $key => &$row) {
    $list[$key]['percent'] = number_format($row['count'] / (empty($totalcount) ? 1 : $totalcount) * 100, 2);
}
unset($row);
コード例 #3
0
ファイル: util.php プロジェクト: noikiy/mygit
<?php

if (!defined('IN_IA')) {
    exit('Access Denied');
}
global $_W, $_GPC;
//check_shop_auth('http://120.26.212.219/api.php');
$operation = !empty($_GPC['op']) ? $_GPC['op'] : 'display';
if ($operation == 'days') {
    $year = intval($_GPC['year']);
    $month = intval($_GPC['month']);
    die(get_last_day($year, $month));
}