Эх сурвалжийг харах

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

jiaojiao7 4 жил өмнө
parent
commit
15f6325274

+ 12 - 18
api/v1/projects.go

@@ -38,9 +38,9 @@ func getProjectsList(c *gin.Context) {
 	winner := c.PostForm("winner")
 	bidTime := c.PostForm("bid_time")
 	p := gin.H{
-		"projectName": projectName,
-		"winner":      winner,
-		"bidTime":     bidTime,
+		"project_name": projectName,
+		"winner":       winner,
+		"bid_time":     bidTime,
 	}
 	bs, _ := json.Marshal(p)
 	param := string(bs)
@@ -81,7 +81,7 @@ func getProjectDetail(c *gin.Context) {
 	_id := c.PostForm("project_id")
 	id := service.SE.DecodeString(_id)
 	p := gin.H{
-		"id": id,
+		"project_id": _id,
 	}
 	bs, _ := json.Marshal(p)
 	param := string(bs)
@@ -107,11 +107,11 @@ func callLog(c *gin.Context) {
 	datas := []map[string]interface{}{}
 	var err error
 	p := gin.H{
-		"appID":     appID,
-		"startTime": startTime,
-		"endTime":   endTime,
-		"productId": productId,
-		"isSelf":    isSelf,
+		"app_id":     appID,
+		"start_time": startTime,
+		"end_time":   endTime,
+		"product_id": productId,
+		"isSelf":     isSelf,
 	}
 	global.Logger.Info("api callLog:", zap.Any("param:", p))
 	datas, err = service.CallLog(appID, productId, startTime, endTime, isSelfs)
@@ -126,9 +126,7 @@ func biddingInfoList(c *gin.Context) {
 	productID := c.MustGet("productID").(int)
 	appID := c.MustGet("appID").(string)
 	requestIP := c.MustGet("requestIP").(string)
-	p := gin.H{
-
-	}
+	p := gin.H{}
 	bs, _ := json.Marshal(p)
 	param := string(bs)
 	utils.Check(appID, productID, c, func() ([]map[string]interface{}, int, error) {
@@ -140,9 +138,7 @@ func healthInfoList(c *gin.Context) {
 	productID := c.MustGet("productID").(int)
 	appID := c.MustGet("appID").(string)
 	requestIP := c.MustGet("requestIP").(string)
-	p := gin.H{
-
-	}
+	p := gin.H{}
 	bs, _ := json.Marshal(p)
 	param := string(bs)
 	utils.Check(appID, productID, c, func() ([]map[string]interface{}, int, error) {
@@ -154,9 +150,7 @@ func healthinfo(c *gin.Context) {
 	productID := c.MustGet("productID").(int)
 	appID := c.MustGet("appID").(string)
 	requestIP := c.MustGet("requestIP").(string)
-	p := gin.H{
-
-	}
+	p := gin.H{}
 	bs, _ := json.Marshal(p)
 	param := string(bs)
 	utils.Check(appID, productID, c, func() ([]map[string]interface{}, int, error) {

+ 0 - 2
manage/user/concurrentTest.go

@@ -2,7 +2,6 @@ package user
 
 import (
 	"log"
-	"sfis/model/response"
 	"sfis/service"
 	"strconv"
 	"sync"
@@ -30,5 +29,4 @@ func concurrentTest(c *gin.Context) {
 		}(i)
 	}
 	wg.Wait()
-	response.Ok(c)
 }

+ 5 - 5
service/concurrentTest.go

@@ -10,21 +10,21 @@ func GetConcurrentData(appid string, productId int, c *gin.Context) {
 	if productId == 1000 {
 		utils.Check(appid, productId, c, func() ([]map[string]interface{}, int, error) {
 			return ProjectListData(productId, appid, "河南大学", "", "", false)
-		}, "", "", true)
+		}, `{"bidTime":"","projectName":"河南大学","winner":""}`, "127.0.0.1", true)
 	} else if productId == 1001 {
 		utils.Check(appid, productId, c, func() ([]map[string]interface{}, int, error) {
-			return ProjectDetailData("5f6bc00c499cb0822d7e3842")
-		}, "", "", true)
+			return ProjectDetailData("QQlGKDskaAIECAAXDUBya3A8BVQIC0wK")
+		}, `{"id":"QQlGKDskaAIECAAXDUBya3A8BVQIC0wK"}`, "127.0.0.1", true)
 	} else if productId == 1002 {
 		utils.Check(appid, productId, c, func() ([]map[string]interface{}, int, error) {
 			return ProjectListData(productId, appid, "", "中铁十五局集团有限公司", "", true)
-		}, "", "", true)
+		}, `{"winner":"中铁十五局集团有限公司"}`, "127.0.0.1", true)
 	} else {
 		utils.Check(appid, productId, c, func() ([]map[string]interface{}, int, error) {
 			datas := []map[string]interface{}{map[string]interface{}{
 				"title": "中铁十五局集团有限公司",
 			}}
 			return datas, 200, nil
-		}, "", "", true)
+		}, "并发测试", "127.0.0.1", true)
 	}
 }

+ 3 - 3
static/templates/callLog.html

@@ -97,10 +97,10 @@
                                 str += '<td class="td">按剩余量扣除</td>';
                                 str += '<td class="td">' + item.trade_num + '</td>';
                             }else if (item.cost_model === 1){
-                                str += '<td class="td">' + Math.round(item.before/100) + '</td>';
-                                str += '<td class="td">' + Math.round(item.after/100) + '</td>';
+                                str += '<td class="td">' + item.before/100 + '</td>';
+                                str += '<td class="td">' + item.after/100 + '</td>';
                                 str += '<td class="td">按余额扣除</td>';
-                                str += '<td class="td">' + Math.round(item.trade_num/100) + '</td>';
+                                str += '<td class="td">' + item.trade_num/100 + '</td>';
                             }
                             str += '</tr>';
                         }

+ 11 - 5
static/templates/login.html

@@ -3,7 +3,7 @@
     <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://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
         <script src="https://cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.js"></script>
         <title>接口服务平台后台管理系统</title>
     </head>
@@ -239,10 +239,13 @@
                     async: false,
                     data: param,
                     success: function (r) {
-
-                        alert(JSON.stringify(r))
+                        if (r){
+                            alert(JSON.stringify(r))
+                            return
+                        }
                     }
                 })
+                alert("操作成功")
             }
         }
 
@@ -260,10 +263,13 @@
                 async: false,
                 data: param,
                 success: function (r) {
-
-                    alert(JSON.stringify(r))
+                    if (r){
+                        alert(JSON.stringify(r))
+                        return
+                    }
                 }
             })
+            alert("操作成功")
         }
 
 

+ 1 - 1
utils/cost_by_left_num.go

@@ -124,7 +124,7 @@ func after(productType int, dataLen int, userProduct *model.UserProduct, statusC
 			orderAfter := userProduct.LeftNum - dataLen
 			nowStr := time.Now().Local().Format("2006-01-02 15:04:05")
 			//扣费
-			err := tx.Exec("update user_product set left_num = IF(`left_num`<1, 0, `left_num`-?),update_at = ? WHERE `app_id` = ? and product_id=?", nowStr, dataLen, appID, productID).Error
+			err := tx.Exec("update user_product set left_num = IF(`left_num`<1, 0, `left_num`-?),update_at = ? WHERE `app_id` = ? and product_id=?", dataLen, nowStr, appID, productID).Error
 			if err != nil {
 				log.Printf("appID:[%s],productID:[%d] execute cost money error:[%v]", appID, productID, err)
 				tx.Rollback()