-
= $access->title;?>
+= $access->title;?>
-
+
-
- action == 'logs'):?>
-
-
-
-
-
- action == 'overview'):?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ action}/index.php") ?>
访问数表格
- -
-
-
-
-
- | - | - | - | - |
|---|---|---|---|
| 今日 | -loading... | -- | - |
| 昨日 | -loading... | -- | - |
| 总计 | -loading... | -- | - |
-
-
- 来源域名
- -
-
-
-
- | 排名 | -次数 | -来源域名 | -
|---|---|---|
| loading... | -- | - |
-
-
- 来源页
- -
-
-
-
- | 排名 | -次数 | -来源URL | -
|---|---|---|
| loading... | -- | - |
-
-
- 文章浏览分析
-loading...
-
-
-
- 访客地域分析
-
-
- -
-
-
- -
loading...
-
-
-
- 今日图表
- -
-
-
- 昨日图表
- -
-
- 当月图表
- -
+
+
+
+
diff --git a/page/routes/overview/index.js b/page/routes/overview/index.js
new file mode 100644
index 0000000..27c5230
--- /dev/null
+++ b/page/routes/overview/index.js
@@ -0,0 +1,295 @@
+// html转义
+htmlEncode = function (target) {
+ return target.replace(/[<>&"]/g, function (c) {
+ return { "<": "<", ">": ">", "&": "&", '"': """ }[c];
+ });
+};
+// 输出图表
+printChart = function (target, title, data, avg = null) {
+ let pv = [],
+ uv = [],
+ ip = [],
+ time = [];
+ for (let i = 0; i < data.length; i++)
+ pv.push(data[i].pv),
+ uv.push(data[i].uv),
+ ip.push(data[i].ip),
+ time.push(data[i].time);
+ const chart = Highcharts.chart(target, {
+ title: { text: title, x: -20 },
+ subtitle: { text: "Generate By AccessPlugin", x: -20 },
+ xAxis: { categories: time, title: { text: "时间", align: "high" } },
+ yAxis: {
+ title: { text: "数量" },
+ plotLines:
+ avg !== null
+ ? [
+ // 平均值
+ {
+ value: avg.pv,
+ width: 1,
+ color: "#F7A35C",
+ },
+ {
+ value: avg.uv,
+ width: 1,
+ color: "#90ED7D",
+ },
+ {
+ value: avg.ip,
+ width: 1,
+ color: "#7CB5ED",
+ },
+ ]
+ : null,
+ },
+ tooltip: { valueSuffix: "" },
+ plotOptions: { line: { dataLabels: { enabled: true } } },
+ series: [
+ {
+ name: "PV(浏览)",
+ data: pv,
+ color: "#F7A35C",
+ },
+ {
+ name: "UV(访客)",
+ data: uv,
+ color: "#90ED7D",
+ },
+ {
+ name: "IP(地址)",
+ data: ip,
+ color: "#7CB5ED",
+ },
+ ],
+ });
+};
+// 输出饼图
+printPie = function (target, title, data) {
+ let value = [];
+ // 生成统计row
+ for (let i = 0; i < data.length; i++)
+ value.push({ name: data[i].title, y: data[i].count, cid: data[i].cid });
+ // 计算最大比例并选中
+ let maxKey = 0;
+ for (let i = 0; i < value.length; i++) {
+ if (value[i].y >= value[maxKey].y) maxKey = i;
+ }
+ if (value.length) value[maxKey].sliced = true;
+ const chart = Highcharts.chart(target, {
+ chart: { type: "pie" },
+ title: { text: title },
+ subtitle: { text: "Generate By AccessPlugin" },
+ tooltip: {
+ pointFormat:
+ "阅读数: {point.y}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+占比: {point.percentage:.1f}%
cid={point.cid}", + }, + accessibility: { point: { valueSuffix: "%" } }, + plotOptions: { + pie: { + allowPointSelect: true, + cursor: "pointer", + dataLabels: { enabled: true, format: "{point.name}: {point.y}" }, + }, + }, + series: [{ colorByPoint: true, data: value }], + }); +}; +// 输出条形统计图 +printBar = function (target, title, data) { + let values = [], + areas = []; + for (let i = 0; i < data.length; i++) + areas.push(data[i].area), values.push(data[i].count); + return Highcharts.chart(target, { + chart: { type: "bar" }, + title: { text: title, x: -20 }, + subtitle: { text: "Generate By AccessPlugin", x: -20 }, + xAxis: { categories: areas, title: { text: "地域" } }, + yAxis: { title: { text: "访问次数", align: "high" } }, + plotOptions: { bar: { dataLabels: { enabled: true }, colorByPoint: true } }, + legend: { enabled: false }, + series: [{ name: "访问量", data: values }], + }); +}; + +updateBar = function (target, title, data) { + let values = [], + areas = []; + for (let i = 0; i < data.length; i++) + areas.push(data[i].area), values.push(data[i].count); + target.update( + { + title: { text: title }, + xAxis: { categories: areas, title: { text: "地域" } }, + series: [{ name: "访问量", data: values }], + }, + true, + false, + { duration: 800 } + ); +}; + +// 显示来源统计表 +printRefererTable = function (target, data) { + let tbl = $("#" + target + " tbody"); + tbl.children().remove(); // 清空表格 + for (let i = 0; i < data.length; i++) { + tbl.append( + "
+
+
+
+
+
+
访问数表格
+
+
+
+
+
+ | + | + | + | + |
|---|---|---|---|
| 今日 | +loading... | ++ | + |
| 昨日 | +loading... | ++ | + |
| 总计 | +loading... | ++ | + |
+
+
+ 来源域名
+ +
+
+
+
+ | 排名 | +次数 | +来源域名 | +
|---|---|---|
| loading... | ++ | + |
+
+
+ 来源页
+ +
+
+
+
+ | 排名 | +次数 | +来源URL | +
|---|---|---|
| loading... | ++ | + |
+
+
+ 文章浏览分析
+loading...
+
+
+
+ 访客地域分析
+
+
+ -
+
+
- +
loading...
+
+
+
+ 今日图表
+ +
+
+
+ 昨日图表
+ +
+
+