Browse Source

updaste

master
dengbiao 6 days ago
parent
commit
1993e0e37d
5 changed files with 22 additions and 4 deletions
  1. +8
    -0
      md/es.go
  2. +4
    -0
      rule/egg_energy/create_es_score_and_assign_value.go
  3. +2
    -0
      rule/egg_energy/enum/es_egg_energy_score_enum.go
  4. +4
    -1
      rule/egg_energy/give_activty_coin.go
  5. +4
    -3
      utils/es/base.go

+ 8
- 0
md/es.go View File

@@ -30,6 +30,12 @@ const EggEnergyUserEggScoreEsMapping = `
"ecpm":{
"type": "double"
},
"ecpm_avg":{
"type": "double"
},
"ecpm_nums":{
"type": "integer"
},
"invite_user_nums":{
"type": "integer"
},
@@ -86,6 +92,8 @@ type EggEnergyUserEggScoreEs struct {
ScoreValue float64 `json:"score_value" label:"蛋蛋分值"`
ScoreValueKind int32 `json:"score_value_kind" label:"评分类型(0:未知 1:人工 2:系统)"`
Ecpm float64 `json:"ecpm" label:"ecpm"`
EcpmAvg float64 `json:"ecpm_avg" label:"ecpm平均值"`
EcpmNums int `json:"ecpm_nums" label:"ecpm次数"`
InviteUserNums int `json:"invite_user_nums" label:"拉新人数"`
TeamActivityNums int `json:"team_activity_nums" label:"团队活跃次数"`
SignInNums int `json:"sign_in_nums" label:"签到次数"`


+ 4
- 0
rule/egg_energy/create_es_score_and_assign_value.go View File

@@ -21,6 +21,10 @@ func CreateEsScoreAndAssignValuesDoc(index, id string, uid int64, kind enum.EggE
m.ScoreValueKind = int32(utils.StrToInt64(value))
case enum.Ecpm:
m.Ecpm = utils.StrToFloat64(value)
case enum.EcpmAvg:
m.EcpmAvg = utils.StrToFloat64(value)
case enum.EcpmNums:
m.EcpmNums = utils.StrToInt(value)
case enum.InviteUserNums:
m.InviteUserNums = utils.StrToInt(value)
case enum.TeamActivityNums:


+ 2
- 0
rule/egg_energy/enum/es_egg_energy_score_enum.go View File

@@ -7,6 +7,8 @@ const (
ScoreValue = iota + 1
ScoreValueKind
Ecpm
EcpmAvg
EcpmNums
InviteUserNums
TeamActivityNums
SignInNums


+ 4
- 1
rule/egg_energy/give_activty_coin.go View File

@@ -107,7 +107,7 @@ func SettlementGiveActivityCoin(engine *xorm.Engine, user model.User, ecpm strin
rewardValue *= newUserRewardRules.RewardCoefficient
}

score := 60.00
var score float64
esIndex := es.GetLatestEffectiveIndexFromAlias(now)
esIndexName := md.EggEnergyUserEggScoreEsAlias + "_" + esIndex
results, err1 := es2.FirstDoc(esIndexName, esIndex+"_"+egg_system_rules.Int64ToStr(user.Id))
@@ -124,6 +124,9 @@ func SettlementGiveActivityCoin(engine *xorm.Engine, user model.User, ecpm strin
}
score = doc.ScoreValue
}
if score == 0 {
score = 60.00
}
fmt.Println("SettlementGiveActivityCoin:e:", egg_system_rules.Int64ToStr(user.Id)+":"+ecpm+":", time.Since(now))

eggPointPartitionCoefficientManagementDb := implement.NewEggPointPartitionCoefficientManagementDb(engine)


+ 4
- 3
utils/es/base.go View File

@@ -18,7 +18,8 @@ func GetAppointIndexFromAlias(year string, week string) string {
// GetLatestEffectiveIndexFromAlias 获取最新有效别名
// TODO::临时默认全是60分
func GetLatestEffectiveIndexFromAlias(now time.Time) string {
if now.Weekday() > time.Wednesday || (now.Weekday() > time.Wednesday && now.Hour() > 14) {
//if now.Weekday() > time.Wednesday || (now.Weekday() > time.Wednesday && now.Hour() > 14) {
if now.Weekday() > time.Friday || (now.Weekday() > time.Friday && now.Hour() > 14) {
// 当前已经过了周三下午两点 返回上周蛋蛋分
now = now.AddDate(0, 0, -7*2)
} else {
@@ -30,8 +31,8 @@ func GetLatestEffectiveIndexFromAlias(now time.Time) string {
}

func GetLatestEffectiveIndexFromAliasForAdmin(now time.Time) string {
if !(now.Weekday() > time.Tuesday || (now.Weekday() > time.Tuesday && now.Hour() > 18)) {
// 没过周三下午两点 返回上周蛋蛋分
if !(now.Weekday() > time.Friday || (now.Weekday() > time.Friday && now.Hour() > 18)) {
// 没过周二下午六点 返回上周蛋蛋分
now = now.AddDate(0, 0, -7)
}
year, week := now.ISOWeek()


Loading…
Cancel
Save