Pārlūkot izejas kodu

Merge branch 'master' of http://192.168.3.207:10080/group3/SwordFish_Interface_Service

xuzhiheng 4 gadi atpakaļ
vecāks
revīzija
4df35429fe

+ 7 - 0
router/pageRouter.go

@@ -16,6 +16,7 @@ func pageRouterRegister(router *gin.Engine) {
 		pageRouterGroup.GET("/projectListPage", projectListPage)
 		pageRouterGroup.GET("/projectListPage", projectListPage)
 		pageRouterGroup.GET("/projectListDetail", projectListDetailPage)
 		pageRouterGroup.GET("/projectListDetail", projectListDetailPage)
 		pageRouterGroup.GET("/interfaceListPage", interfaceListPage)
 		pageRouterGroup.GET("/interfaceListPage", interfaceListPage)
+		pageRouterGroup.GET("/moneyRechargePage", moneyRechargePage)
 	}
 	}
 }
 }
 
 
@@ -50,3 +51,9 @@ func projectListDetailPage(context *gin.Context) {
 func interfaceListPage(context *gin.Context) {
 func interfaceListPage(context *gin.Context) {
 	context.HTML(200, "interfaceList.html", nil)
 	context.HTML(200, "interfaceList.html", nil)
 }
 }
+
+func moneyRechargePage(context *gin.Context) {
+	context.HTML(200, "moneyRecharge.html", nil)
+}
+
+

+ 62 - 6
static/templates/login.html

@@ -36,6 +36,14 @@
         .userProTbody tr td {
         .userProTbody tr td {
             text-align: center;
             text-align: center;
         }
         }
+
+        .test {
+
+            width: 400px;
+            height: 400px;
+        }
+
+
     </style>
     </style>
     <div>
     <div>
         <h1 class="title">接口服务平台测试系统</h1>
         <h1 class="title">接口服务平台测试系统</h1>
@@ -70,14 +78,14 @@
                 <thead>
                 <thead>
                 <tr class="tableTitle">
                 <tr class="tableTitle">
                     <th style="width: 5%">序号</th>
                     <th style="width: 5%">序号</th>
-                    <th style="width: 10%">产品ID</th>
+                    <th style="width: 5%">产品ID</th>
                     <th style="width: 25%">用户APPID</th>
                     <th style="width: 25%">用户APPID</th>
                     <th style="width: 5%">剩余量</th>
                     <th style="width: 5%">剩余量</th>
                     <th style="width: 10%">扣费模式</th>
                     <th style="width: 10%">扣费模式</th>
                     <th style="width: 5%">状态</th>
                     <th style="width: 5%">状态</th>
                     <th style="width: 10%">每日调用次数</th>
                     <th style="width: 10%">每日调用次数</th>
                     <th style="width: 10%">单次返回数量</th>
                     <th style="width: 10%">单次返回数量</th>
-                    <th style="width: 20%">操作</th>
+                    <th style="width: 25%">操作</th>
                 </tr>
                 </tr>
                 </thead>
                 </thead>
                 <tbody class="userProTbody">
                 <tbody class="userProTbody">
@@ -88,6 +96,14 @@
 
 
     </div>
     </div>
 
 
+    {{/*<div class="test">
+        <h3 id="demo">并发测试</h3>
+        <input type="text" placeholder="请输入并发量">
+        <button>确定</button>
+    </div>*/}}
+    <div class="result"></div>
+
+
     <script>
     <script>
         userList()
         userList()
 
 
@@ -111,7 +127,7 @@
                                 str += "<td style='width: 100px'>" + item.secret_key + "</td>";
                                 str += "<td style='width: 100px'>" + item.secret_key + "</td>";
                                 str += "<td style='width: 100px'>" + item.phone + "</td>";
                                 str += "<td style='width: 100px'>" + item.phone + "</td>";
                                 str += "<td style='width: 100px'>" + item.money + "</td>";
                                 str += "<td style='width: 100px'>" + item.money + "</td>";
-                                str += "<td class='handle' style='width: 100px'><a href=\"/page/userRecharge?appId=" + item.app_id + "\">充值</a><a href=\"/page/chooseProductPage?appId="+item.app_id+"\">购买产品</a></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>";
                                 str += "</tr>";
                             }
                             }
@@ -167,13 +183,21 @@
                                 str += "<td>" + item.call_times_limit_day + "</td>";
                                 str += "<td>" + item.call_times_limit_day + "</td>";
                                 str += "<td>" + item.data_num_limit_one_times + "</td>";
                                 str += "<td>" + item.data_num_limit_one_times + "</td>";
                                 if (item.product_id === 1000 || item.product_id === 1001) {
                                 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></td>";
+                                    str += "<td class='handle' style='width: 100px ;'><a href=\"/page/projectListPage?appId=" + appId + "&key=" + key + "\" >测试接口</a>";
                                 } else {
                                 } else {
-                                    str += "<td class='handle' style='width: 100px'><a href=\"/page/projectListDetail?appId=" + appId + "&key=" + key + "\"  >测试接口</a></td>";
+                                    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 onclick=\"myFunction('" + appId + "','" + key + "','" + item.product_id + "')\"  href='javascript:void(0);' style='pointer:hand;'>并发测试</a>"
+                                // else {
+                                //
+                                // }
+                                str += "</td>";
                                 str += "</tr>";
                                 str += "</tr>";
                             }
                             }
-                            console.log(str);
+                            // console.log(str);
                             let trBody = $(str);
                             let trBody = $(str);
                             $(".userProTbody").append(trBody);
                             $(".userProTbody").append(trBody);
                         } else {
                         } else {
@@ -187,6 +211,38 @@
             })
             })
         }
         }
 
 
+        //并发测试点击事件,参数 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/userProductList",
+                    type: "POST",
+                    dataType: "json",
+                    async: false,
+                    data: param,
+                    success: function (r) {
+                        // if (r.code === 0) {
+                            alert(JSON.stringify(r))
+                            // $(".result").html(r)
+                        // } else {
+                        //
+                        // }
+                    }
+                })
+
+            }
+        }
+
+
     </script>
     </script>
     </body>
     </body>
     </html>
     </html>

+ 59 - 0
static/templates/moneyRecharge.html

@@ -0,0 +1,59 @@
+{{define "moneyRecharge.html"}}
+    <!DOCTYPE html>
+    <html lang="en">
+    <head>
+        <meta charset="UTF-8">
+        <title>余额充值</title>
+        <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
+    </head>
+    <body>
+    <h3>余额充值</h3>
+    <div id="money">
+        <input type="number" id="moneys" placeholder="请输入充值金额">
+        <button type="button" id="moneyBtn">提交</button>
+    </div>
+    <div id="resultContent"></div>
+
+    </body>
+    </html>
+    <script>
+        var appid = getParam("appId");
+        // 获取上个页面传来的参数
+        function getParam(name) {
+            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
+            var r = window.location.search.substr(1).match(reg); //获取url中"?"符后的字符串并正则匹配
+            var context = "";
+            if (r != null)
+                context = r[2];
+            reg = null;
+            r = null;
+            return context == null || context == "" || context == "undefined" ? "" : context;
+        }
+        function submit(param, rType, url, hearders) {
+            $.ajax({
+                url: url,
+                type: rType,
+                headers: hearders,
+                data: param,
+                success: function (r) {
+                    $("#resultContent").text("");
+                    if (r.code === 1000) {
+                        $("#resultContent").text(r.msg);
+                    } else {
+                        $("#resultContent").text(r.msg);
+                    }
+                }
+            })
+        }
+
+        $("#moneyBtn").on("click", function () {
+            var param = {
+                "appid": appid,
+                "money": Math.round($("#moneys").val() * 100),
+            };
+            var url = "/manage/user/moneyRecharge";
+            var rType = "post";
+            submit(param, rType, url);
+        })
+    </script>
+{{end}}

+ 2 - 1
static/templates/projectDetails.html

@@ -44,7 +44,8 @@
             var hearders = {
             var hearders = {
                 "timestamp": "" + Math.round(now / 1000),
                 "timestamp": "" + Math.round(now / 1000),
                 "token": token
                 "token": token
-            }
+            };
+            console.log(param)
             $.ajax({
             $.ajax({
                 url: url,
                 url: url,
                 type: rType,
                 type: rType,

+ 5 - 4
static/templates/projectList.html

@@ -69,10 +69,11 @@
                         var str = "";
                         var str = "";
                         for (var i = 0; i < r.data.length; i++) {
                         for (var i = 0; i < r.data.length; i++) {
                             var item = r.data[i]
                             var item = r.data[i]
-                            str += '<tr onclick="projectDetails(this)">';
+                            str += '<tr >';
                             // str += '<td style="width: 20px"></td>';
                             // str += '<td style="width: 20px"></td>';
                             str += '<td class="td">' + (i + 1) + '</td>';
                             str += '<td class="td">' + (i + 1) + '</td>';
-                            str += '<td class="td">' + item.projectId + '</td>';
+                            str += "<td class=\"td\"><a href='javascript:void(0);' style='pointer:hand;' onclick=\"projectDetails('" + item.projectId + "')\">" + item.projectId + "</a></td>";
+                            // str += '<td class="td"><a href="javascript:void(0);" onclick="projectDetails()"> ' + item.projectId + '</a></td>';
                             str += '<td>' + item.projectName + '</td>';
                             str += '<td>' + item.projectName + '</td>';
                             str += '<td>' + item.buyer + '</td>';
                             str += '<td>' + item.buyer + '</td>';
                             str += '<td class="td">' + item.buyerClass + '</td>';
                             str += '<td class="td">' + item.buyerClass + '</td>';
@@ -116,8 +117,8 @@
         })
         })
 
 
         function projectDetails(obj) {
         function projectDetails(obj) {
-            var p = $(obj).find("td:eq(1)").text();
-            location.href = "/page/projectDetailsPage?projectId=" + p + "&appId=" + appid + "&key=" + key
+            // var p = $(obj).parent().find("td:eq(1)").text();
+            location.href = "/page/projectDetailsPage?projectId=" + obj + "&appId=" + appid + "&key=" + key
         }
         }
     </script>
     </script>
     </html>
     </html>

+ 22 - 30
static/templates/userRecharge.html

@@ -12,18 +12,19 @@
       }
       }
     </style>
     </style>
     <body>
     <body>
-        <div id="main">
+        {{/*<div id="main">
             <div class="list">
             <div class="list">
                 <h1>充值接口</h1>
                 <h1>充值接口</h1>
                 <a href="#" onclick="$('#money').show();$('#main').hide();">1.余额充值</a><br>
                 <a href="#" onclick="$('#money').show();$('#main').hide();">1.余额充值</a><br>
                 <a href="#" onclick="$('#product').show();$('#main').hide();">2.剩余量充值</a>
                 <a href="#" onclick="$('#product').show();$('#main').hide();">2.剩余量充值</a>
             </div>
             </div>
-        </div>
-        <div id="money" style="display: none;">
+        </div>*/}}
+        {{/*<div id="money" style="display: none;">
             <input type="number" id="moneys" placeholder="请输入充值金额">
             <input type="number" id="moneys" placeholder="请输入充值金额">
             <button type="button" id="moneyBtn">提交</button>
             <button type="button" id="moneyBtn">提交</button>
-        </div>
-        <div id="product" style="display: none;">
+        </div>*/}}
+        <h3>剩余量充值</h3>
+        <div id="product">
             <!-- <input type="number" id="productId" placeholder="请输入产品id"> -->
             <!-- <input type="number" id="productId" placeholder="请输入产品id"> -->
             产品 <select id="productId"></select>
             产品 <select id="productId"></select>
             <input type="number" id="rechargeNum" placeholder="请输入充值次数">
             <input type="number" id="rechargeNum" placeholder="请输入充值次数">
@@ -49,31 +50,6 @@
                     }
                     }
                 })
                 })
             }
             }
-            function submit(param,rType,url,hearders){
-                $.ajax({
-                    url: url,
-                    type: rType,
-                    headers: hearders,
-                    data: param,
-                    success:function(r){
-                        $("#resultContent").text("");
-                    	if(r.code === 1000){
-                            $("#resultContent").text(r.msg);
-                    	}else{
-                    		$("#resultContent").text(r.msg);
-                    	}
-                    }
-                })
-            }
-            $("#moneyBtn").on("click", function(){
-                var param = {
-                    "appid": appid,
-                    "money": Math.round($("#moneys").val()*100),
-                };
-                var url = "/manage/user/moneyRecharge";
-                var rType = "post";
-                submit(param,rType,url);
-            })
             
             
             $("#productBtn").on("click", function(){
             $("#productBtn").on("click", function(){
                 var param = {
                 var param = {
@@ -98,6 +74,22 @@
                 r = null;
                 r = null;
                 return context == null || context == "" || context == "undefined" ? "" : context;
                 return context == null || context == "" || context == "undefined" ? "" : context;
             }
             }
+            function submit(param, rType, url, hearders) {
+                $.ajax({
+                    url: url,
+                    type: rType,
+                    headers: hearders,
+                    data: param,
+                    success: function (r) {
+                        $("#resultContent").text("");
+                        if (r.code === 1000) {
+                            $("#resultContent").text(r.msg);
+                        } else {
+                            $("#resultContent").text(r.msg);
+                        }
+                    }
+                })
+            }
         </script>
         </script>
     </body>
     </body>
     </html>
     </html>