From 7af1391a64b461a179c2fcf8ed6480f91a2e19a2 Mon Sep 17 00:00:00 2001 From: dengbiao Date: Thu, 19 Dec 2024 12:40:01 +0800 Subject: [PATCH] update --- ...public_platoon_user_relation_commission.go | 35 +++++++++++++++++++ go.mod | 2 +- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/consume/add_public_platoon_user_relation_commission.go b/consume/add_public_platoon_user_relation_commission.go index d60302b..0dea19f 100644 --- a/consume/add_public_platoon_user_relation_commission.go +++ b/consume/add_public_platoon_user_relation_commission.go @@ -6,7 +6,10 @@ import ( "applet/app/utils" "applet/app/utils/logx" "applet/consume/md" + "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" "code.fnuoos.com/EggPlanet/egg_system_rules.git" + "code.fnuoos.com/EggPlanet/egg_system_rules.git/enum" + md3 "code.fnuoos.com/EggPlanet/egg_system_rules.git/md" "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule" md2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/md" "code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit" @@ -63,6 +66,38 @@ func handleAddPublicPlatoonUserRelationCommissionConsume(msgData []byte) error { return err } + //2、给到直推奖励 + eggEnergyBasicSettingDb := implement.NewEggEnergyBasicSettingDb(db.Db) + eggEnergyBasicSetting, err := eggEnergyBasicSettingDb.EggEnergyBasicSettingGetOneByParams(map[string]interface{}{ + "key": "is_open", + "value": 1, + }) + if err != nil { + return err + } + if eggEnergyBasicSetting != nil { + var newUserRewardRules *md2.NewUserRewardRules + err = json.Unmarshal([]byte(eggEnergyBasicSetting.NewUserIncentiveRules), &newUserRewardRules) + if err != nil { + fmt.Println("handleAddPublicPlatoonUserRelationCommissionConsume___ERR>>>>", err.Error()) + } + rewardValue := newUserRewardRules.InviteUserRewardValue + session := db.Db.NewSession() + err = rule.DealUserVirtualCoin(session, md3.DealUserVirtualCoinReq{ + Kind: "add", + Title: enum.UserVirtualAmountFlowTransferType.String(enum.EggEnergyRecruitNewUsersReward), + TransferType: int(enum.EggEnergyRecruitNewUsersReward), + CoinId: eggEnergyBasicSetting.PersonEggPointsCoinId, + Uid: utils.StrToInt64(msg.RecommendUid), + Amount: float64(rewardValue), + }) + if err != nil { + return err + } + session.Commit() + } + + //3、加入公排 var req []*md2.AddPublicPlatoonUserRelationCommissionReq req = append(req, msg) _, err = rule.AddPublicPlatoonUserRelationCommission(db.Db, req) diff --git a/go.mod b/go.mod index 7ae632b..9468ccf 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ go 1.19 require ( code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241214095356-fdac2df9537f - code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241217150733-f7877f8f1d5c + code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241219043645-3f6b3590ae75 code.fnuoos.com/go_rely_warehouse/zyos_go_es.git v1.0.1-0.20241118083738-0f22da9ba0be code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5 github.com/boombuler/barcode v1.0.1