paynum.tpl 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8" />
  5. <title>欢迎页面-X-admin2.0</title>
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  7. <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
  8. <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
  9. <link rel="stylesheet" href="./static/css/font.css">
  10. <link rel="stylesheet" href="./static/css/xadmin.css">
  11. <script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
  12. <script src="http://code.highcharts.com/highcharts.js"></script>
  13. </head>
  14. <body onload="InitParams({{.Server_id}}, {{.Minutes}}, {{.Days}})">
  15. <div class="x-body layui-anim layui-anim-up">
  16. <blockquote class="layui-elem-quote">
  17. 指定服务器:<input id="server_id" type="text" name="服务器ID" />
  18. 时间颗粒度(分钟):<input id="minutes" type="text" name="时间颗粒度" />
  19. 过往天数:<input id="days" type="text" name="天数" />
  20. <br>
  21. <br>
  22. <input class="layui-btn" type="button" onclick="submitUpdate()" value=刷新>
  23. <input class="layui-btn" type="button" onclick="submitDownload()" value=下载>
  24. </blockquote>
  25. </div>
  26. <div id="container" style="width: 1600px; height: 800px; margin: 0 auto"></div>
  27. <script language="JavaScript">
  28. $(document).ready(function() {
  29. var chart = {
  30. type: 'spline'
  31. };
  32. var title = {
  33. text: '付费玩家人数分布'
  34. };
  35. var subtitle = {
  36. text: '来源:游戏服'
  37. };
  38. var xAxis = {
  39. title: {
  40. text: '时间'
  41. },
  42. tickPixelInterval: 1,
  43. categories: {{.Categories}}
  44. };
  45. var yAxis = {
  46. title: {
  47. text: '人数'
  48. },
  49. plotLines: [{
  50. value: 0,
  51. width: 1,
  52. color: '#808080'
  53. }]
  54. };
  55. var tooltip = {
  56. valueSuffix: '人'
  57. }
  58. var legend = {
  59. layout: 'vertical',
  60. align: 'right',
  61. verticalAlign: 'middle',
  62. borderWidth: 0
  63. };
  64. var series = [
  65. ];
  66. var list = {{.Series}}
  67. for ( var i= 0; i < list.length; i++){
  68. series.push({"name":list[i].Name, "data":eval(list[i].Data)})
  69. }
  70. var json = {};
  71. json.title = title;
  72. json.subtitle = subtitle;
  73. json.xAxis = xAxis;
  74. json.yAxis = yAxis;
  75. json.tooltip = tooltip;
  76. json.legend = legend;
  77. json.series = series;
  78. json.chart = chart;
  79. $('#container').highcharts(json);
  80. });
  81. function InitParams(ServerId, Minutes, Days) {
  82. if (ServerId.length > 0) {
  83. document.getElementById("server_id").value = ServerId;
  84. }
  85. if (Minutes > 0) {
  86. document.getElementById("minutes").value = Minutes;
  87. }
  88. if (Days > 0) {
  89. document.getElementById("days").value = Days;
  90. }
  91. }
  92. function submitUpdate () {
  93. var sid = document.getElementById("server_id").value;
  94. var min = document.getElementById("minutes").value;
  95. var days = document.getElementById("days").value;
  96. var text = "server_id=" + encodeURI(sid) + "&minutes=" + encodeURI(min) + "&days=" + encodeURI(days) ;
  97. $.ajax({
  98. type:"get",
  99. url:"/paynum?" + text,
  100. success:function (data) {
  101. // alert(data.status);
  102. if (data.status){
  103. window.location.href="/paynum?"+text;
  104. }else{
  105. if (data.info){
  106. alert(data.info);
  107. }else{
  108. window.location.href="/paynum?"+text;
  109. }
  110. }
  111. }
  112. });
  113. }
  114. function submitDownload () {
  115. var sid = document.getElementById("server_id").value;
  116. var min = document.getElementById("minutes").value;
  117. var days = document.getElementById("days").value;
  118. var text = "server_id=" + encodeURI(sid) + "&minutes=" + encodeURI(min) + "&days=" + encodeURI(days) + "&querydata=paynum";
  119. $.ajax({
  120. type:"get",
  121. url:"/paynum?" + text,
  122. success:function (data) {
  123. // alert(data.status);
  124. if (data.status){
  125. window.location.href="/paynum?"+text;
  126. }else{
  127. if (data.info){
  128. alert(data.info);
  129. }else{
  130. window.location.href="/paynum?"+text;
  131. }
  132. }
  133. }
  134. });
  135. }
  136. </script>
  137. </body>
  138. </html>