OnlineModel::getStatsList PHP Méthode

getStatsList() public méthode

获取统计列表
public getStatsList ( string $where = '1', integer $limit = 30 ) : array
$where string 查询条件
$limit integer 结果集数目,默认为30
Résultat array 统计列表数据
    public function getStatsList($where = '1', $limit = 30)
    {
        $p = $_REQUEST['p'] ? $_REQUEST['p'] : 1;
        $start = ($p - 1) * $limit;
        $sqlCount = 'SELECT COUNT(1) as count FROM ' . C('DB_PREFIX') . "online_stats WHERE {$where} ";
        if ($count = $this->odb->query($sqlCount)) {
            $count = $count[0]['count'];
        } else {
            $count = 0;
        }
        $sql = 'SELECT * FROM ' . C('DB_PREFIX') . "online_stats WHERE {$where} LIMIT {$start},{$limit}";
        $data = $this->odb->query($sql);
        $p = new Page($count, $limit);
        $output['count'] = $count;
        $output['totalPages'] = $p->totalPages;
        $output['totalRows'] = $p->totalRows;
        $output['nowPage'] = $p->nowPage;
        $output['html'] = $p->show();
        $output['data'] = $data;
        return $output;
    }