@@ -8,6 +8,7 @@ import ( | |||||
"code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/md" | "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/md" | ||||
egg_system_rules "code.fnuoos.com/EggPlanet/egg_system_rules.git/utils" | 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" | 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" | "fmt" | ||||
"github.com/shopspring/decimal" | "github.com/shopspring/decimal" | ||||
"math/rand" | "math/rand" | ||||
@@ -88,5 +89,22 @@ func ActivityCoinAutoExchangeEggPersonEnergy(engine *xorm.Engine, req md.EggEner | |||||
return err | 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 | |||||
} | } |
@@ -3,9 +3,10 @@ package md | |||||
const EggAppExchange = "egg.app" | const EggAppExchange = "egg.app" | ||||
const ( | 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 { | type EggNewUserRegisterData struct { | ||||
@@ -37,3 +38,8 @@ type EggFinWithdrawApplyErrorData struct { | |||||
ErrorInfo string `json:"error_info"` // 错误信息 | ErrorInfo string `json:"error_info"` // 错误信息 | ||||
Ext []byte `json:"ext"` // 如果尝试解析失败,则将整个结构体放入 | Ext []byte `json:"ext"` // 如果尝试解析失败,则将整个结构体放入 | ||||
} | } | ||||
type EggStructForRecordActiveData struct { | |||||
Uid int64 `json:"uid"` | |||||
TotalPersonEggPoints string `json:"total_person_egg_points"` // 个人活跃积分 | |||||
} |