From 0e1d840a1594ace4519ce85b212e6e95d82db78f Mon Sep 17 00:00:00 2001 From: shenjiachi Date: Thu, 26 Dec 2024 09:59:37 +0800 Subject: [PATCH] feat: add CreateEsScoreAndAssignValuesDoc --- .../create_es_score_and_assign_value.go | 59 ++++++++++++++++++ .../enum/es_egg_energy_score_enum.go | 62 +++++++++++++++++++ 2 files changed, 121 insertions(+) create mode 100644 rule/egg_energy/create_es_score_and_assign_value.go create mode 100644 rule/egg_energy/enum/es_egg_energy_score_enum.go diff --git a/rule/egg_energy/create_es_score_and_assign_value.go b/rule/egg_energy/create_es_score_and_assign_value.go new file mode 100644 index 0000000..bdb2307 --- /dev/null +++ b/rule/egg_energy/create_es_score_and_assign_value.go @@ -0,0 +1,59 @@ +package egg_energy + +import ( + "code.fnuoos.com/EggPlanet/egg_system_rules.git/md" + "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/enum" + utils "code.fnuoos.com/EggPlanet/egg_system_rules.git/utils" + "code.fnuoos.com/go_rely_warehouse/zyos_go_es.git/es" + "fmt" +) + +func CreateEsScoreAndAssignValuesDoc(index, id string, uid int64, kind enum.EggEnergyUserEggScoreEsKind, value string, now string) error { + m := md.EggEnergyUserEggScoreEs{ + Uid: uid, + CreatedAt: now, + UpdatedAt: now, + } + switch kind { + case enum.ScoreValue: + m.ScoreValue = utils.StrToFloat64(value) + case enum.ScoreValueKind: + m.ScoreValueKind = int32(utils.StrToInt64(value)) + case enum.Ecpm: + m.Ecpm = utils.StrToFloat64(value) + case enum.InviteUserNums: + m.InviteUserNums = utils.StrToInt(value) + case enum.TeamActivityNums: + m.TeamActivityNums = utils.StrToInt(value) + case enum.SignInNums: + m.SignInNums = utils.StrToInt(value) + case enum.ImActivityNums: + m.ImActivityNums = utils.StrToInt(value) + case enum.SendRedPackageNums: + m.SendRedPackageNums = utils.StrToInt(value) + case enum.EsEggEnergyExchangeAccountBalance: + m.EggEnergyExchangeAccountBalance = utils.StrToInt(value) + case enum.AccountBalanceExchangeEggEnergyNums: + m.AccountBalanceExchangeEggEnergyNums = utils.StrToInt(value) + case enum.SendCircleOfFriendNums: + m.SendCircleOfFriendNums = utils.StrToInt(value) + case enum.ForumCommentsNums: + m.ForumCommentsNums = utils.StrToInt(value) + case enum.CollegeLearningNums: + m.CollegeLearningNums = utils.StrToInt(value) + case enum.ViolateNums: + m.ViolateNums = utils.StrToInt(value) + case enum.BrowseInterfaceNums: + m.BrowseInterfaceNums = utils.StrToInt(value) + case enum.PersonAddActivityValue: + m.PersonAddActivityValue = utils.StrToInt(value) + default: + } + createDoc, err1 := es.CreateDoc(index, id, m) + if err1 != nil { + fmt.Println("EggCanalPersonAddActivityValueConsumeCreateDoc_ERR::::", "kind===>", kind, "::::::", err1.Error()) + return err1 + } + fmt.Println("createDoc==========>", createDoc) + return nil +} diff --git a/rule/egg_energy/enum/es_egg_energy_score_enum.go b/rule/egg_energy/enum/es_egg_energy_score_enum.go new file mode 100644 index 0000000..939b9b6 --- /dev/null +++ b/rule/egg_energy/enum/es_egg_energy_score_enum.go @@ -0,0 +1,62 @@ +package enum + +// EggEnergyUserEggScoreEsKind 蛋蛋分属性类型 +type EggEnergyUserEggScoreEsKind int + +const ( + ScoreValue = iota + 1 + ScoreValueKind + Ecpm + InviteUserNums + TeamActivityNums + SignInNums + ImActivityNums + SendRedPackageNums + EsEggEnergyExchangeAccountBalance + AccountBalanceExchangeEggEnergyNums + SendCircleOfFriendNums + ForumCommentsNums + CollegeLearningNums + ViolateNums + BrowseInterfaceNums + PersonAddActivityValue +) + +func (kind EggEnergyUserEggScoreEsKind) String() string { + switch kind { + case ScoreValue: + return "蛋蛋分" + case ScoreValueKind: + return "蛋蛋分类型" + case Ecpm: + return "Ecpm" + case InviteUserNums: + return "拉新人数" + case TeamActivityNums: + return "团队活跃次数" + case SignInNums: + return "签到次数" + case ImActivityNums: + return "im活跃次数" + case SendRedPackageNums: + return "发红包次数" + case EsEggEnergyExchangeAccountBalance: + return "蛋蛋能量兑换余额数量" + case AccountBalanceExchangeEggEnergyNums: + return "余额兑换蛋蛋能量数量" + case SendCircleOfFriendNums: + return "发朋友圈次数" + case ForumCommentsNums: + return "论坛评论次数" + case CollegeLearningNums: + return "学院学习次数" + case ViolateNums: + return "违规次数" + case BrowseInterfaceNums: + return "浏览界面次数" + case PersonAddActivityValue: + return "个人活跃积分" + default: + return "未知项目" + } +}