Переглянути джерело

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

jiaojiao7 4 роки тому
батько
коміт
97c008a83f
3 змінених файлів з 13 додано та 6 видалено
  1. 1 1
      service/callLog.go
  2. 5 5
      service/user.go
  3. 7 0
      static/templates/login.html

+ 1 - 1
service/callLog.go

@@ -31,7 +31,7 @@ func CallLog(appid, productId, startTime, endTime string, isSelf bool) ([]map[st
 	}
 	whereSql := strings.Join(key, " and ")
 	userCallRecord := []model.UserCallRecord{}
-	err := db.GetSFISDB().Where(whereSql, param...).Where("app_id = ? ", appid).Order("create_at desc").Find(&userCallRecord).Error
+	err := db.GetSFISDB().Where(whereSql, param...).Where("app_id = ? ", appid).Order("id desc").Find(&userCallRecord).Error
 	if err != nil {
 		return nil, err
 	} else {

+ 5 - 5
service/user.go

@@ -3,20 +3,20 @@ package service
 import (
 	"errors"
 	"fmt"
-	"github.com/gin-gonic/gin"
-	"go.uber.org/zap"
-	"gorm.io/gorm"
 	"log"
 	"sfbase/global"
 	"sfbase/utils"
 	"sfis/db"
 	"sfis/lock"
 	"sfis/model"
+	utils2 "sfis/utils"
 	"strconv"
 	"strings"
 	"sync"
-	utils2 "sfis/utils"
 
+	"github.com/gin-gonic/gin"
+	"go.uber.org/zap"
+	"gorm.io/gorm"
 )
 
 func CreateUserProduct(appId string, productArr []map[string]interface{}) (status int, haveProductId string, errArr []error) {
@@ -67,7 +67,7 @@ func CreateUserProduct(appId string, productArr []map[string]interface{}) (statu
 }
 
 func UserProductList(appId string, c *gin.Context) (results []map[string]interface{}, err error) {
-	err = db.GetSFISDB().Table("user_product").Select("user_product.app_id, user_product.product_id,user_product.create_at,user_product.start_at,user_product.end_at,user_product.left_num,user_product.cost_model,user_product.interface_status,user_product.call_times_limit_day,user_product.data_num_limit_one_times,product.name").Joins("left join product on product.id = user_product.product_id").Where("app_id = ? ", appId).Scan(&results).Error
+	err = db.GetSFISDB().Table("user_product").Select("user_product.app_id,user_product.discount,user_product.product_id,user_product.create_at,user_product.start_at,user_product.end_at,user_product.left_num,user_product.cost_model,user_product.interface_status,user_product.call_times_limit_day,user_product.data_num_limit_one_times,product.name").Joins("left join product on product.id = user_product.product_id").Where("app_id = ? ", appId).Scan(&results).Error
 	if err != nil {
 		log.Printf("appID:[%s] find into user_product error:[%v]", appId, err)
 	}

+ 7 - 0
static/templates/login.html

@@ -87,6 +87,7 @@
                     <th style="width: 5%">状态</th>
                     <th style="width: 10%">每日调用次数</th>
                     <th style="width: 10%">单次返回数量</th>
+                    <th style="width: 5%">折扣</th>
                     <th style="width: 25%">操作</th>
                 </tr>
                 </thead>
@@ -186,6 +187,12 @@
                                 }
                                 str += "<td>" + item.call_times_limit_day + "</td>";
                                 str += "<td>" + item.data_num_limit_one_times + "</td>";
+                                if (item.discount > 0 && item.discount < 10) {
+                                    str += "<td>" + item.discount + " 折</td>";
+                                }else{
+                                    str += "<td>无</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) {