rt_pay.tpl 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8" />
  5. <title>欢迎页面-X-admin2.0</title>
  6. <script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
  7. <script src="http://code.highcharts.com/highcharts.js"></script>
  8. </head>
  9. <body>
  10. 指定服务器:
  11. <input id="server_id" type="text" name="服务器ID" value={{.Server_id}}>
  12. <br>
  13. <br>
  14. 时间颗粒度(分钟):
  15. <input id="minutes" type="text" name="时间颗粒度" value={{.Minutes}}>
  16. <br>
  17. <br>
  18. <input class="layui-btn" type="button" onclick="submitUpdate()" value=刷新>
  19. <input class="layui-btn" type="button" onclick="submitDownload()" value=下载>
  20. <br><br>
  21. <div class="layui-row layui-col-space20">
  22. <div class="layui-col-md4">
  23. <h1 id="today_charge" value = "">
  24. <span id ="cur_charge" style="font-size:20px;"> 今日充值 : 0 </span>
  25. </h1>
  26. </div>
  27. <br><br>
  28. <div id="container" style="width: 1600px; height: 800px; margin: 0 auto"></div>
  29. <script language="JavaScript">
  30. $(document).ready(function() {
  31. var chart = {
  32. type: 'spline'
  33. };
  34. var title = {
  35. text: '实时支付金额分布'
  36. };
  37. var subtitle = {
  38. text: 'Source: '
  39. };
  40. var xAxis = {
  41. title: {
  42. text: '时间'
  43. },
  44. tickPixelInterval: 1,
  45. categories: {{.Categories}}
  46. };
  47. var yAxis = {
  48. title: {
  49. text: '金额(美分)'
  50. },
  51. plotLines: [{
  52. value: 0,
  53. width: 1,
  54. color: '#808080'
  55. }]
  56. };
  57. var tooltip = {
  58. valueSuffix: '美分'
  59. }
  60. var legend = {
  61. layout: 'vertical',
  62. align: 'right',
  63. verticalAlign: 'middle',
  64. borderWidth: 0
  65. };
  66. var series = [
  67. ];
  68. var list = {{.Series}}
  69. for ( var i= 0; i < list.length; i++){
  70. series.push({"name":list[i].Name, "data":eval(list[i].Data)})
  71. }
  72. var TodayCharge = {{.TodayCharge}};
  73. updateCharge(TodayCharge)
  74. var json = {};
  75. json.title = title;
  76. json.subtitle = subtitle;
  77. json.xAxis = xAxis;
  78. json.yAxis = yAxis;
  79. json.tooltip = tooltip;
  80. json.legend = legend;
  81. json.series = series;
  82. json.chart = chart;
  83. $('#container').highcharts(json);
  84. });
  85. function submitUpdate () {
  86. var sid = document.getElementById("server_id").value;
  87. var min = document.getElementById("minutes").value;
  88. var text = "server_id=" + encodeURI(sid) + "&minutes=" + encodeURI(min) ;
  89. $.ajax({
  90. type:"get",
  91. url:"/rtpay?" + text,
  92. success:function (data) {
  93. // alert(data.status);
  94. if (data.status){
  95. window.location.href="/rtpay?"+text;
  96. }else{
  97. if (data.info){
  98. alert(data.info);
  99. }else{
  100. window.location.href="/rtpay?"+text;
  101. }
  102. }
  103. }
  104. });
  105. }
  106. function submitDownload () {
  107. var sid = document.getElementById("server_id").value;
  108. var min = document.getElementById("minutes").value;
  109. var text = "server_id=" + encodeURI(sid) + "&minutes=" + encodeURI(min) + "&querydata=rtpay";
  110. $.ajax({
  111. type:"get",
  112. url:"/rtpay?" + text,
  113. success:function (data) {
  114. // alert(data.status);
  115. if (data.status){
  116. window.location.href="/rtpay?"+text;
  117. }else{
  118. if (data.info){
  119. alert(data.info);
  120. }else{
  121. window.location.href="/rtpay?"+text;
  122. }
  123. }
  124. }
  125. });
  126. }
  127. function updateCharge (today) {
  128. document.getElementById('cur_charge').innerText="今日充值: "+today+"美分";
  129. }
  130. </script>
  131. </body>
  132. </html>