From 04ee23549ee5355000a90a182524e53638dd9cab Mon Sep 17 00:00:00 2001 From: shenjiachi Date: Wed, 4 Dec 2024 17:55:56 +0800 Subject: [PATCH 1/2] update --- rule/egg_energy/md/mq_im.go | 7 ++++++- svc/svc_es.go | 10 +++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/rule/egg_energy/md/mq_im.go b/rule/egg_energy/md/mq_im.go index c9b16b1..de06bf5 100644 --- a/rule/egg_energy/md/mq_im.go +++ b/rule/egg_energy/md/mq_im.go @@ -3,7 +3,8 @@ package md const IMEggEnergyExchange = "im.egg.energy" const ( - IMEggEnergyRoutKeyForBatchSendMessageData = "batch_send_message_data" // 批量发送信息 + IMEggEnergyRoutKeyForBatchSendMessageData = "batch_send_message_data" // 批量发送信息 + IMEggEnergyRoutKeyForDelFriendCircleCommentData = "del_friend_circle_comment_data" // 删除朋友圈评论 ) type IMEggEnergyStructForBatchSendMessageData struct { @@ -13,3 +14,7 @@ type IMEggEnergyStructForBatchSendMessageData struct { ReceiveIMId int64 `json:"receive_id"` // 接受者IM id Content string `json:"content"` // 消息内容 } + +type IMEggEnergyStructForDelFriendCircleCommentData struct { + CommentIndexId string `json:"comment_index_id"` // 文章索引 +} diff --git a/svc/svc_es.go b/svc/svc_es.go index 7f2296c..d3cd09e 100644 --- a/svc/svc_es.go +++ b/svc/svc_es.go @@ -14,8 +14,16 @@ func GetEggFriendCircleCommentEsIndexId(userId int64, circleId string) string { return circleId + "_" + strconv.FormatInt(userId, 10) + "_" + egg_system_rules.Int64ToStr(time.Now().Unix()) } +func GetEggFriendCircleLikeEsIndex(userId int64) string { + return md.EggFriendCircleLikeEsIndex + GetUserIdSuffix(userId) +} +func GetEggFriendCircleLikeEsIndexId(userId int64, circleId string) string { + return circleId + "_" + strconv.FormatInt(userId, 10) +} + func GetUserIdSuffix(userId int64) string { numberStr := strconv.FormatInt(userId, 10) // 将数字转换为字符串 lastChar := numberStr[len(numberStr)-1] // 获取最后一个字符 - return strconv.Itoa(int(lastChar)) + //return strconv.Itoa(int(lastChar)) // 将 byte 类型的值隐式转换为 int + return string(lastChar) } From 09a6749b5f4402ebad1f3e8783d29a253ced254c Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Wed, 4 Dec 2024 18:06:52 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=A4=84=E7=90=86=E7=BB=99=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E9=87=91=E9=A2=9D=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rule/user_wallet.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rule/user_wallet.go b/rule/user_wallet.go index 00179c9..852070a 100644 --- a/rule/user_wallet.go +++ b/rule/user_wallet.go @@ -36,6 +36,7 @@ func DealUserWallet(session *xorm.Session, req md.DealUserWalletReq) (err error) return err } amountValue := decimal.NewFromFloat(req.Amount).RoundFloor(4) + beforeAmountValue, _ := decimal.NewFromString(userAmount) var userWalletFlow model.UserWalletFlow userWalletFlow.Uid = req.Uid @@ -47,10 +48,10 @@ func DealUserWallet(session *xorm.Session, req md.DealUserWalletReq) (err error) if req.Direction == "add" { userWalletFlow.Direction = 1 - userWalletFlow.AfterAmount = amountValue.Add(amountValue).RoundFloor(8).String() + userWalletFlow.AfterAmount = beforeAmountValue.Add(amountValue).RoundFloor(8).String() } else if req.Direction == "sub" { userWalletFlow.Direction = 2 - userWalletFlow.AfterAmount = amountValue.Sub(amountValue).RoundFloor(8).String() + userWalletFlow.AfterAmount = beforeAmountValue.Sub(amountValue).RoundFloor(8).String() if zhios_order_relate_utils.StrToFloat64(userWalletFlow.AfterAmount) < 0 { return errors.New("用户钱包余额不足") }