mirror of
https://github.com/tursom/typecho-plugin-Access.git
synced 2024-12-25 20:30:32 +08:00
简化一些代码
This commit is contained in:
parent
7adc9de42c
commit
dd3ee029c7
@ -231,11 +231,9 @@ class Access_Core
|
||||
->from('table.access_log'))[0]['count'];
|
||||
|
||||
# 分类型绘制24小时访问图
|
||||
$this->overview['chart']['xAxis']['categories'] = json_encode(array(
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
|
||||
));
|
||||
$this->overview['chart']['xAxis']['categories'] = Json::encode(range(0, 23));
|
||||
foreach (array('ip', 'uv', 'pv') as $type) {
|
||||
$this->overview['chart']['series'][$type] = json_encode($this->overview[$type]['today']['hours']);
|
||||
$this->overview['chart']['series'][$type] = Json::encode($this->overview[$type]['today']['hours']);
|
||||
}
|
||||
$this->overview['chart']['title']['text'] = _t('%s 统计', date("Y-m-d"));
|
||||
}
|
||||
|
14
Action.php
14
Action.php
@ -1,17 +1,14 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/Access_Bootstrap.php';
|
||||
|
||||
class Access_Action implements Widget_Interface_Do
|
||||
class Access_Action extends Typecho_Widget implements Widget_Interface_Do
|
||||
{
|
||||
|
||||
private $response;
|
||||
private $request;
|
||||
private $access;
|
||||
|
||||
public function __construct()
|
||||
public function __construct($request, $response, $params = null)
|
||||
{
|
||||
$this->response = Typecho_Response::getInstance();
|
||||
$this->request = Typecho_Request::getInstance();
|
||||
parent::__construct($request, $response, $params);
|
||||
|
||||
$this->access = new Access_Core();
|
||||
}
|
||||
|
||||
@ -33,7 +30,6 @@ class Access_Action implements Widget_Interface_Do
|
||||
|
||||
public function ip()
|
||||
{
|
||||
$this->response->setContentType('application/json');
|
||||
$ip = $this->request->get('ip');
|
||||
try {
|
||||
$this->checkAuth();
|
||||
@ -64,7 +60,7 @@ class Access_Action implements Widget_Interface_Do
|
||||
);
|
||||
}
|
||||
}
|
||||
exit(Json::encode($response));
|
||||
$this->response->throwJson($response);
|
||||
}
|
||||
|
||||
public function deleteLogs()
|
||||
|
Loading…
Reference in New Issue
Block a user