dengbiao преди 1 седмица
родител
ревизия
5784cf975b
променени са 5 файла, в които са добавени 53 реда и са изтрити 1 реда
  1. +1
    -0
      app/task/init.go
  2. +1
    -0
      app/task/md/cron_key.go
  3. +19
    -0
      app/task/svc/svc_egg_energy_user_egg_score.go
  4. +23
    -0
      app/task/task_egg_energy_user_egg_score.go
  5. +9
    -1
      etc/cfg.yml

+ 1
- 0
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
}

+ 1
- 0
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" // 处理蛋蛋分
)

+ 19
- 0
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
}

+ 23
- 0
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
}

+ 9
- 1
etc/cfg.yml Целия файл

@@ -60,4 +60,12 @@ mq:
es:
url: 'http://120.55.48.175:9200'
user: 'elastic'
pwd: 'fnuo123'
pwd: 'fnuo123'

im_business_rpc:
url: im-rpc-business.izhim.com
port: 1005

im_logic_rpc:
url: im-rpc-logic.izhim.com
port: 1008

Зареждане…
Отказ
Запис