国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

275 lignes
9.8KB

  1. function AddNew() {
  2. $DE('addTab').style.display = 'block';
  3. }
  4. function CloseTab(tb) {
  5. $DE(tb).style.display = 'none';
  6. }
  7. function ListAll() {
  8. $DE('editTab').style.display = 'block';
  9. fetch('index_body.php?dopost=editshow').then(resp => resp.text()).then((d) => {
  10. $DE('editTabBody').innerHTML = d;
  11. });
  12. }
  13. function ShowWaitDiv() {
  14. $DE('loaddiv').style.display = 'block';
  15. return true;
  16. }
  17. function DedeCopyToClipboard(text) {
  18. if (navigator.clipboard) {
  19. navigator.clipboard.writeText(text);
  20. } else {
  21. var textarea = document.createElement('textarea');
  22. document.body.appendChild(textarea);
  23. //隐藏此输入框
  24. textarea.style.position = 'fixed';
  25. textarea.style.clip = 'rect(0 0 0 0)';
  26. textarea.style.top = '10px';
  27. textarea.style.display = 'none';
  28. textarea.value = text;
  29. textarea.select();
  30. document.execCommand('copy', true);
  31. document.body.removeChild(textarea);
  32. }
  33. }
  34. $(function () {
  35. $.get("index_testenv.php", function (data) {
  36. if (data !== '') {
  37. $("#body-tips").html(data);
  38. }
  39. });
  40. $.get("index_body.php?dopost=get_articles", function (data) {
  41. if (data !== '') {
  42. $("#system-word").html(data);
  43. }
  44. });
  45. });
  46. function copyFn(){
  47. var val = document.getElementById('text');
  48. window.getSelection().selectAllChildren(val);
  49. document.execCommand ("Copy");
  50. alert("环境配置信息已复制");
  51. }
  52. //Dedebiz info
  53. var dedebizInfo;
  54. function ViewDedeBIZ() {
  55. console.log(dedebizInfo);
  56. ShowMsg(`
  57. <table class="table table-borderless w-100">
  58. <tr>
  59. <td width="90">版本号:</td>
  60. <td>V${dedebizInfo.result.server_version}</td>
  61. <td width="90">服务器系统:</td>
  62. <td>${dedebizInfo.result.server_goos}(${dedebizInfo.result.server_goarch})</td>
  63. </tr>
  64. <tr>
  65. <td>运行时间:</td>
  66. <td>${dedebizInfo.result.server_run_time}</td>
  67. <td>内存占用:</td>
  68. <td>${dedebizInfo.result.server_memory_usage}%</td>
  69. </tr>
  70. </table>
  71. `);
  72. }
  73. function LoadServer() {
  74. $.get("index_body.php?dopost=system_info", function (data) {
  75. let rsp = JSON.parse(data);
  76. if (rsp.code === 200) {
  77. let infoStr = `<table class="table table-borderless w-100">`;
  78. if (typeof rsp.result.domain !== "undefined") {
  79. infoStr += `
  80. <tr>
  81. <td width="90">授权域名:</td>
  82. <td>${rsp.result.domain}</td>
  83. <td width="90">授权版本:</td>
  84. <td>${rsp.result.auth_version}.x.x(时间:${rsp.result.auth_at})</td>
  85. </tr>
  86. <tr>
  87. <td>站点名称:</td>
  88. <td>${rsp.result.title}(${rsp.result.stype})</td>
  89. <td>证书组件:</td>
  90. <td>
  91. <a href="${cfg_biz_dedebizUrl}/auth/?domain=${rsp.result.domain}" target="_blank" class="btn btn-success btn-sm">授权证书</a>
  92. <a href="javascript:ViewDedeBIZ()" class="btn btn-primary btn-sm">组件信息</a>
  93. </td>
  94. </tr>
  95. `;
  96. }
  97. infoStr += "</table>";
  98. $("#system-info").html(infoStr);
  99. } else {
  100. $("#system-info").html(`
  101. <table class="table table-borderless w-100">
  102. <tr>
  103. <td>${rsp.msg}</td>
  104. </tr>
  105. <tr>
  106. <td>如果您已购买商业版授权,可以在我们的授权中心查询到相信关授权信息,如果查询结果与实际授权不符,则说明您可能购买了非法商业授权,请及时与我们取得联系。</td>
  107. </tr>
  108. </table>
  109. <table class="table table-borderless w-100">
  110. <tr>
  111. <td>您的后台已是最新软件版本</td>
  112. </tr>
  113. </table>
  114. <table class="table table-borderless w-100">
  115. <tr>
  116. <td colspan="2">本更新提供了重要的安全性更新,建议所有用户升级,软件更新将覆盖以下文件,请做好备份。<a href="" class="btn btn-success btn-sm">下一步</a></td>
  117. </tr>
  118. <tr>
  119. <td width="90">文件1:</td>
  120. <td>/system/database/dedesqlite.class.php</td>
  121. </tr>
  122. <tr>
  123. <td>文件2:</td>
  124. <td>/system/database/dedesqlite.class.php</td>
  125. </tr>
  126. <tr>
  127. <td>文件3:</td>
  128. <td>/system/database/dedesqlite.class.php</td>
  129. </tr>
  130. </table>
  131. <table class="table table-borderless w-100">
  132. <tr>
  133. <td>更新诊断出数据结构有问题,可能无法正常使用后台,是否尝试修复数据?</td>
  134. </tr>
  135. <tr>
  136. <td>
  137. <a href="" class="btn btn-success btn-sm">修复</a>
  138. <a href="" class="btn btn-secondary btn-sm">取消</a>
  139. </td>
  140. </tr>
  141. </table>
  142. `);
  143. }
  144. });
  145. }
  146. Date.prototype.Format = function (fmt) { //author: meizz
  147. var o = {
  148. "M+": this.getMonth() + 1, //月份
  149. "d+": this.getDate(), //日
  150. "h+": this.getHours(), //小时
  151. "m+": this.getMinutes(), //分
  152. "s+": this.getSeconds(), //秒
  153. "q+": Math.floor((this.getMonth() + 3) / 3), //季度
  154. "S": this.getMilliseconds() //毫秒
  155. };
  156. if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
  157. for (var k in o)
  158. if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
  159. return fmt;
  160. }
  161. function LoadStat() {
  162. $.get("index_body.php?dopost=get_statistics", function (data) {
  163. let rsp = JSON.parse(data);
  164. if (rsp.code == 200) {
  165. var tpv = parseInt(rsp.result.pv);
  166. var tuv = parseInt(rsp.result.uv);
  167. var tip = parseInt(rsp.result.ip);
  168. var tvv = parseInt(rsp.result.vv);
  169. $("#today_pv").html(tpv);
  170. $("#today_uv").html(tuv);
  171. $("#today_ip").html(tip);
  172. $("#today_vv").html(tvv);
  173. $.get("index_body.php?dopost=get_statistics&sdate=-1", function (data) {
  174. let rsp = JSON.parse(data);
  175. if (rsp.code == 200) {
  176. $("#total_pv").html(parseInt(rsp.result.pv) + tpv);
  177. $("#total_uv").html(parseInt(rsp.result.uv) + tuv);
  178. $("#total_ip").html(parseInt(rsp.result.ip) + tip);
  179. $("#total_vv").html(parseInt(rsp.result.vv) + tvv);
  180. }
  181. });
  182. }
  183. });
  184. var d = new Date();
  185. d.setDate(d.getDate() - 1);
  186. var s = d.Format("yyyy-MM-dd");
  187. s = s.replaceAll("-", "");
  188. $.get("index_body.php?dopost=get_statistics&sdate=" + s, function (data) {
  189. let rsp = JSON.parse(data);
  190. if (rsp.code == 200) {
  191. $("#yestoday_pv").html(rsp.result.pv);
  192. $("#yestoday_uv").html(rsp.result.uv);
  193. $("#yestoday_ip").html(rsp.result.ip);
  194. $("#yestoday_vv").html(rsp.result.vv);
  195. }
  196. });
  197. }
  198. async function LoadStatChart() {
  199. const ctx = document.getElementById('statChart').getContext('2d');
  200. let labels = [];
  201. let dates = [];
  202. let pvs = [];
  203. let ips = [];
  204. let uvs = [];
  205. let vvs = [];
  206. for (let i = 15; i > 0; i--) {
  207. var d = new Date();
  208. d.setDate(d.getDate() - i);
  209. var s = d.Format("yyyy-MM-dd");
  210. labels.push(d.Format("MM-dd"));
  211. s = s.replaceAll("-", "");
  212. dates.push(s);
  213. }
  214. let resp = await fetch("index_body.php?dopost=get_statistics_multi&sdates=" + dates.join(","));
  215. let data = await resp.json();
  216. if (data.code == 200) {
  217. data.result.forEach(e => {
  218. pvs.push(typeof e.pv == "undefined" ? 0 : e.pv);
  219. ips.push(typeof e.ip == "undefined" ? 0 : e.ip);
  220. uvs.push(typeof e.uv == "undefined" ? 0 : e.uv);
  221. vvs.push(typeof e.vv == "undefined" ? 0 : e.vv);
  222. });
  223. }
  224. const myChart = new Chart(ctx, {
  225. type: 'line',
  226. options: {
  227. responsive: true,
  228. plugins: {
  229. legend: {
  230. position: 'right',
  231. }
  232. }
  233. },
  234. data: {
  235. labels: labels,
  236. datasets: [
  237. {
  238. label: 'PV',
  239. data: pvs,
  240. borderColor: 'rgba(54, 162, 235, 1)',
  241. backgroundColor: 'rgba(54, 162, 235, 0.2)',
  242. borderWidth: 1
  243. }, {
  244. label: 'UV',
  245. data: uvs,
  246. borderColor: 'rgba(255, 206, 86, 1)',
  247. backgroundColor: 'rgba(255, 206, 86, 0.2)',
  248. borderWidth: 1
  249. }, {
  250. label: 'IP',
  251. data: ips,
  252. borderColor: 'rgba(255, 99, 132, 1)',
  253. backgroundColor: 'rgba(255, 99, 132, 0.2)',
  254. borderWidth: 1
  255. }
  256. , {
  257. label: 'VV',
  258. data: vvs,
  259. borderColor: 'rgba(75, 192, 192, 1)',
  260. backgroundColor: 'rgba(75, 192, 192, 0.2)',
  261. borderWidth: 1
  262. }
  263. ]
  264. },
  265. });
  266. }
  267. $(document).ready(function () {
  268. LoadServer();
  269. LoadStat();
  270. LoadStatChart();
  271. setInterval(function () {
  272. LoadServer();
  273. }, 60000)
  274. });