mirror of
https://github.com/tursom/typecho-plugin-Access.git
synced 2024-12-28 05:40:40 +08:00
improve: #14
This commit is contained in:
parent
9b62c860a4
commit
a29d3b60dc
@ -178,14 +178,17 @@ class Access_Core
|
||||
$start = strtotime(date("{$time} {$i}:00:00"));
|
||||
$end = strtotime(date("{$time} {$i}:59:59"));
|
||||
// "SELECT DISTINCT ip FROM {$this->table} {$where} AND `time` BETWEEN {$start} AND {$end}"));
|
||||
$subQuery = $this->db->select('DISTINCT ip')->from('table.access_log')
|
||||
->where("time >= ? AND time <= ?", $start, $end);
|
||||
if (method_exists($subQuery, 'prepare')) {
|
||||
$subQuery = $subQuery->prepare($subQuery);
|
||||
}
|
||||
$this->overview['ip'][$day]['hours'][$i] = intval($this->db->fetchAll($this->db->select('COUNT(1) AS count')
|
||||
->from('(' . $this->db->select('DISTINCT ip')->from('table.access_log')
|
||||
->where("time >= {$start} AND time <= {$end}") . ') AS tmp'))[0]['count']);
|
||||
->from('(' . $subQuery . ') AS tmp'))[0]['count']);
|
||||
$this->overview['ip'][$day]['total'] += $this->overview['ip'][$day]['hours'][$i];
|
||||
// "SELECT DISTINCT ip,ua FROM {$this->table} {$where} AND `time` BETWEEN {$start} AND {$end}"));
|
||||
$this->overview['uv'][$day]['hours'][$i] = intval($this->db->fetchAll($this->db->select('COUNT(1) AS count')
|
||||
->from('(' . $this->db->select('DISTINCT ip,ua')->from('table.access_log')
|
||||
->where("time >= {$start} AND time <= {$end}") . ') AS tmp'))[0]['count']);
|
||||
->from('(' . $subQuery . ') AS tmp'))[0]['count']);
|
||||
$this->overview['uv'][$day]['total'] += $this->overview['uv'][$day]['hours'][$i];
|
||||
// "SELECT ip FROM {$this->table} {$where} AND `time` BETWEEN {$start} AND {$end}"));
|
||||
$this->overview['pv'][$day]['hours'][$i] = intval($this->db->fetchAll($this->db->select('COUNT(1) AS count')
|
||||
|
Loading…
Reference in New Issue
Block a user