From 31a7247337789d011cd109195e3e600557a46b30 Mon Sep 17 00:00:00 2001 From: lwl0608 Date: Tue, 19 Mar 2024 16:21:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/mix/service/logic/vas.go | 2 +- app/mix/service/vasservice.go | 4 ++-- bizcommon/util/util.go | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/mix/service/logic/vas.go b/app/mix/service/logic/vas.go index 3def33fe..cc61f18d 100644 --- a/app/mix/service/logic/vas.go +++ b/app/mix/service/logic/vas.go @@ -2797,7 +2797,7 @@ func (v *Vas) refundContactWechat(ctx *gin.Context, order *dbstruct.CoinOrder, r } // 给用户加回金币 - err = v.store.IncCoins(ctx, tx, mid, costCh.GetChange()) + err = v.store.IncCoins(ctx, tx, mid, util.AbsInt64(costCh.GetMid())) if err != nil { logger.Error("IncCoins fail, mid: %v, change: %v, err: %v", mid, costCh.GetChange(), err) return err diff --git a/app/mix/service/vasservice.go b/app/mix/service/vasservice.go index 7293dabd..ee0fdbd1 100644 --- a/app/mix/service/vasservice.go +++ b/app/mix/service/vasservice.go @@ -317,10 +317,10 @@ func (s *Service) chListIncome(ctx *gin.Context, chList []*dbstruct.ConsumeHisto item.Change = changeMark + fmt.Sprintf("%d钻石", chDB.GetChange()) case dbstruct.CHSTypeIncomeRefundMembership: item.Desc = "用户会员退款" - item.Change = changeMark + fmt.Sprintf("%d钻石", chDB.GetChange()) + item.Change = fmt.Sprintf("%d钻石", chDB.GetChange()) case dbstruct.CHSTypeIncomeRefundContactWechat: item.Desc = "用户微信退款" - item.Change = changeMark + fmt.Sprintf("%d钻石", chDB.GetChange()) + item.Change = fmt.Sprintf("%d钻石", chDB.GetChange()) } list = append(list, item) } diff --git a/bizcommon/util/util.go b/bizcommon/util/util.go index 432655ca..48b2fee1 100644 --- a/bizcommon/util/util.go +++ b/bizcommon/util/util.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" "io" + "math" "math/rand" "reflect" "service/library/logger" @@ -135,3 +136,7 @@ func UnescapeJsonStr(s string) string { s = strings.ReplaceAll(s, "\\u0026", "&") return s } + +func AbsInt64(x int64) int64 { + return int64(math.Abs(float64(x))) +}