shenjiachi 3 тижднів тому
джерело
коміт
5e439665e2
2 змінених файлів з 28 додано та 4 видалено
  1. +19
    -1
      rule/egg_energy/activity_coin_auto_exchange_egg_energy.go
  2. +9
    -3
      rule/egg_energy/md/mq_egg_app.go

+ 19
- 1
rule/egg_energy/activity_coin_auto_exchange_egg_energy.go Переглянути файл

@@ -8,6 +8,7 @@ import (
"code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/md"
egg_system_rules "code.fnuoos.com/EggPlanet/egg_system_rules.git/utils"
zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_system_rules.git/utils/logx"
"code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit"
"fmt"
"github.com/shopspring/decimal"
"math/rand"
@@ -88,5 +89,22 @@ func ActivityCoinAutoExchangeEggPersonEnergy(engine *xorm.Engine, req md.EggEner
return err
}

return session.Commit()
err = session.Commit()
if err != nil {
session.Rollback()
return err
}

// 推入队列中异步处理
ch, err1 := rabbit.Cfg.Pool.GetChannel()
if err1 != nil {
return err1
}
defer ch.Release()
ch.Publish(md.EggEnergyExchange, egg_system_rules.SerializeStr(md.EggStructForRecordActiveData{
Uid: req.Uid,
TotalPersonEggPoints: sign.TotalPersonEggPoints,
}), md.EggRoutKeyForRecordActive)

return nil
}

+ 9
- 3
rule/egg_energy/md/mq_egg_app.go Переглянути файл

@@ -3,9 +3,10 @@ package md
const EggAppExchange = "egg.app"

const (
EggNewUserRegister = "egg_new_user_register" // 新用户注册
EggFinWithdrawApply = "egg_fin_withdraw_apply" // 提现申请
EggFinWithdrawApplyError = "egg_fin_deposit_apply_error"
EggNewUserRegister = "egg_new_user_register" // 新用户注册
EggFinWithdrawApply = "egg_fin_withdraw_apply" // 提现申请
EggFinWithdrawApplyError = "egg_fin_deposit_apply_error" // 提现申请异常队列
EggRoutKeyForRecordActive = "egg_record_active" // 更新活跃记录
)

type EggNewUserRegisterData struct {
@@ -37,3 +38,8 @@ type EggFinWithdrawApplyErrorData struct {
ErrorInfo string `json:"error_info"` // 错误信息
Ext []byte `json:"ext"` // 如果尝试解析失败,则将整个结构体放入
}

type EggStructForRecordActiveData struct {
Uid int64 `json:"uid"`
TotalPersonEggPoints string `json:"total_person_egg_points"` // 个人活跃积分
}

Завантаження…
Відмінити
Зберегти