浏览代码

空接口测试

jiaojiao7 4 年之前
父节点
当前提交
3a255347a6
共有 3 个文件被更改,包括 227 次插入207 次删除
  1. 3 3
      api/v1/projects.go
  2. 0 3
      service/projectDetail.go
  3. 224 201
      static/templates/login.html

+ 3 - 3
api/v1/projects.go

@@ -125,7 +125,7 @@ func biddingInfoList(c *gin.Context) {
 	bs, _ := json.Marshal(p)
 	param := string(bs)
 	utils.Check(appID, productID, c, func() ([]map[string]interface{}, int, error) {
-		return service.ProjectInfo()
+		return []map[string]interface{}{}, 200, nil
 	}, param, requestIP, false)
 }
 
@@ -139,7 +139,7 @@ func healthInfoList(c *gin.Context) {
 	bs, _ := json.Marshal(p)
 	param := string(bs)
 	utils.Check(appID, productID, c, func() ([]map[string]interface{}, int, error) {
-		return service.ProjectInfo()
+		return []map[string]interface{}{}, 200, nil
 	}, param, requestIP, false)
 }
 
@@ -153,6 +153,6 @@ func healthinfo(c *gin.Context) {
 	bs, _ := json.Marshal(p)
 	param := string(bs)
 	utils.Check(appID, productID, c, func() ([]map[string]interface{}, int, error) {
-		return service.ProjectInfo()
+		return []map[string]interface{}{}, 200, nil
 	}, param, requestIP, false)
 }

+ 0 - 3
service/projectDetail.go

@@ -91,6 +91,3 @@ func ProjectDetailData(id string) (data []map[string]interface{}, httpStatus int
 	return data, httpStatus, nil
 }
 
-func ProjectInfo() (data []map[string]interface{}, httpStatus int, err error) {
-	return nil, 200, nil
-}

+ 224 - 201
static/templates/login.html

@@ -1,233 +1,257 @@
 {{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 target="_blank" 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">
+    <!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 target="_blank" 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: 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>
+                <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="userProTbody">
+            <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">
 
-</div>
+                </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  target=\"_blank\" href=\"/page/moneyRechargePage?appId=" + item.app_id + "\">账户余额充值</a><a  target=\"_blank\" href=\"/page/chooseProductPage?appId=" + item.app_id + "\">购买产品</a></td>";
-
-                            str += "</tr>";
+    <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  target=\"_blank\" href=\"/page/moneyRechargePage?appId=" + item.app_id + "\">账户余额充值</a><a  target=\"_blank\" href=\"/page/chooseProductPage?appId=" + item.app_id + "\">购买产品</a></td>";
+
+                                str += "</tr>";
+                            }
+                            $(".box").html(str);
+                        } else {
+                            $(".tableDiv").html("还没有客户,请添加客户信息");
                         }
-                        $(".box").html(str);
                     } else {
-                        $(".tableDiv").html("还没有客户,请添加客户信息");
+                        $(".tableDiv").html(r.msg);
                     }
-                } 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) {
-                                str += "<td class='handle' style='width: 100px ;'><a target=\"_blank\" href=\"/page/projectListPage?appId=" + appId + "&key=" + key + "\" >测试接口</a>";
-                            } else if (item.product_id === 1001) {
-                                str += "<td class='handle' style='width: 100px ;'><a target=\"_blank\" href=\"/page/projectDetailSearchPage?projectId=1001&appId=" + appId + "&key=" + key + "\" >测试接口</a>";
-                            } else if (item.product_id === 1002) {
-                                str += "<td class='handle' style='width: 100px;'><a target=\"_blank\" href=\"/page/projectListDetail?appId=" + appId + "&key=" + key + "\"  >测试接口</a>";
-                            }
-                            if (item.cost_model == 0) {
-                                str += "<a  target=\"_blank\" href=\"/page/userRecharge?appId=" + appId + "&productId=" + item.product_id + "\"  >剩余量充值</a>"
+            })
+        }
+
+        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) {
+                                    str += "<td class='handle' style='width: 100px ;'><a target=\"_blank\" href=\"/page/projectListPage?appId=" + appId + "&key=" + key + "\" >测试接口</a>";
+                                } else if (item.product_id === 1001) {
+                                    str += "<td class='handle' style='width: 100px ;'><a target=\"_blank\" href=\"/page/projectDetailSearchPage?projectId=1001&appId=" + appId + "&key=" + key + "\" >测试接口</a>";
+                                } else if (item.product_id === 1002) {
+                                    str += "<td class='handle' style='width: 100px;'><a target=\"_blank\" href=\"/page/projectListDetail?appId=" + appId + "&key=" + key + "\"  >测试接口</a>";
+                                } else {
+                                    str += "<td class='handle' style='width: 100px;'><a onclick=\"test('" + appId + "','" + key + "','" + item.product_id + "')\" href='javascript:void(0);'>测试接口</a>";
+                                }
+                                if (item.cost_model === 0) {
+                                    str += "<a  target=\"_blank\" href=\"/page/userRecharge?appId=" + appId + "&productId=" + item.product_id + "\"  >剩余量充值</a>"
+                                }
+                                str += "<a  target=\"_blank\" 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>";
                             }
-                            str += "<a  target=\"_blank\" 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();
                         }
-                        // console.log(str);
-                        let trBody = $(str);
-                        $(".userProTbody").append(trBody);
+
                     } else {
-                        $(".userProductDiv").hide();
+                        $(".userProductList").html(r.msg);
                     }
+                }
+            })
+        }
 
-                } 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) {
 
-    //并发测试点击事件,参数 appid 产品id,并发量
+                        alert(JSON.stringify(r))
+                    }
+                })
+            }
+        }
 
-    function myFunction(appId, key, productId) {
-        console.log(appId, key, productId)
-        var num = prompt("请输入并发量", "");
-        if (num != null && num != "") {
-            console.log(num)
+        function test(appId, key, productId) {
+            alert("确定执行")
             var param = {
                 "appid": appId,
                 "productId": productId,
-                "count": num,
+                "count": 1,
             }
             $.ajax({
                 url: "/manage/user/concurrentTest",
@@ -241,10 +265,9 @@
                 }
             })
         }
-    }
 
 
-</script>
-</body>
-</html>
+    </script>
+    </body>
+    </html>
 {{end}}