国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

444 lines
20KB

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="<?php echo $cfg_soft_lang; ?>">
  5. <title>系统概况</title>
  6. <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
  7. <base target="_self">
  8. <link rel="stylesheet" href="../static/css/bootstrap.min.css">
  9. <link rel="stylesheet" href="../static/font-awesome/css/font-awesome.min.css">
  10. <link rel="stylesheet" href="css/base.css">
  11. <link rel="stylesheet" href="css/indexbody.css">
  12. <script src="../static/js/jquery.js"></script>
  13. <script src="../static/js/bootstrap.bundle.js"></script>
  14. <script src="../static/js/webajax.js"></script>
  15. <script src="../static/js/chart.min.js"></script>
  16. <script src="js/indexbody.js"></script>
  17. <script src="js/main.js"></script>
  18. <style>
  19. table.stattable td{padding:.6rem;font-size:12px;border-bottom:1px solid #f0f0f0;text-align:right;vertical-align:middle}
  20. table.stattable td.today{font-size:12px;color:#000}
  21. .row{display:flex;flex-wrap:wrap}
  22. .row>[class*='col-']{display:flex;flex-direction:column}
  23. .table{margin-bottom:0}
  24. .stattable{width:100%}
  25. .col-md-6:nth-child(2n){margin-left:-15px}
  26. .web-info{padding:10px;background:#f6f6f6;border-radius:.2rem;text-align:center}
  27. .web-info p{margin-bottom:10px}
  28. </style>
  29. </head>
  30. <body>
  31. <div class="container-fluid">
  32. <div class="row">
  33. <div id="__testEvn" class="col-md-12"></div>
  34. <div class="col-md-12 mt-3">
  35. <div class="card">
  36. <div class="card-header"><a title="点击查看流量统计图" href="#statChart"><i class="fa fa-line-chart"></i></a>&nbsp;流量统计表</div>
  37. <div class="card-body">
  38. <table class="stattable">
  39. <tbody>
  40. <tr class="title">
  41. <td width="10%"></td>
  42. <td width="20%">浏览次数(PV)</td>
  43. <td width="20%">独立访客(UV)</td>
  44. <td width="20%">IP</td>
  45. <td width="18%" >访问次数</td>
  46. </tr>
  47. <tr class="bg-white">
  48. <td class="today">今日</td>
  49. <td class="today" id="today_pv"></td>
  50. <td class="today" id="today_uv"></td>
  51. <td class="today" id="today_ip"></td>
  52. <td class="today" id="today_vv"></td>
  53. </tr>
  54. <tr class="bg-white">
  55. <td>昨日</td>
  56. <td id="yestoday_pv"></td>
  57. <td id="yestoday_uv"></td>
  58. <td id="yestoday_ip"></td>
  59. <td id="yestoday_vv"></td>
  60. </tr>
  61. <tr class="bg-white grey9 hide" style="display:table-row">
  62. <td>历史累计</td>
  63. <td id="total_pv"></td>
  64. <td id="total_uv"></td>
  65. <td id="total_ip"></td>
  66. <td id="total_vv"></td>
  67. </tr>
  68. </tbody>
  69. </table>
  70. </div>
  71. </div>
  72. </div>
  73. <div class="col-md-6 mt-3 updatenews">
  74. <div class="card">
  75. <div class="card-header"><i class="fa fa-gear"></i>&nbsp;系统信息</div>
  76. <div class="card-body">
  77. <div id="updateinfos">
  78. <?php echo "<iframe name='stafrm' src='{$offUrl}&uptime={$oktime}' frameborder='0' id='stafrm' style='width:98%;height:60px;padding:.6rem'></iframe>"; ?>
  79. </div>
  80. <table width="98%" class="table table-borderless">
  81. <tr>
  82. <td>
  83. <div class="web-info">
  84. <p>操作系统</p>
  85. <span><?php echo PHP_OS; ?></span>
  86. </div>
  87. </td>
  88. <td>
  89. <div class="web-info">
  90. <p>Web服务器</p>
  91. <span><?php echo $_SERVER['SERVER_SOFTWARE']; ?></span>
  92. </div>
  93. </td>
  94. <td>
  95. <div class="web-info">
  96. <p>服务器IP</p>
  97. <span><?php echo gethostbyname($_SERVER['SERVER_NAME']); ?></span>
  98. </div>
  99. </td>
  100. <td>
  101. <div class="web-info">
  102. <p>PHP版本</p>
  103. <span><?php echo @phpversion(); ?></span>
  104. </div>
  105. </td>
  106. </tr>
  107. </table>
  108. </div>
  109. </div>
  110. </div>
  111. <div class="col-md-6 mt-3">
  112. <div class="card">
  113. <div class="card-header"><i class="fa fa-database"></i>&nbsp;版本授权</div>
  114. <div class="card-body" id="_systeminfo">正在载入</div>
  115. </div>
  116. </div>
  117. <div class="col-md-6 mt-3">
  118. <div class="card">
  119. <div class="card-header"><a name="statChart"><i class="fa fa-bar-chart"></i>&nbsp;流量统计图</a></div>
  120. <div class="card-body">
  121. <canvas id="statChart"></canvas>
  122. </div>
  123. </div>
  124. </div>
  125. <div class="col-md-6 mt-3">
  126. <div class="card">
  127. <div class="card-header"><i class="fa fa-file-word-o"></i>&nbsp;最新文档</div>
  128. <div class="card-body">
  129. <table width="100%" class="table table-borderless">
  130. <?php
  131. $query = "SELECT arc.id, arc.arcrank, arc.title, arc.typeid, arc.pubdate, arc.channel, ch.editcon, tp.typename FROM `#@__archives` arc LEFT JOIN `#@__channeltype` ch ON ch.id = arc.channel LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id WHERE arc.arcrank<>-2 ORDER BY arc.id DESC LIMIT 0,12";
  132. $arcArr = array();
  133. $dsql->Execute('m', $query);
  134. while($row = $dsql->GetArray('m'))
  135. {
  136. $arcArr[] = $row;
  137. }
  138. ?>
  139. <?php
  140. if(count($arcArr) > 1)
  141. {
  142. foreach($arcArr as $row)
  143. {
  144. if(trim($row['editcon'])==''){
  145. $row['editcon'] = 'archives_edit.php';
  146. }
  147. $rowarcrank = $row['arcrank']==-1? "&nbsp;<span class='btn btn-danger btn-sm'>未审核</span>":"";
  148. $pubdate = GetDateMk($row['pubdate']);
  149. echo "<tr><td><a href='{$row['editcon']}?aid={$row['id']}&channelid={$row['channel']}'>{$row['title']}</a>{$rowarcrank}</td><td width='90'>{$pubdate}</td></tr>";
  150. }
  151. } else {
  152. ?>
  153. <tr><td colspan="2">暂无文档</td></tr>
  154. <?php
  155. }
  156. ?>
  157. </table>
  158. </div>
  159. </div>
  160. </div>
  161. </div>
  162. </div>
  163. <div class="footer mt-2">
  164. <div id="loaddiv" style="display:none">
  165. <p align="center"><img src="images/loadinglit.gif">请稍后,正在下载更新文件列表</p>
  166. </div>
  167. <div id="editTab">
  168. <span id="editTabBody">请稍候,正在载入</span>
  169. </div>
  170. <div id="addTab">
  171. <form name="addform" action="index_body.php">
  172. <input type="hidden" name="dopost" value="addnew">
  173. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  174. <tr>
  175. <td height="30" colspan="3" background="images/tbg.gif">
  176. <div style="float:left;margin-left:10px">增加快捷操作项</div>
  177. <div style="float:right;padding:2px 10px 0 0">
  178. <a href="javascript:CloseTab('addTab')"><img src="images/close.gif"></a>
  179. </div>
  180. </td>
  181. </tr>
  182. <tr>
  183. <td colspan="2" style="height:10px;border-top:1px solid #8DA659"></td>
  184. </tr>
  185. <tr>
  186. <td width="22%" height="26" align="right">链接标题:</td>
  187. <td width="78%"><input name="title" type="text" class="pubinputs" style="margin-bottom:10px;width:260px"></td>
  188. </tr>
  189. <tr>
  190. <td width="22%" height="26" align="right">链接网址:</td>
  191. <td width="78%"><input name="link" type="text" class="pubinputs" style="width:260px"></td>
  192. </tr>
  193. <tr>
  194. <td height="36"></td>
  195. <td><input type="submit" name="Submit" value="保存项目" class="np coolbg"></td>
  196. </tr>
  197. </table>
  198. </form>
  199. </div>
  200. </div>
  201. <script>
  202. $(function(){
  203. $.get("index_testenv.php", function (data){
  204. if (data !== ''){
  205. $("#__testEvn").html(data);
  206. }
  207. });
  208. });
  209. </script>
  210. <script>
  211. var dedebizInfo;
  212. function ViewDedeBIZ(){
  213. console.log(dedebizInfo);
  214. ShowMsg(`
  215. <table width="100%" class="table table-borderless">
  216. <tbody>
  217. <tr>
  218. <td style="width:50%">版本号:</td>
  219. <td>V${dedebizInfo.result.server_version}</td>
  220. </tr>
  221. <tr>
  222. <td style="width:50%">运行时间:</td>
  223. <td>${dedebizInfo.result.server_run_time}</td>
  224. </tr>
  225. <tr>
  226. <td style="width:50%">服务器系统:</td>
  227. <td>${dedebizInfo.result.server_goos}(${dedebizInfo.result.server_goarch})</td>
  228. </tr>
  229. <tr>
  230. <td style="width:50%">内存占用:</td>
  231. <td>${dedebizInfo.result.server_memory_usage}%</td>
  232. </tr>
  233. </tbody>
  234. </table>
  235. `);
  236. }
  237. function LoadServer(){
  238. $.get("index_body.php?dopost=system_info", function(data){
  239. let rsp = JSON.parse(data);
  240. if (rsp.code === 200){
  241. let infoStr = `<table width="100%" class="table table-borderless"><tbody>`;
  242. if (typeof rsp.result.domain !== "undefined"){
  243. infoStr += `
  244. <tr>
  245. <td style="width:50%">授权域名:</td>
  246. <td>${rsp.result.domain} <a href="<?php echo $cfg_biz_dedebizUrl;?>/auth/?domain=${rsp.result.domain}" class="btn btn-success btn-sm">查看</a></td>
  247. </tr>
  248. `;
  249. }
  250. if (typeof rsp.result.title !== "undefined"){
  251. infoStr += `
  252. <tr>
  253. <td style="width:50%">站点名称:</td>
  254. <td>${rsp.result.title}</td>
  255. </tr>
  256. `;
  257. }
  258. if (typeof rsp.result.stype !== "undefined"){
  259. infoStr += `
  260. <tr>
  261. <td style="width:50%">站点类型:</td>
  262. <td>${rsp.result.stype}</td>
  263. </tr>
  264. `;
  265. }
  266. if (typeof rsp.result.auth_version !== "undefined" && typeof rsp.result.auth_at !== "undefined"){
  267. infoStr += `
  268. <tr>
  269. <td style="width:50%">授权版本:</td>
  270. <td>V${rsp.result.auth_version}.x.x(时间:${rsp.result.auth_at})</td>
  271. </tr>
  272. `;
  273. }
  274. if (rsp.result.core === null || rsp.result.core.code != 200){
  275. //下面是DedeBIZ Core组件信息
  276. infoStr += `
  277. <tr>
  278. <td style="width:50%">版本组件:</td>
  279. <td><a href="<?php echo $cfg_biz_dedebizUrl;?>/start?code=-1008" target="_blank" class="btn btn-danger btn-sm">如何启动组件</a></td>
  280. </tr>
  281. `;
  282. } else {
  283. dedebizInfo = JSON.parse(rsp.result.core.data);
  284. infoStr += `
  285. <tr>
  286. <td style="width:50%">版本组件:</td>
  287. <td><a href="javascript:ViewDedeBIZ()" class="btn btn-success btn-sm">查看组件信息</a></td>
  288. </tr>
  289. `;
  290. }
  291. infoStr += "</tbody></table>";
  292. $("#_systeminfo").html(infoStr);
  293. } else {
  294. $("#_systeminfo").html(`
  295. <table width="100%" class="table table-borderless">
  296. <tbody>
  297. <tr>
  298. <td style="width:50%">尚未启动商业版服务,原因:${rsp.msg}</td>
  299. <td style="text-align:right">当前版本:社区版<a href="<?php echo $cfg_biz_dedebizUrl;?>/start?code=${rsp.code}" target="_blank" class="btn btn-success btn-sm" style="margin-left:10px">升级商业版</a></td>
  300. </tr>
  301. <tr>
  302. <td colspan="2">如果您已购买商业使用授权,您可以在我们的授权中心查询到相信关商业授权信息,如果授权类型同查询不符,则说明您可能购买了非法商业授权,请及时同我们取得联系</td>
  303. </tr>
  304. </tbody>
  305. </table>
  306. `);
  307. }
  308. });
  309. }
  310. Date.prototype.Format = function (fmt) { //author: meizz
  311. var o = {
  312. "M+": this.getMonth() + 1, //月份
  313. "d+": this.getDate(), //日
  314. "h+": this.getHours(), //小时
  315. "m+": this.getMinutes(), //分
  316. "s+": this.getSeconds(), //秒
  317. "q+": Math.floor((this.getMonth() + 3) / 3), //季度
  318. "S": this.getMilliseconds() //毫秒
  319. };
  320. if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
  321. for (var k in o)
  322. if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
  323. return fmt;
  324. }
  325. function LoadStat() {
  326. $.get("index_body.php?dopost=get_statistics", function(data){
  327. let rsp = JSON.parse(data);
  328. if (rsp.code == 200) {
  329. var tpv = parseInt(rsp.result.pv);
  330. var tuv = parseInt(rsp.result.uv);
  331. var tip = parseInt(rsp.result.ip);
  332. var tvv = parseInt(rsp.result.vv);
  333. $("#today_pv").html(tpv);
  334. $("#today_uv").html(tuv);
  335. $("#today_ip").html(tip);
  336. $("#today_vv").html(tvv);
  337. $.get("index_body.php?dopost=get_statistics&sdate=-1", function(data){
  338. let rsp = JSON.parse(data);
  339. if (rsp.code == 200) {
  340. $("#total_pv").html(parseInt(rsp.result.pv)+tpv);
  341. $("#total_uv").html(parseInt(rsp.result.uv)+tuv);
  342. $("#total_ip").html(parseInt(rsp.result.ip)+tip);
  343. $("#total_vv").html(parseInt(rsp.result.vv)+tvv);
  344. }
  345. });
  346. }
  347. });
  348. var d = new Date();
  349. d.setDate(d.getDate() - 1);
  350. var s = d.Format("yyyy-MM-dd");
  351. s = s.replaceAll("-","");
  352. $.get("index_body.php?dopost=get_statistics&sdate="+s, function(data){
  353. let rsp = JSON.parse(data);
  354. if (rsp.code == 200) {
  355. $("#yestoday_pv").html(rsp.result.pv);
  356. $("#yestoday_uv").html(rsp.result.uv);
  357. $("#yestoday_ip").html(rsp.result.ip);
  358. $("#yestoday_vv").html(rsp.result.vv);
  359. }
  360. });
  361. }
  362. async function LoadStatChart() {
  363. const ctx = document.getElementById('statChart').getContext('2d');
  364. let labels = [];
  365. let pvs = [];
  366. let ips = [];
  367. let uvs = [];
  368. let vvs = [];
  369. for (let i = 15; i > 0; i--) {
  370. var d = new Date();
  371. d.setDate(d.getDate() - i);
  372. var s = d.Format("yyyy-MM-dd");
  373. labels.push(d.Format("MM-dd"));
  374. s = s.replaceAll("-","");
  375. let resp = await fetch("index_body.php?dopost=get_statistics&sdate="+s);
  376. let data = await resp.json();
  377. if (data.code == 200) {
  378. pvs.push(typeof data.result.pv=="undefined"? 0 : data.result.pv);
  379. ips.push(typeof data.result.ip=="undefined"? 0 : data.result.ip);
  380. uvs.push(typeof data.result.uv=="undefined"? 0 : data.result.uv);
  381. vvs.push(typeof data.result.vv=="undefined"? 0 : data.result.vv);
  382. }
  383. }
  384. console.log(pvs);
  385. console.log(ips);
  386. console.log(uvs);
  387. console.log(vvs);
  388. const myChart = new Chart(ctx, {
  389. type: 'line',
  390. options: {
  391. responsive: true,
  392. plugins: {
  393. legend: {
  394. position: 'top',
  395. },
  396. title: {
  397. display: true,
  398. text: '<?php echo $cfg_webname; ?>流量统计图'
  399. }
  400. }
  401. },
  402. data: {
  403. labels: labels,
  404. datasets: [{
  405. label: 'IP',
  406. data: ips,
  407. borderColor: 'rgba(255, 99, 132, 1)',
  408. backgroundColor :'rgba(255, 99, 132, 0.2)',
  409. borderWidth: 1
  410. },
  411. {
  412. label: 'PV',
  413. data: pvs,
  414. borderColor: 'rgba(54, 162, 235, 1)',
  415. backgroundColor :'rgba(54, 162, 235, 0.2)',
  416. borderWidth: 1
  417. },{
  418. label: 'UV',
  419. data: uvs,
  420. borderColor: 'rgba(255, 206, 86, 1)',
  421. backgroundColor: 'rgba(255, 206, 86, 0.2)',
  422. borderWidth: 1
  423. },{
  424. label: '访问次数',
  425. data: vvs,
  426. borderColor: 'rgba(75, 192, 192, 1)',
  427. backgroundColor: 'rgba(75, 192, 192, 0.2)',
  428. borderWidth: 1
  429. }
  430. ]
  431. },
  432. });
  433. }
  434. $(document).ready(function(){
  435. LoadServer();
  436. LoadStat();
  437. LoadStatChart();
  438. setInterval(function(){
  439. LoadServer();
  440. }, 60000)
  441. });
  442. </script>
  443. </body>
  444. </html>