From 87d5e7a2be6b6d5c0db7300422bb2c13860f7005 Mon Sep 17 00:00:00 2001 From: hujiebin Date: Mon, 21 Aug 2023 14:34:28 +0800 Subject: [PATCH] accountId --- script/race_day_award.go | 4 ++-- txop/diamond_tx/diamond.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/script/race_day_award.go b/script/race_day_award.go index bc1ee98..6982024 100644 --- a/script/race_day_award.go +++ b/script/race_day_award.go @@ -45,7 +45,7 @@ func ats33(a interface{}) string { } func main() { - url := "https://apiv2.faceline.live/v1/race/rank/award?lang=zh-cn&pageIndex=1&pageSize=50000&beginDate=2023-08-18&endDate=2023-08-18&userCode=&timezone=1" + url := "https://apiv2.faceline.live/v1/race/rank/award?lang=zh-cn&pageIndex=1&pageSize=50000&beginDate=2023-08-20&endDate=2023-08-20&userCode=&timezone=1" method := "GET" client := &http.Client{} @@ -99,7 +99,7 @@ func main() { for _, v := range svips { svipMap[v.Code] = v.Level } - excelFileName := fmt.Sprintf("./0818赛车中奖榜.xlsx") + excelFileName := fmt.Sprintf("./0820赛车中奖榜.xlsx") xlFile := xlsx.NewFile() sheet, _ := xlFile.AddSheet("charge") row := sheet.AddRow() diff --git a/txop/diamond_tx/diamond.go b/txop/diamond_tx/diamond.go index 7954ad0..7a85bc4 100644 --- a/txop/diamond_tx/diamond.go +++ b/txop/diamond_tx/diamond.go @@ -102,10 +102,10 @@ func TxAddReduceDiamondAccount(model *domain.Model, userId mysql.ID, operateType var db *gorm.DB if diamondOperateSet.AddReduce == mysql.ADD { //增加 - db = model.DB().Model(diamond_m.DiamondAccount{}).UpdateColumn("diamond_num", gorm.Expr("diamond_num + ?", diamondNum)) + db = model.DB().Model(diamond_m.DiamondAccount{}).Where("id = ?", diamondAccount.ID).UpdateColumn("diamond_num", gorm.Expr("diamond_num + ?", diamondNum)) } else if diamondOperateSet.AddReduce == mysql.REDUCE { //减少,保证不能扣成负数 - db = model.DB().Model(diamond_m.DiamondAccount{}).Where("diamond_num >= ?", diamondNum).UpdateColumn("diamond_num", gorm.Expr("diamond_num - ?", diamondNum)) + db = model.DB().Model(diamond_m.DiamondAccount{}).Where("id = ?", diamondAccount.ID).Where("diamond_num >= ?", diamondNum).UpdateColumn("diamond_num", gorm.Expr("diamond_num - ?", diamondNum)) } else { return myerr.NewSysErrorF("addReduce 枚举错误 value:", diamondOperateSet.AddReduce) } -- 2.22.0