From 5784cf975b2c99b5aa2514fdc39828f31e5e4626 Mon Sep 17 00:00:00 2001 From: dengbiao Date: Thu, 5 Dec 2024 15:06:54 +0800 Subject: [PATCH] update --- app/task/init.go | 1 + app/task/md/cron_key.go | 1 + app/task/svc/svc_egg_energy_user_egg_score.go | 19 +++++++++++++++ app/task/task_egg_energy_user_egg_score.go | 23 +++++++++++++++++++ etc/cfg.yml | 10 +++++++- 5 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 app/task/svc/svc_egg_energy_user_egg_score.go create mode 100644 app/task/task_egg_energy_user_egg_score.go diff --git a/app/task/init.go b/app/task/init.go index 5ab28c8..7f7cc51 100644 --- a/app/task/init.go +++ b/app/task/init.go @@ -90,4 +90,5 @@ func initTasks() { jobs[taskMd.CronEggEnergyAutoRecordPrices] = taskEggEnergyAutoRecordPrices jobs[taskMd.CronEggEnergyDealPlatformRevenueData] = taskEggEnergyDealPlatformRevenueData jobs[taskMd.CronEggEnergyDealFundData] = taskEggEnergyDealFundData + jobs[taskMd.CronEggEnergyUserEggScore] = taskCronEggEnergyUserEggScore } diff --git a/app/task/md/cron_key.go b/app/task/md/cron_key.go index db00491..c91f852 100644 --- a/app/task/md/cron_key.go +++ b/app/task/md/cron_key.go @@ -4,4 +4,5 @@ const ( CronEggEnergyAutoRecordPrices = "cron_egg_energy_auto_record_price" // 自动记录价格 CronEggEnergyDealPlatformRevenueData = "cron_egg_energy_deal_platform_revenue_data" // 处理平台收益 CronEggEnergyDealFundData = "cron_egg_energy_deal_fund_data" // 处理价值投入 + CronEggEnergyUserEggScore = "cron_egg_energy_user_egg_score" // 处理蛋蛋分 ) diff --git a/app/task/svc/svc_egg_energy_user_egg_score.go b/app/task/svc/svc_egg_energy_user_egg_score.go new file mode 100644 index 0000000..712ed21 --- /dev/null +++ b/app/task/svc/svc_egg_energy_user_egg_score.go @@ -0,0 +1,19 @@ +package svc + +import ( + "fmt" + "xorm.io/xorm" +) + +// AutoScoreEggEnergyUserEggScore 自动给用户蛋蛋分打分 +func AutoScoreEggEnergyUserEggScore(engine *xorm.Engine) { + fmt.Println("auto_score_egg_energy_user_egg_score...") + defer func() { + if err := recover(); err != nil { + fmt.Println(err) + return + } + }() + + return +} diff --git a/app/task/task_egg_energy_user_egg_score.go b/app/task/task_egg_energy_user_egg_score.go new file mode 100644 index 0000000..1ffa59e --- /dev/null +++ b/app/task/task_egg_energy_user_egg_score.go @@ -0,0 +1,23 @@ +package task + +import ( + "applet/app/task/svc" + "math/rand" + "time" + "xorm.io/xorm" +) + +// 处理蛋蛋分 +func taskCronEggEnergyUserEggScore(eg *xorm.Engine) { + for { + if len(ch) > workerNum { + time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000))) + } else { + goto START + } + } +START: + ch <- 1 + svc.AutoScoreEggEnergyUserEggScore(eg) + <-ch +} diff --git a/etc/cfg.yml b/etc/cfg.yml index 48acc29..b9f5382 100644 --- a/etc/cfg.yml +++ b/etc/cfg.yml @@ -60,4 +60,12 @@ mq: es: url: 'http://120.55.48.175:9200' user: 'elastic' - pwd: 'fnuo123' \ No newline at end of file + pwd: 'fnuo123' + +im_business_rpc: + url: im-rpc-business.izhim.com + port: 1005 + +im_logic_rpc: + url: im-rpc-logic.izhim.com + port: 1008 \ No newline at end of file