Pārlūkot izejas kodu

update

withdrawal
dengbiao pirms 3 dienas
vecāks
revīzija
49b8061a42
1 mainītis faili ar 38 papildinājumiem un 32 dzēšanām
  1. +38
    -32
      consume/add_public_platoon_user_relation_commission.go

+ 38
- 32
consume/add_public_platoon_user_relation_commission.go Parādīt failu

@@ -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


Notiek ielāde…
Atcelt
Saglabāt