Browse Source

Merge remote-tracking branch 'origin/master'

master
huangjiajun 6 days ago
parent
commit
be4db7e873
5 changed files with 22 additions and 17 deletions
  1. +2
    -0
      app/cfg/init_task.go
  2. +8
    -7
      app/task/svc/svc_egg_energy_deal_fund_data.go
  3. +8
    -7
      app/task/svc/svc_egg_energy_deal_platform_revenue_data.go
  4. +2
    -0
      cmd/task/main.go
  5. +2
    -3
      go.mod

+ 2
- 0
app/cfg/init_task.go View File

@@ -30,6 +30,8 @@ func InitTaskCfg() {
IMDB = &conf.ImDB IMDB = &conf.ImDB
Log = &conf.Log Log = &conf.Log
RedisAddr = conf.RedisAddr RedisAddr = conf.RedisAddr
MQ = &conf.MQ
ES = &conf.ES
} }


var MemCache mc.Cache var MemCache mc.Cache


+ 8
- 7
app/task/svc/svc_egg_energy_deal_fund_data.go View File

@@ -19,11 +19,18 @@ func EggEnergyDealFundData(eg *xorm.Engine) {
fmt.Println("egg_energy_deal_fund_data...") fmt.Println("egg_energy_deal_fund_data...")
defer func() { defer func() {
if err := recover(); err != nil { if err := recover(); err != nil {
fmt.Println(err)
fmt.Println("DealFundDataGetRabbitChannel_ERR:::::", err)
return return
} }
}() }()


ch, err := rabbit.Cfg.Pool.GetChannel()
if err != nil {
fmt.Println("DealFundDataGetRabbitChannel_ERR:::::", err.Error())
return
}
defer ch.Release()

// 悲观锁防止串行 // 悲观锁防止串行
getString, _ := cache.GetString(EggEnergyDealFundDataKey) getString, _ := cache.GetString(EggEnergyDealFundDataKey)
if getString != "" { if getString != "" {
@@ -41,12 +48,6 @@ func EggEnergyDealFundData(eg *xorm.Engine) {
return return
} }


ch, err := rabbit.Cfg.Pool.GetChannel()
if err != nil {
return
}
defer ch.Release()

now := time.Now() now := time.Now()
fundDataRecordsDb := implement.NewEggEnergyFundDataRecordsDb(eg) fundDataRecordsDb := implement.NewEggEnergyFundDataRecordsDb(eg)
for _, data := range fundDataList { for _, data := range fundDataList {


+ 8
- 7
app/task/svc/svc_egg_energy_deal_platform_revenue_data.go View File

@@ -19,11 +19,18 @@ func EggEnergyDealPlatformRevenueData(eg *xorm.Engine) {
fmt.Println("egg_energy_deal_platform_revenue_data...") fmt.Println("egg_energy_deal_platform_revenue_data...")
defer func() { defer func() {
if err := recover(); err != nil { if err := recover(); err != nil {
fmt.Println(err)
fmt.Println("EggEnergyDealPlatformRevenueDataGetRabbitChannel_ERR:::::", err)
return return
} }
}() }()


ch, err := rabbit.Cfg.Pool.GetChannel()
if err != nil {
fmt.Println("EggEnergyDealPlatformRevenueDataGetRabbitChannel_ERR:::::", err.Error())
return
}
defer ch.Release()

// 悲观锁防止串行 // 悲观锁防止串行
getString, _ := cache.GetString(EggEnergyDealPlatformRevenueDataKey) getString, _ := cache.GetString(EggEnergyDealPlatformRevenueDataKey)
if getString != "" { if getString != "" {
@@ -41,12 +48,6 @@ func EggEnergyDealPlatformRevenueData(eg *xorm.Engine) {
return return
} }


ch, err := rabbit.Cfg.Pool.GetChannel()
if err != nil {
return
}
defer ch.Release()

now := time.Now() now := time.Now()
recordsDb := implement.NewPlatformRevenueDataRecordsDb(eg) recordsDb := implement.NewPlatformRevenueDataRecordsDb(eg)
for _, data := range platformRevenueDataList { for _, data := range platformRevenueDataList {


+ 2
- 0
cmd/task/main.go View File

@@ -20,6 +20,8 @@ func init() {
cfg.InitLog() cfg.InitLog()
// 初始化redis // 初始化redis
cfg.InitCache() cfg.InitCache()
cfg.InitMq() // 队列初始化
cfg.InitEs() //ElasticSearch初始化
baseDb := *cfg.DB baseDb := *cfg.DB
baseDb.Path = fmt.Sprintf(cfg.DB.Path, cfg.DB.Name) baseDb.Path = fmt.Sprintf(cfg.DB.Path, cfg.DB.Name)
if err := db.InitDB(&baseDb); err != nil { if err := db.InitDB(&baseDb); err != nil {


+ 2
- 3
go.mod View File

@@ -16,7 +16,7 @@ require (
github.com/go-playground/universal-translator v0.18.1 github.com/go-playground/universal-translator v0.18.1
github.com/go-playground/validator/v10 v10.20.0 github.com/go-playground/validator/v10 v10.20.0
github.com/go-redis/redis v6.15.9+incompatible 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/jinzhu/copier v0.4.0
github.com/makiuchi-d/gozxing v0.0.0-20210324052758-57132e828831 github.com/makiuchi-d/gozxing v0.0.0-20210324052758-57132e828831
github.com/qiniu/api.v7/v7 v7.8.2 github.com/qiniu/api.v7/v7 v7.8.2
@@ -34,7 +34,7 @@ require (


require ( require (
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241211152610-0c5e1e903c99 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_es.git v1.0.1-0.20241118083738-0f22da9ba0be
code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5 code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5
github.com/360EntSecGroup-Skylar/excelize v1.4.1 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 v1.2.2
github.com/alibabacloud-go/tea-utils/v2 v2.0.6 github.com/alibabacloud-go/tea-utils/v2 v2.0.6
github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible 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-pay/gopay v1.5.98
github.com/go-sql-driver/mysql v1.8.1 github.com/go-sql-driver/mysql v1.8.1
github.com/gocolly/colly v1.2.0 github.com/gocolly/colly v1.2.0


Loading…
Cancel
Save