@@ -30,6 +30,12 @@ const EggEnergyUserEggScoreEsMapping = ` | |||||
"ecpm":{ | "ecpm":{ | ||||
"type": "double" | "type": "double" | ||||
}, | }, | ||||
"ecpm_avg":{ | |||||
"type": "double" | |||||
}, | |||||
"ecpm_nums":{ | |||||
"type": "integer" | |||||
}, | |||||
"invite_user_nums":{ | "invite_user_nums":{ | ||||
"type": "integer" | "type": "integer" | ||||
}, | }, | ||||
@@ -86,6 +92,8 @@ type EggEnergyUserEggScoreEs struct { | |||||
ScoreValue float64 `json:"score_value" label:"蛋蛋分值"` | ScoreValue float64 `json:"score_value" label:"蛋蛋分值"` | ||||
ScoreValueKind int32 `json:"score_value_kind" label:"评分类型(0:未知 1:人工 2:系统)"` | ScoreValueKind int32 `json:"score_value_kind" label:"评分类型(0:未知 1:人工 2:系统)"` | ||||
Ecpm float64 `json:"ecpm" label:"ecpm"` | 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:"拉新人数"` | InviteUserNums int `json:"invite_user_nums" label:"拉新人数"` | ||||
TeamActivityNums int `json:"team_activity_nums" label:"团队活跃次数"` | TeamActivityNums int `json:"team_activity_nums" label:"团队活跃次数"` | ||||
SignInNums int `json:"sign_in_nums" label:"签到次数"` | SignInNums int `json:"sign_in_nums" label:"签到次数"` | ||||
@@ -21,6 +21,10 @@ func CreateEsScoreAndAssignValuesDoc(index, id string, uid int64, kind enum.EggE | |||||
m.ScoreValueKind = int32(utils.StrToInt64(value)) | m.ScoreValueKind = int32(utils.StrToInt64(value)) | ||||
case enum.Ecpm: | case enum.Ecpm: | ||||
m.Ecpm = utils.StrToFloat64(value) | m.Ecpm = utils.StrToFloat64(value) | ||||
case enum.EcpmAvg: | |||||
m.EcpmAvg = utils.StrToFloat64(value) | |||||
case enum.EcpmNums: | |||||
m.EcpmNums = utils.StrToInt(value) | |||||
case enum.InviteUserNums: | case enum.InviteUserNums: | ||||
m.InviteUserNums = utils.StrToInt(value) | m.InviteUserNums = utils.StrToInt(value) | ||||
case enum.TeamActivityNums: | case enum.TeamActivityNums: | ||||
@@ -7,6 +7,8 @@ const ( | |||||
ScoreValue = iota + 1 | ScoreValue = iota + 1 | ||||
ScoreValueKind | ScoreValueKind | ||||
Ecpm | Ecpm | ||||
EcpmAvg | |||||
EcpmNums | |||||
InviteUserNums | InviteUserNums | ||||
TeamActivityNums | TeamActivityNums | ||||
SignInNums | SignInNums | ||||
@@ -107,7 +107,7 @@ func SettlementGiveActivityCoin(engine *xorm.Engine, user model.User, ecpm strin | |||||
rewardValue *= newUserRewardRules.RewardCoefficient | rewardValue *= newUserRewardRules.RewardCoefficient | ||||
} | } | ||||
score := 60.00 | |||||
var score float64 | |||||
esIndex := es.GetLatestEffectiveIndexFromAlias(now) | esIndex := es.GetLatestEffectiveIndexFromAlias(now) | ||||
esIndexName := md.EggEnergyUserEggScoreEsAlias + "_" + esIndex | esIndexName := md.EggEnergyUserEggScoreEsAlias + "_" + esIndex | ||||
results, err1 := es2.FirstDoc(esIndexName, esIndex+"_"+egg_system_rules.Int64ToStr(user.Id)) | 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 | score = doc.ScoreValue | ||||
} | } | ||||
if score == 0 { | |||||
score = 60.00 | |||||
} | |||||
fmt.Println("SettlementGiveActivityCoin:e:", egg_system_rules.Int64ToStr(user.Id)+":"+ecpm+":", time.Since(now)) | fmt.Println("SettlementGiveActivityCoin:e:", egg_system_rules.Int64ToStr(user.Id)+":"+ecpm+":", time.Since(now)) | ||||
eggPointPartitionCoefficientManagementDb := implement.NewEggPointPartitionCoefficientManagementDb(engine) | eggPointPartitionCoefficientManagementDb := implement.NewEggPointPartitionCoefficientManagementDb(engine) | ||||
@@ -18,7 +18,8 @@ func GetAppointIndexFromAlias(year string, week string) string { | |||||
// GetLatestEffectiveIndexFromAlias 获取最新有效别名 | // GetLatestEffectiveIndexFromAlias 获取最新有效别名 | ||||
// TODO::临时默认全是60分 | // TODO::临时默认全是60分 | ||||
func GetLatestEffectiveIndexFromAlias(now time.Time) string { | 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) | now = now.AddDate(0, 0, -7*2) | ||||
} else { | } else { | ||||
@@ -30,8 +31,8 @@ func GetLatestEffectiveIndexFromAlias(now time.Time) string { | |||||
} | } | ||||
func GetLatestEffectiveIndexFromAliasForAdmin(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) | now = now.AddDate(0, 0, -7) | ||||
} | } | ||||
year, week := now.ISOWeek() | year, week := now.ISOWeek() | ||||