Kaynağa Gözat

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

xuzhiheng 4 yıl önce
ebeveyn
işleme
19649b89ea

+ 4 - 4
service/userRecharge.go

@@ -1,7 +1,6 @@
 package service
 
 import (
-	"fmt"
 	"github.com/gin-gonic/gin"
 	"gorm.io/gorm"
 	"log"
@@ -22,18 +21,20 @@ func MoneyRecharge(appid string, money int, remark string) error {
 	//查用户当前余额
 	userAccount := &model.UserAccount{}
 	db.GetSFISDB().First(userAccount, &model.UserAccount{AppID: appid})
+	// 更新时间
+	nowStr := time.Now().Local().Format("2006-01-02 15:04:05")
 	errs := db.GetSFISDB().Transaction(func(tx *gorm.DB) error {
 		moneyBefore := userAccount.Money
 		moneyAfter := userAccount.Money + money
 		//充值
-		err := tx.Exec("update user_account set money = ? WHERE `app_id` = ?", moneyAfter, appid).Error
+		err := tx.Exec("update user_account set money = ?,update_at = ? WHERE `app_id` = ?", moneyAfter, nowStr,appid).Error
 		if err != nil {
 			log.Printf("appID:[%s],money:[%d] execute cost user_account error:[%v]", appid, moneyAfter, err)
 			tx.Rollback()
 			return err
 		}
 		//生充值记录
-		err = tx.Exec("insert into user_money_record (app_id,`before`,`after`,trade_money,remark) values (?,?,?,?,?)", appid, moneyBefore, moneyAfter, money, remark).Error
+		err = tx.Exec("insert into user_money_record (app_id,`before`,`after`,trade_money,remark,create_at) values (?,?,?,?,?,?)", appid, moneyBefore, moneyAfter, money, remark,nowStr).Error
 		if err != nil {
 			log.Printf("appID:[%s],trade_money:[%d] execute insert into user_money_record error:[%v]", appid, money, err)
 			tx.Rollback()
@@ -53,7 +54,6 @@ func ProductRecharge(appid string, productId, rechargeNum int, startTime string,
 	defer userLock.Unlock()
 
 	//查用户当前剩余量
-	fmt.Println(startTime, endTime)
 	userProduct := &model.UserProduct{}
 	db.GetSFISDB().First(userProduct, &model.UserProduct{AppID: appid, ProductID: productId})
 	product := &model.Product{}

+ 1 - 0
static/templates/projectList.html

@@ -14,6 +14,7 @@
         <input type="text" id="bidTime" placeholder="请输入中标日期">
         <button type="button" id="projectListBtn">提交</button>
     </div>
+    <div id="resultContent"></div>
     <div id="tableDiv" hidden>
         <table border="0" id="tableId">
             <thead>

+ 1 - 0
utils/api_util.go

@@ -69,6 +69,7 @@ func Check(appID string, productID int, c *gin.Context, getData func() ([]map[st
 		Exists, _ := redis.Exists("limit", limitrate)
 		if Exists {
 			response.FailWithDetailed(response.CallRate, nil, "请求频率过快,请稍后重试", c)
+			return
 		}
 	}
 	//2.2 取用户(产品余量|钱包账户余额)校验-必须加锁