diff --git a/app/cfg/init_task.go b/app/cfg/init_task.go index 2a049fd..eff3e96 100644 --- a/app/cfg/init_task.go +++ b/app/cfg/init_task.go @@ -30,6 +30,8 @@ func InitTaskCfg() { IMDB = &conf.ImDB Log = &conf.Log RedisAddr = conf.RedisAddr + MQ = &conf.MQ + ES = &conf.ES } var MemCache mc.Cache diff --git a/app/task/svc/svc_egg_energy_deal_fund_data.go b/app/task/svc/svc_egg_energy_deal_fund_data.go index 48a494f..a0ffb7d 100644 --- a/app/task/svc/svc_egg_energy_deal_fund_data.go +++ b/app/task/svc/svc_egg_energy_deal_fund_data.go @@ -19,11 +19,18 @@ func EggEnergyDealFundData(eg *xorm.Engine) { fmt.Println("egg_energy_deal_fund_data...") defer func() { if err := recover(); err != nil { - fmt.Println(err) + fmt.Println("DealFundDataGetRabbitChannel_ERR:::::", err) return } }() + ch, err := rabbit.Cfg.Pool.GetChannel() + if err != nil { + fmt.Println("DealFundDataGetRabbitChannel_ERR:::::", err.Error()) + return + } + defer ch.Release() + // 悲观锁防止串行 getString, _ := cache.GetString(EggEnergyDealFundDataKey) if getString != "" { @@ -41,12 +48,6 @@ func EggEnergyDealFundData(eg *xorm.Engine) { return } - ch, err := rabbit.Cfg.Pool.GetChannel() - if err != nil { - return - } - defer ch.Release() - now := time.Now() fundDataRecordsDb := implement.NewEggEnergyFundDataRecordsDb(eg) for _, data := range fundDataList { diff --git a/app/task/svc/svc_egg_energy_deal_platform_revenue_data.go b/app/task/svc/svc_egg_energy_deal_platform_revenue_data.go index 541deca..a3a875e 100644 --- a/app/task/svc/svc_egg_energy_deal_platform_revenue_data.go +++ b/app/task/svc/svc_egg_energy_deal_platform_revenue_data.go @@ -19,11 +19,18 @@ func EggEnergyDealPlatformRevenueData(eg *xorm.Engine) { fmt.Println("egg_energy_deal_platform_revenue_data...") defer func() { if err := recover(); err != nil { - fmt.Println(err) + fmt.Println("EggEnergyDealPlatformRevenueDataGetRabbitChannel_ERR:::::", err) return } }() + ch, err := rabbit.Cfg.Pool.GetChannel() + if err != nil { + fmt.Println("EggEnergyDealPlatformRevenueDataGetRabbitChannel_ERR:::::", err.Error()) + return + } + defer ch.Release() + // 悲观锁防止串行 getString, _ := cache.GetString(EggEnergyDealPlatformRevenueDataKey) if getString != "" { @@ -41,12 +48,6 @@ func EggEnergyDealPlatformRevenueData(eg *xorm.Engine) { return } - ch, err := rabbit.Cfg.Pool.GetChannel() - if err != nil { - return - } - defer ch.Release() - now := time.Now() recordsDb := implement.NewPlatformRevenueDataRecordsDb(eg) for _, data := range platformRevenueDataList { diff --git a/cmd/task/main.go b/cmd/task/main.go index e6daccb..fb39639 100644 --- a/cmd/task/main.go +++ b/cmd/task/main.go @@ -20,6 +20,8 @@ func init() { cfg.InitLog() // 初始化redis cfg.InitCache() + cfg.InitMq() // 队列初始化 + cfg.InitEs() //ElasticSearch初始化 baseDb := *cfg.DB baseDb.Path = fmt.Sprintf(cfg.DB.Path, cfg.DB.Name) if err := db.InitDB(&baseDb); err != nil { diff --git a/go.mod b/go.mod index 57808ac..b7a1ed0 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/go-playground/universal-translator v0.18.1 github.com/go-playground/validator/v10 v10.20.0 github.com/go-redis/redis v6.15.9+incompatible - github.com/gomodule/redigo v2.0.0+incompatible + github.com/gomodule/redigo v1.9.2 github.com/jinzhu/copier v0.4.0 github.com/makiuchi-d/gozxing v0.0.0-20210324052758-57132e828831 github.com/qiniu/api.v7/v7 v7.8.2 @@ -34,7 +34,7 @@ require ( require ( code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241211152610-0c5e1e903c99 - code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241211143147-17b736995b8f + code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241212100929-af11a5e94a68 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 github.com/360EntSecGroup-Skylar/excelize v1.4.1 @@ -44,7 +44,6 @@ require ( github.com/alibabacloud-go/tea v1.2.2 github.com/alibabacloud-go/tea-utils/v2 v2.0.6 github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible - github.com/gin-contrib/sessions v1.0.1 github.com/go-pay/gopay v1.5.98 github.com/go-sql-driver/mysql v1.8.1 github.com/gocolly/colly v1.2.0