diff --git a/Access_Core.php b/Access_Core.php index 544d7cc..e66f39a 100644 --- a/Access_Core.php +++ b/Access_Core.php @@ -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")); } diff --git a/Action.php b/Action.php index 56c84ea..9195151 100644 --- a/Action.php +++ b/Action.php @@ -1,17 +1,14 @@ 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()