diff --git a/consume/add_public_platoon_user_relation_commission.go b/consume/add_public_platoon_user_relation_commission.go index 28d7114..2d96ed3 100644 --- a/consume/add_public_platoon_user_relation_commission.go +++ b/consume/add_public_platoon_user_relation_commission.go @@ -7,7 +7,6 @@ import ( "applet/app/utils/logx" "applet/consume/md" "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" - "code.fnuoos.com/EggPlanet/egg_models.git/src/model" "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" @@ -77,44 +76,39 @@ func handleAddPublicPlatoonUserRelationCommissionConsume(msgData []byte) error { } //2、给到直推奖励 - //TODO::判断是否签到过 - var eggSignIn model.EggSignIn - has, _ := db.Db.Where("uid =?", msg.Uid).Get(&eggSignIn) - if has { - 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 { - userDeleteInfoDb := implement.NewUserDeleteInfoDb(db.Db) - fmt.Println("userDelete>>>>>>>>>>>>>>>", msg.Phone) - userDelete := userDeleteInfoDb.GetUserDeleteInfo(msg.Phone) - fmt.Println("userDelete>>>>>>>>>>>>>>>", userDelete) - if userDelete == 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() + 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 { + userDeleteInfoDb := implement.NewUserDeleteInfoDb(db.Db) + fmt.Println("userDelete>>>>>>>>>>>>>>>", msg.Phone) + userDelete := userDeleteInfoDb.GetUserDeleteInfo(msg.Phone) + fmt.Println("userDelete>>>>>>>>>>>>>>>", userDelete) + if userDelete == 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() } } return nil diff --git a/consume/egg_energy_auto_exchange_green_energy.go b/consume/egg_energy_auto_exchange_green_energy.go index 7e9a2f3..ba3bac6 100644 --- a/consume/egg_energy_auto_exchange_green_energy.go +++ b/consume/egg_energy_auto_exchange_green_energy.go @@ -3,7 +3,6 @@ package consume import ( "applet/app/cfg" "applet/app/db" - md4 "applet/app/md" utils2 "applet/app/utils" "applet/app/utils/logx" "applet/consume/md" @@ -37,7 +36,7 @@ func EggEnergyAutoExchangeGreenEnergyConsume(queue md.MqQueue) { for { res, ok = <-delivery if ok == true { - err = handleEggEnergyAutoExchangeGreenEnergyConsume(res.Body, ch) + err = handleEggEnergyAutoExchangeGreenEnergyConsume(res.Body) if err != nil { fmt.Println("EggEnergyAutoExchangeGreenEnergyConsume_ERR:::::", err.Error()) utils2.FilePutContents("EggEnergyAutoExchangeGreenEnergyConsume_ERR", utils2.SerializeStr(map[string]interface{}{ @@ -56,7 +55,7 @@ func EggEnergyAutoExchangeGreenEnergyConsume(queue md.MqQueue) { fmt.Println("get msg done") } -func handleEggEnergyAutoExchangeGreenEnergyConsume(msgData []byte, ch *rabbit.Channel) error { +func handleEggEnergyAutoExchangeGreenEnergyConsume(msgData []byte) error { //1、解析mq中queue的数据结构体 var msg *md2.EggEnergyStructForAutoExchangeGreenEnergy err := json.Unmarshal(msgData, &msg) @@ -67,12 +66,5 @@ func handleEggEnergyAutoExchangeGreenEnergyConsume(msgData []byte, ch *rabbit.Ch //2、调用制度方法 err = egg_energy.ActivityCoinAutoExchangeEggPersonEnergy(engine, *msg) - if err != nil { - return err - } - //3、给到直推奖励 - ch.Publish(md2.EggEnergyExchange, md4.EggEnergyRecruitNewUserRewardMq{ - Uid: msg.Uid, - }, "egg_energy_recruit_new_user_reward") - return nil + return err } diff --git a/consume/init.go b/consume/init.go index 8b2ab7b..a880818 100644 --- a/consume/init.go +++ b/consume/init.go @@ -58,7 +58,7 @@ func initConsumes() { jobs[consumeMd.EggEnergySettlementPublicGiveActivityCoinFunName] = EggEnergySettlementPublicGiveActivityCoinConsume jobs[consumeMd.EggEnergyStartExchangeGreenEnergyFunName] = EggEnergyStartExchangeGreenEnergyConsume jobs[consumeMd.EggEnergyAutoExchangeGreenEnergyFunName] = EggEnergyAutoExchangeGreenEnergyConsume - jobs[consumeMd.EggEnergyRecruitNewUserRewardFunName] = EggEnergyRecruitNewUserRewardConsume + //jobs[consumeMd.EggEnergyRecruitNewUserRewardFunName] = EggEnergyRecruitNewUserRewardConsume //TODO::废弃 jobs[consumeMd.EggEnergyTeamAssistanceConsumeFunName] = EggEnergyTeamAssistanceConsume // 更新团队助力数据 jobs[consumeMd.EggCanalUserVirtualCoinFlowAggregationConsumeFunName] = EggCanalUserVirtualCoinFlowAggregationConsume // 聚合流水数据