123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248 |
- {{define "login.html"}}
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
- <script src="https://cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.js"></script>
- <title>接口服务平台后台管理系统</title>
- </head>
- <style>
- </style>
- <body>
- <style>
- .title {
- text-align: center;
- }
- .tableDiv {
- margin-top: 20px;
- }
- .box tr td {
- text-align: center;
- }
- .handle a {
- text-decoration: none;
- margin-right: 5px;
- }
- .userProductList {
- margin-top: 20px;
- }
- .userProTbody tr td {
- text-align: center;
- }
- .test {
- width: 400px;
- height: 400px;
- }
- </style>
- <div>
- <h1 class="title">接口服务平台测试系统</h1>
- </div>
- <div>
- <button style="width: 80px;height: 35px"><a style="text-decoration:none;" href="/page/createUser">创建用户</a>
- </button>
- </div>
- <div class="tableDiv">
- <table border="1" cellspacing="0" cellpadding="0" id="tableId" width="80%" align="center" hidden>
- <thead>
- <tr class="tableTitle">
- <th style="width: 5%">序号</th>
- <th style="width: 25%">客户名称</th>
- <th style="width: 20%">APPID</th>
- <th style="width: 10%">密钥</th>
- <th style="width: 10%">客户电话</th>
- <th style="width: 10%">余额</th>
- <th style="width: 20%">操作</th>
- </tr>
- </thead>
- <tbody class="box">
- </tbody>
- </table>
- </div>
- <div class="userProductList">
- <div class="userProductDiv" hidden>
- <p class="nodata"></p>
- <h3>用户购买产品列表</h3>
- <table border="1" cellspacing="0" cellpadding="0" width="80%" align="center" id="userProduct">
- <thead>
- <tr class="tableTitle">
- <th style="width: 5%">序号</th>
- <th style="width: 5%">产品ID</th>
- <th style="width: 8%">产品名称</th>
- <th style="width: 25%">用户APPID</th>
- <th style="width: 5%">剩余量</th>
- <th style="width: 10%">扣费模式</th>
- <th style="width: 5%">状态</th>
- <th style="width: 10%">每日调用次数</th>
- <th style="width: 10%">单次返回数量</th>
- <th style="width: 25%">操作</th>
- </tr>
- </thead>
- <tbody class="userProTbody">
- </tbody>
- </table>
- </div>
- </div>
- {{/*
- <div class="test">
- <h3 id="demo">并发测试</h3>
- <input type="text" placeholder="请输入并发量">
- <button>确定</button>
- </div>
- */}}
- <div class="result"></div>
- <script>
- userList()
- function userList() {
- $.ajax({
- url: "/manage/user/list",
- type: "POST",
- dataType: "json",
- async: false,
- success: function (r) {
- if (r.code === 0) {
- var str = ""
- if (r.data.length != 0) {
- $("#tableId").show();
- for (var i = 0; i < r.data.length; i++) {
- var item = r.data[i];
- str += "<tr >";
- str += "<td style='width: 50px'>" + (i + 1) + "</td>";
- 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>";
- str += "<td style='width: 200px'>" + item.app_id + "</td>";
- str += "<td style='width: 100px'>" + item.secret_key + "</td>";
- str += "<td style='width: 100px'>" + item.phone + "</td>";
- str += "<td style='width: 100px'>" + (item.money / 100) + "</td>";
- 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>";
- str += "</tr>";
- }
- $(".box").html(str);
- } else {
- $(".tableDiv").html("还没有客户,请添加客户信息");
- }
- } else {
- $(".tableDiv").html(r.msg);
- }
- }
- })
- }
- function userProductList(appId, key) {
- //var appId = $(obj).find("td:eq(2)").text();
- //var key = $(obj).find("td:eq(3)").text();
- console.log(appId, "|", key)
- let param = {
- "appId": appId
- };
- $.ajax({
- url: "/manage/user/userProductList",
- type: "POST",
- dataType: "json",
- async: false,
- data: param,
- success: function (r) {
- if (r.code === 0) {
- var str = "";
- if (r.data) {
- $(".nodata").html("");
- $(".userProductDiv").show();
- $(".userProTbody").html("");
- for (var i = 0; i < r.data.length; i++) {
- var item = r.data[i];
- str += "<tr>";
- str += "<td>" + (i + 1) + "</td>";
- str += "<td>" + item.product_id + "</td>";
- str += "<td>" + item.name + "</td>";
- str += "<td>" + item.app_id + "</td>";
- str += "<td>" + item.left_num + "</td>";
- if (item.cost_model == 0) {
- str += "<td>扣量</td>";
- } else {
- str += "<td>扣余额</td>";
- }
- if (item.interface_status == 0) {
- str += "<td>开启</td>";
- } else {
- str += "<td>关闭</td>";
- }
- str += "<td>" + item.call_times_limit_day + "</td>";
- str += "<td>" + item.data_num_limit_one_times + "</td>";
- if (item.product_id === 1000 || item.product_id === 1001) {
- str += "<td class='handle' style='width: 100px ;'><a href=\"/page/projectListPage?appId=" + appId + "&key=" + key + "\" >测试接口</a>";
- } else {
- str += "<td class='handle' style='width: 100px;'><a href=\"/page/projectListDetail?appId=" + appId + "&key=" + key + "\" >测试接口</a>";
- }
- if (item.cost_model == 0) {
- str += "<a href=\"/page/userRecharge?appId=" + appId + "\" >剩余量充值</a>"
- }
- str += "<a href=\"/page/callLogPage?appId=" + appId + "&key=" + key + "&product_id=" + item.product_id + "\" >调用记录</a>";
- str += "<a onclick=\"myFunction('" + appId + "','" + key + "','" + item.product_id + "')\" href='javascript:void(0);' style='pointer:hand;'>并发测试</a>"
- // else {
- //
- // }
- str += "</td>";
- str += "</tr>";
- }
- // console.log(str);
- let trBody = $(str);
- $(".userProTbody").append(trBody);
- } else {
- $(".userProductDiv").hide();
- }
- } else {
- $(".userProductList").html(r.msg);
- }
- }
- })
- }
- //并发测试点击事件,参数 appid 产品id,并发量
- function myFunction(appId, key, productId) {
- console.log(appId, key, productId)
- var num = prompt("请输入并发量", "");
- if (num != null && num != "") {
- console.log(num)
- var param = {
- "appid": appId,
- "productId": productId,
- "count": num,
- }
- $.ajax({
- url: "/manage/user/concurrentTest",
- type: "POST",
- dataType: "json",
- async: false,
- data: param,
- success: function (r) {
- alert(JSON.stringify(r))
- }
- })
- }
- }
- </script>
- </body>
- </html>
- {{end}}
|