From 49b8061a420870d04b0312810ae704a296625282 Mon Sep 17 00:00:00 2001 From: dengbiao Date: Mon, 6 Jan 2025 19:10:28 +0800 Subject: [PATCH] update --- ...public_platoon_user_relation_commission.go | 70 ++++++++++--------- 1 file changed, 38 insertions(+), 32 deletions(-) diff --git a/consume/add_public_platoon_user_relation_commission.go b/consume/add_public_platoon_user_relation_commission.go index 2d96ed3..28d7114 100644 --- a/consume/add_public_platoon_user_relation_commission.go +++ b/consume/add_public_platoon_user_relation_commission.go @@ -7,6 +7,7 @@ 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" @@ -76,39 +77,44 @@ func handleAddPublicPlatoonUserRelationCommissionConsume(msgData []byte) error { } //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 { - 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 + //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() } - session.Commit() } } return nil