dengbiao 3 päivää sitten
vanhempi
commit
7c90a39f0c
3 muutettua tiedostoa jossa 36 lisäystä ja 50 poistoa
  1. +32
    -38
      consume/add_public_platoon_user_relation_commission.go
  2. +3
    -11
      consume/egg_energy_auto_exchange_green_energy.go
  3. +1
    -1
      consume/init.go

+ 32
- 38
consume/add_public_platoon_user_relation_commission.go Näytä tiedosto

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


+ 3
- 11
consume/egg_energy_auto_exchange_green_energy.go Näytä tiedosto

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

+ 1
- 1
consume/init.go Näytä tiedosto

@@ -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 // 聚合流水数据


Ladataan…
Peruuta
Tallenna