login.html 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. {{define "login.html"}}
  2. <!DOCTYPE html>
  3. <html lang="en">
  4. <head>
  5. <meta charset="UTF-8">
  6. <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
  7. <script src="https://cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.js"></script>
  8. <title>接口服务平台后台管理系统</title>
  9. </head>
  10. <style>
  11. </style>
  12. <body>
  13. <style>
  14. .title {
  15. text-align: center;
  16. }
  17. .tableDiv {
  18. margin-top: 20px;
  19. }
  20. .box tr td {
  21. text-align: center;
  22. }
  23. .handle a {
  24. text-decoration: none;
  25. margin-right: 5px;
  26. }
  27. .userProductList {
  28. margin-top: 20px;
  29. }
  30. .userProTbody tr td {
  31. text-align: center;
  32. }
  33. .test {
  34. width: 400px;
  35. height: 400px;
  36. }
  37. </style>
  38. <div>
  39. <h1 class="title">接口服务平台测试系统</h1>
  40. </div>
  41. <div>
  42. <button style="width: 80px;height: 35px"><a style="text-decoration:none;" href="/page/createUser">创建用户</a>
  43. </button>
  44. </div>
  45. <div class="tableDiv">
  46. <table border="1" cellspacing="0" cellpadding="0" id="tableId" width="80%" align="center" hidden>
  47. <thead>
  48. <tr class="tableTitle">
  49. <th style="width: 5%">序号</th>
  50. <th style="width: 25%">客户名称</th>
  51. <th style="width: 20%">APPID</th>
  52. <th style="width: 10%">密钥</th>
  53. <th style="width: 10%">客户电话</th>
  54. <th style="width: 10%">余额</th>
  55. <th style="width: 20%">操作</th>
  56. </tr>
  57. </thead>
  58. <tbody class="box">
  59. </tbody>
  60. </table>
  61. </div>
  62. <div class="userProductList">
  63. <div class="userProductDiv" hidden>
  64. <p class="nodata"></p>
  65. <h3>用户购买产品列表</h3>
  66. <table border="1" cellspacing="0" cellpadding="0" width="80%" align="center" id="userProduct">
  67. <thead>
  68. <tr class="tableTitle">
  69. <th style="width: 5%">序号</th>
  70. <th style="width: 5%">产品ID</th>
  71. <th style="width: 8%">产品名称</th>
  72. <th style="width: 25%">用户APPID</th>
  73. <th style="width: 5%">剩余量</th>
  74. <th style="width: 10%">扣费模式</th>
  75. <th style="width: 5%">状态</th>
  76. <th style="width: 10%">每日调用次数</th>
  77. <th style="width: 10%">单次返回数量</th>
  78. <th style="width: 25%">操作</th>
  79. </tr>
  80. </thead>
  81. <tbody class="userProTbody">
  82. </tbody>
  83. </table>
  84. </div>
  85. </div>
  86. {{/*
  87. <div class="test">
  88. <h3 id="demo">并发测试</h3>
  89. <input type="text" placeholder="请输入并发量">
  90. <button>确定</button>
  91. </div>
  92. */}}
  93. <div class="result"></div>
  94. <script>
  95. userList()
  96. function userList() {
  97. $.ajax({
  98. url: "/manage/user/list",
  99. type: "POST",
  100. dataType: "json",
  101. async: false,
  102. success: function (r) {
  103. if (r.code === 0) {
  104. var str = ""
  105. if (r.data.length != 0) {
  106. $("#tableId").show();
  107. for (var i = 0; i < r.data.length; i++) {
  108. var item = r.data[i];
  109. str += "<tr >";
  110. str += "<td style='width: 50px'>" + (i + 1) + "</td>";
  111. str += "<td style='width: 100px'><a href='javascript:void(0);' style='pointer:hand;' onclick=\"userProductList('" + item.app_id + "','" + item.secret_key + "')\">" + item.name + "</a></td>";
  112. str += "<td style='width: 200px'>" + item.app_id + "</td>";
  113. str += "<td style='width: 100px'>" + item.secret_key + "</td>";
  114. str += "<td style='width: 100px'>" + item.phone + "</td>";
  115. str += "<td style='width: 100px'>" + (item.money / 100) + "</td>";
  116. str += "<td class='handle' style='width: 100px'><a href=\"/page/moneyRechargePage?appId=" + item.app_id + "\">账户余额充值</a><a href=\"/page/chooseProductPage?appId=" + item.app_id + "\">购买产品</a></td>";
  117. str += "</tr>";
  118. }
  119. $(".box").html(str);
  120. } else {
  121. $(".tableDiv").html("还没有客户,请添加客户信息");
  122. }
  123. } else {
  124. $(".tableDiv").html(r.msg);
  125. }
  126. }
  127. })
  128. }
  129. function userProductList(appId, key) {
  130. //var appId = $(obj).find("td:eq(2)").text();
  131. //var key = $(obj).find("td:eq(3)").text();
  132. console.log(appId, "|", key)
  133. let param = {
  134. "appId": appId
  135. };
  136. $.ajax({
  137. url: "/manage/user/userProductList",
  138. type: "POST",
  139. dataType: "json",
  140. async: false,
  141. data: param,
  142. success: function (r) {
  143. if (r.code === 0) {
  144. var str = "";
  145. if (r.data) {
  146. $(".nodata").html("");
  147. $(".userProductDiv").show();
  148. $(".userProTbody").html("");
  149. for (var i = 0; i < r.data.length; i++) {
  150. var item = r.data[i];
  151. str += "<tr>";
  152. str += "<td>" + (i + 1) + "</td>";
  153. str += "<td>" + item.product_id + "</td>";
  154. str += "<td>" + item.name + "</td>";
  155. str += "<td>" + item.app_id + "</td>";
  156. str += "<td>" + item.left_num + "</td>";
  157. if (item.cost_model == 0) {
  158. str += "<td>扣量</td>";
  159. } else {
  160. str += "<td>扣余额</td>";
  161. }
  162. if (item.interface_status == 0) {
  163. str += "<td>开启</td>";
  164. } else {
  165. str += "<td>关闭</td>";
  166. }
  167. str += "<td>" + item.call_times_limit_day + "</td>";
  168. str += "<td>" + item.data_num_limit_one_times + "</td>";
  169. if (item.product_id === 1000 || item.product_id === 1001) {
  170. str += "<td class='handle' style='width: 100px ;'><a href=\"/page/projectListPage?appId=" + appId + "&key=" + key + "\" >测试接口</a>";
  171. } else {
  172. str += "<td class='handle' style='width: 100px;'><a href=\"/page/projectListDetail?appId=" + appId + "&key=" + key + "\" >测试接口</a>";
  173. }
  174. if (item.cost_model == 0) {
  175. str += "<a href=\"/page/userRecharge?appId=" + appId + "\" >剩余量充值</a>"
  176. }
  177. str += "<a href=\"/page/callLogPage?appId=" + appId + "&key=" + key + "&product_id=" + item.product_id + "\" >调用记录</a>";
  178. str += "<a onclick=\"myFunction('" + appId + "','" + key + "','" + item.product_id + "')\" href='javascript:void(0);' style='pointer:hand;'>并发测试</a>"
  179. // else {
  180. //
  181. // }
  182. str += "</td>";
  183. str += "</tr>";
  184. }
  185. // console.log(str);
  186. let trBody = $(str);
  187. $(".userProTbody").append(trBody);
  188. } else {
  189. $(".userProductDiv").hide();
  190. }
  191. } else {
  192. $(".userProductList").html(r.msg);
  193. }
  194. }
  195. })
  196. }
  197. //并发测试点击事件,参数 appid 产品id,并发量
  198. function myFunction(appId, key, productId) {
  199. console.log(appId, key, productId)
  200. var num = prompt("请输入并发量", "");
  201. if (num != null && num != "") {
  202. console.log(num)
  203. var param = {
  204. "appid": appId,
  205. "productId": productId,
  206. "count": num,
  207. }
  208. $.ajax({
  209. url: "/manage/user/concurrentTest",
  210. type: "POST",
  211. dataType: "json",
  212. async: false,
  213. data: param,
  214. success: function (r) {
  215. alert(JSON.stringify(r))
  216. }
  217. })
  218. }
  219. }
  220. </script>
  221. </body>
  222. </html>
  223. {{end}}