diff --git a/consume/aliyun_sms_record_consume.go b/consume/aliyun_sms_record_consume.go index c3a530f..d401c9e 100644 --- a/consume/aliyun_sms_record_consume.go +++ b/consume/aliyun_sms_record_consume.go @@ -3,6 +3,7 @@ package consume import ( "applet/app/cfg" "applet/app/db" + "code.fnuoos.com/EggPlanet/egg_models.git/src/dao" "code.fnuoos.com/EggPlanet/egg_system_rules.git" utils2 "applet/app/utils" @@ -77,6 +78,12 @@ func handleAliyunSmsRecordConsume(msgData []byte) error { engine := db.Db redisConn := cache.GetPool().Get() sysCfgDb := implement.NewSysCfgDb(engine, redisConn) + defer func(sysCfgDb dao.SysCfgDao) { + err := sysCfgDb.Close() + if err != nil { + logx.Error("redis close err:" + err.Error()) // 记录错误信息 + } + }(sysCfgDb) aliyunSmsId := sysCfgDb.SysCfgGetWithDb("aliyun_sms_id") aliyunSmsSecret := sysCfgDb.SysCfgGetWithDb("aliyun_sms_secret") aliyunSmsSignName := sysCfgDb.SysCfgGetWithDb("aliyun_sms_sign_name") diff --git a/consume/egg_fin_withdraw_apply_consume.go b/consume/egg_fin_withdraw_apply_consume.go index fd5d6fe..9bd645b 100644 --- a/consume/egg_fin_withdraw_apply_consume.go +++ b/consume/egg_fin_withdraw_apply_consume.go @@ -7,6 +7,7 @@ import ( "applet/app/utils/cache" "applet/app/utils/logx" "applet/consume/md" + "code.fnuoos.com/EggPlanet/egg_models.git/src/dao" "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" @@ -158,6 +159,12 @@ type InitAlipayStruct struct { func InitAlipay(initData *InitAlipayStruct) (client *alipay.Client, err error) { if initData == nil { sysCfgDb := implement.NewSysCfgDb(db.Db, cache.GetPool().Get()) + defer func(sysCfgDb dao.SysCfgDao) { + err := sysCfgDb.Close() + if err != nil { + logx.Error("redis close err:" + err.Error()) // 记录错误信息 + } + }(sysCfgDb) sysCfgMap := sysCfgDb.SysCfgFindWithDb(enum.AlipayAppId, enum.AlipayPrivateKey, enum.AlipayPublicKey, enum.AlipayPublicContentRSA2, enum.AlipayRootContent, enum.AppPublicContent) initData = &InitAlipayStruct{ IsProd: true, diff --git a/consume/jpush_record_consume.go b/consume/jpush_record_consume.go index 96bf733..8df3295 100644 --- a/consume/jpush_record_consume.go +++ b/consume/jpush_record_consume.go @@ -3,6 +3,7 @@ package consume import ( "applet/app/cfg" "applet/app/db" + "code.fnuoos.com/EggPlanet/egg_models.git/src/dao" utils2 "applet/app/utils" "applet/app/utils/cache" @@ -78,6 +79,12 @@ func handleJpushRecordConsume(msgData []byte) error { engine := db.Db redisConn := cache.GetPool().Get() sysCfgDb := implement.NewSysCfgDb(engine, redisConn) + defer func(sysCfgDb dao.SysCfgDao) { + err := sysCfgDb.Close() + if err != nil { + logx.Error("redis close err:" + err.Error()) // 记录错误信息 + } + }(sysCfgDb) jpushKey := sysCfgDb.SysCfgGetWithDb("jpush_key") jpushSecret := sysCfgDb.SysCfgGetWithDb("jpush_secret") if msg.Target == "0" { //广播全部 diff --git a/consume/playlet_reward_consume.go b/consume/playlet_reward_consume.go index ea64ac6..f79ab63 100644 --- a/consume/playlet_reward_consume.go +++ b/consume/playlet_reward_consume.go @@ -5,6 +5,7 @@ import ( "applet/app/db" "applet/app/e" utils2 "applet/app/utils" + "code.fnuoos.com/EggPlanet/egg_models.git/src/dao" "code.fnuoos.com/EggPlanet/egg_system_rules.git" "code.fnuoos.com/EggPlanet/egg_system_rules.git/enum" md2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/md" @@ -89,6 +90,12 @@ func handlePlayletRewardConsume(ch *rabbit.Channel, msgData []byte) error { eg := db.Db redisConn := cache.GetPool().Get() sysCfgDb := implement.NewSysCfgDb(eg, redisConn) + defer func(sysCfgDb dao.SysCfgDao) { + err := sysCfgDb.Close() + if err != nil { + logx.Error("redis close err:" + err.Error()) // 记录错误信息 + } + }(sysCfgDb) playletBase := sysCfgDb.SysCfgGetWithDb("playlet_base") sess := eg.NewSession() defer sess.Close() diff --git a/consume/video_reward_consume.go b/consume/video_reward_consume.go index d7a2f2c..a5125ef 100644 --- a/consume/video_reward_consume.go +++ b/consume/video_reward_consume.go @@ -8,6 +8,7 @@ import ( "applet/app/utils/cache" "applet/app/utils/logx" "applet/consume/md" + "code.fnuoos.com/EggPlanet/egg_models.git/src/dao" "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" @@ -88,6 +89,12 @@ func handleVideoRewardConsume(ch *rabbit.Channel, msgData []byte) error { eg := db.Db redisConn := cache.GetPool().Get() sysCfgDb := implement.NewSysCfgDb(eg, redisConn) + defer func(sysCfgDb dao.SysCfgDao) { + err := sysCfgDb.Close() + if err != nil { + logx.Error("redis close err:" + err.Error()) // 记录错误信息 + } + }(sysCfgDb) videoBase := sysCfgDb.SysCfgGetWithDb("video_base") sess := eg.NewSession() defer sess.Close() diff --git a/go.mod b/go.mod index 672d24e..53ed52f 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ go 1.19 // replace code.fnuoos.com/EggPlanet/egg_system_rules.git => E:/company/Egg/egg_system_rules require ( - code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241210121211-81406596ad48 + code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241211055111-7c47b67b46d2 code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241210121337-7d0f83ee12bc code.fnuoos.com/go_rely_warehouse/zyos_go_es.git v1.0.1-0.20241118083738-0f22da9ba0be code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5