From 58adcab324ebdd71134f03f8d084b4fd3fb17496 Mon Sep 17 00:00:00 2001 From: dengbiao Date: Mon, 18 Nov 2024 16:47:09 +0800 Subject: [PATCH] add elastsearch --- app/cfg/cfg_app.go | 7 + app/cfg/init_cfg.go | 2 + app/cfg/init_es.go | 12 + .../egg_energy/hdl_egg_point.go | 247 +++ .../egg_energy/md_egg_point.go | 115 ++ app/router/router.go | 7 + app/svc/egg_energy/svc_egg_energy.go | 1377 +++++++++++++++++ app/task/svc/svc_egg_energy_modify_price.go | 56 - ...rgy_user_egg_score_auto_create_es_index.go | 46 + app/task/svc/utils_test.go | 12 + app/utils/convert.go | 4 +- docs/docs.go | 1180 +++++++++++++- docs/swagger.json | 1180 +++++++++++++- docs/swagger.yaml | 744 +++++++++ etc/cfg.yml | 13 +- go.mod | 29 +- main.go | 1 + 17 files changed, 4847 insertions(+), 185 deletions(-) create mode 100644 app/cfg/init_es.go create mode 100644 app/hdl/institutional_management/egg_energy/hdl_egg_point.go create mode 100644 app/md/institutional_management/egg_energy/md_egg_point.go create mode 100644 app/svc/egg_energy/svc_egg_energy.go delete mode 100644 app/task/svc/svc_egg_energy_modify_price.go create mode 100644 app/task/svc/svc_egg_energy_user_egg_score_auto_create_es_index.go create mode 100644 app/task/svc/utils_test.go diff --git a/app/cfg/cfg_app.go b/app/cfg/cfg_app.go index 232ecdb..a0088d2 100644 --- a/app/cfg/cfg_app.go +++ b/app/cfg/cfg_app.go @@ -17,6 +17,7 @@ type Config struct { ImLogicRpc ImLogicRpcCfg `yaml:"im_logic_rpc"` Local bool MQ MQCfg `yaml:"mq"` + ES ESCfg } type ImBusinessRpcCfg struct { @@ -73,3 +74,9 @@ type MQCfg struct { User string `yaml:"user"` Pwd string `yaml:"pwd"` } + +type ESCfg struct { + Url string `yaml:"url"` + User string `yaml:"user"` + Pwd string `yaml:"pwd"` +} diff --git a/app/cfg/init_cfg.go b/app/cfg/init_cfg.go index 6f1e73a..e6e11c7 100644 --- a/app/cfg/init_cfg.go +++ b/app/cfg/init_cfg.go @@ -17,6 +17,7 @@ var ( RedisPassword string DB *DBCfg MQ *MQCfg + ES *ESCfg Log *LogCfg ) @@ -48,4 +49,5 @@ func InitCfg() { RedisPassword = conf.RedisPassword SrvAddr = conf.SrvAddr MQ = &conf.MQ + ES = &conf.ES } diff --git a/app/cfg/init_es.go b/app/cfg/init_es.go new file mode 100644 index 0000000..6df6371 --- /dev/null +++ b/app/cfg/init_es.go @@ -0,0 +1,12 @@ +package cfg + +import ( + "code.fnuoos.com/go_rely_warehouse/zyos_go_es.git/es" + "encoding/json" +) + +func InitEs() { + data, _ := json.Marshal(ES) + filePutContents("init_rabbit_es", string(data)) + es.Init(ES.Url, ES.User, ES.Pwd) +} diff --git a/app/hdl/institutional_management/egg_energy/hdl_egg_point.go b/app/hdl/institutional_management/egg_energy/hdl_egg_point.go new file mode 100644 index 0000000..6d35877 --- /dev/null +++ b/app/hdl/institutional_management/egg_energy/hdl_egg_point.go @@ -0,0 +1,247 @@ +package egg_energy + +import ( + "applet/app/db" + "applet/app/e" + md "applet/app/md/institutional_management/egg_energy" + "applet/app/svc/egg_energy" + "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" + md2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/md" + "code.fnuoos.com/go_rely_warehouse/zyos_go_es.git/es" + "github.com/gin-gonic/gin" +) + +// UserEggIndex +// @Summary 制度中心-蛋蛋能量-蛋蛋分管理(着陆页数据) +// @Tags 蛋蛋能量 +// @Description 蛋蛋分管理(着陆页数据) +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @param req body md.UserEggIndexReq true "请求参数" +// @Success 200 {object} md.UserEggIndexResp "成功返回" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/institutionalManagement/eggEnergy/eggPoint/statisticsUserEggIndex [POST] +func UserEggIndex(c *gin.Context) { + var req *md.UserEggIndexReq + if err1 := c.ShouldBindJSON(&req); err1 != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err1.Error()) + return + } + var resp md.UserEggIndexResp + var err error + + var esIndexName string + if req.Year == "" && req.Week == "" { + esIndexName, _ = es.GetLatestIndexFromAlias(md2.EggEnergyUserEggScoreEsAlias) + resp.Year, resp.Week = egg_energy.GetYearsAndWeekStr(esIndexName) + } else { + esIndexName = md2.EggEnergyUserEggScoreEsAlias + "_" + req.Year + req.Week + resp.Year, resp.Week = req.Year, req.Week + } + + //统计用户蛋蛋分范围 + resp.StatisticsUserEggScoreValueRange, err = egg_energy.StatisticsUserEggScoreValueRange(esIndexName) + if err != nil { + e.OutErr(c, e.ERR, err.Error()) + } + //统计用户蛋蛋分"评比类型"占比 + resp.StatisticsUserEggKindProportion, err = egg_energy.StatisticsUserEggKindProportion(esIndexName) + if err != nil { + e.OutErr(c, e.ERR, err.Error()) + } + //查询蛋蛋分系数权重 + eggEnergyUserEggIndexWeightDb := implement.NewEggEnergyUserEggIndexWeightDb(db.Db) + resp.EggEnergyUserEggIndexWeight, _, _ = eggEnergyUserEggIndexWeightDb.EggEnergyUserEggIndexWeightGet() + + resp.YearAndWeekList, err = egg_energy.GetYearsAndWeeks() + if err != nil { + return + } + if err != nil { + e.OutErr(c, e.ERR, err.Error()) + } + e.OutSuc(c, resp, nil) +} + +// StatisticsUserEggIndex +// @Summary 制度中心-蛋蛋能量-蛋蛋分管理(着陆页数据分析) +// @Tags 蛋蛋能量 +// @Description 蛋蛋分管理(着陆页数据分析) +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @param req body md.StatisticsEggPointReq true "请求参数" +// @Success 200 {object} md.StatisticsEggPointResp "成功返回" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/institutionalManagement/eggEnergy/eggPoint/statisticsUserEggIndex [POST] +func StatisticsUserEggIndex(c *gin.Context) { + var req *md.StatisticsEggPointReq + if err1 := c.ShouldBindJSON(&req); err1 != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err1.Error()) + return + } + var resp md.StatisticsEggPointResp + var err error + + var esIndexName string + if req.Year == "" && req.Week == "" { + esIndexName, _ = es.GetLatestIndexFromAlias(md2.EggEnergyUserEggScoreEsAlias) + resp.Year, resp.Week = egg_energy.GetYearsAndWeekStr(esIndexName) + } else { + esIndexName = md2.EggEnergyUserEggScoreEsAlias + "_" + req.Year + req.Week + resp.Year, resp.Week = req.Year, req.Week + } + + //统计用户"ecpm"范围 + resp.StatisticsUserEggEcpmRange, err = egg_energy.StatisticsUserEggEcpmRange(esIndexName) + if err != nil { + e.OutErr(c, e.ERR, err.Error()) + } + //统计用户"拉新人数"范围 + resp.StatisticsUserEggInviteUserNumsRange, err = egg_energy.StatisticsUserEggInviteUserNumsRange(esIndexName) + if err != nil { + e.OutErr(c, e.ERR, err.Error()) + } + //统计用户"团队活跃次数"范围 + resp.StatisticsUserEggTeamActivityNumsRange, err = egg_energy.StatisticsUserEggTeamActivityNumsRange(esIndexName) + if err != nil { + e.OutErr(c, e.ERR, err.Error()) + } + //统计用户"签到次数"范围 + resp.StatisticsUserEggSignInNumsRange, err = egg_energy.StatisticsUserEggSignInNumsRange(esIndexName) + if err != nil { + e.OutErr(c, e.ERR, err.Error()) + } + //统计用户"发红包次数"范围 + resp.StatisticsUserEggSendRedPackageNumsRange, err = egg_energy.StatisticsUserEggSendRedPackageNumsRange(esIndexName) + if err != nil { + e.OutErr(c, e.ERR, err.Error()) + } + //统计用户"蛋蛋能量兑换余额数量"范围 + resp.StatisticsUserEggEggEnergyExchangeAccountBalanceRange, err = egg_energy.StatisticsUserEggEggEnergyExchangeAccountBalanceRange(esIndexName) + if err != nil { + e.OutErr(c, e.ERR, err.Error()) + } + //统计用户"蛋蛋能量兑换余额数量"范围 + resp.StatisticsUserEggAccountBalanceExchangeEggEnergyNumsRange, err = egg_energy.StatisticsUserEggAccountBalanceExchangeEggEnergyNumsRange(esIndexName) + if err != nil { + e.OutErr(c, e.ERR, err.Error()) + } + //统计用户"发朋友圈次数"范围 + resp.StatisticsUserEggSendCircleOfFriendNumsRange, err = egg_energy.StatisticsUserEggSendCircleOfFriendNumsRange(esIndexName) + if err != nil { + e.OutErr(c, e.ERR, err.Error()) + } + //统计用户"论坛评论次数"范围 + resp.StatisticsUserEggForumCommentsNumsRange, err = egg_energy.StatisticsUserEggForumCommentsNumsRange(esIndexName) + if err != nil { + e.OutErr(c, e.ERR, err.Error()) + } + //统计用户"学院学习次数"范围 + resp.StatisticsUserEggCollegeLearningNumsRange, err = egg_energy.StatisticsUserEggCollegeLearningNumsRange(esIndexName) + if err != nil { + e.OutErr(c, e.ERR, err.Error()) + } + //统计用户"违规次数"范围 + resp.StatisticsUserEggViolateNumsRange, err = egg_energy.StatisticsUserEggViolateNumsRange(esIndexName) + if err != nil { + e.OutErr(c, e.ERR, err.Error()) + } + //统计用户"浏览界面次数"范围 + resp.StatisticsUserEggBrowseInterfaceNumsRange, err = egg_energy.StatisticsUserEggBrowseInterfaceNumsRange(esIndexName) + if err != nil { + e.OutErr(c, e.ERR, err.Error()) + } + //统计用户"个人活跃积分增量值"范围 + resp.StatisticsUserEggPersonAddActivityValueRange, err = egg_energy.StatisticsUserEggPersonAddActivityValueRange(esIndexName) + if err != nil { + e.OutErr(c, e.ERR, err.Error()) + } + + resp.YearAndWeekList, err = egg_energy.GetYearsAndWeeks() + if err != nil { + return + } + if err != nil { + e.OutErr(c, e.ERR, err.Error()) + } + e.OutSuc(c, resp, nil) +} + +// UserEggFlow +// @Summary 制度中心-蛋蛋能量-蛋蛋分管理(用户数据列表) +// @Tags 蛋蛋能量 +// @Description 蛋蛋分管理(用户数据列表) +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @param req body md.UserEggFlowReq true "请求参数" +// @Success 200 {object} md.UserEggFlowReqResp "成功返回" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/institutionalManagement/eggEnergy/eggPoint/userEggFlow [POST] +func UserEggFlow(c *gin.Context) { + var req *md.UserEggFlowReq + if err1 := c.ShouldBindJSON(&req); err1 != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err1.Error()) + return + } + var resp md.UserEggFlowReqResp + var err error + + var esIndexName string + if req.Year == "" && req.Week == "" { + esIndexName, _ = es.GetLatestIndexFromAlias(md2.EggEnergyUserEggScoreEsAlias) + resp.Year, resp.Week = egg_energy.GetYearsAndWeekStr(esIndexName) + } else { + esIndexName = md2.EggEnergyUserEggScoreEsAlias + "_" + req.Year + req.Week + resp.Year, resp.Week = req.Year, req.Week + } + + resp.List, resp.Total, err = egg_energy.QueryElasticsearch(*req, esIndexName) + if err != nil { + e.OutErr(c, e.ERR, err.Error()) + return + } + resp.Page = req.Page + resp.PageSize = req.PageSize + e.OutSuc(c, resp, nil) +} + +// ManualScore +// @Summary 制度中心-蛋蛋能量-蛋蛋分管理(人工打分) +// @Tags 蛋蛋能量 +// @Description 蛋蛋分管理(人工打分) +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @param req body md.ManualScoreReq true "请求参数" +// @Success 200 {string} success "成功返回" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/institutionalManagement/eggEnergy/eggPoint/manualScore [POST] +func ManualScore(c *gin.Context) { + var req *md.ManualScoreReq + if err1 := c.ShouldBindJSON(&req); err1 != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err1.Error()) + return + } + esIndexName, _ := es.GetLatestIndexFromAlias(md2.EggEnergyUserEggScoreEsAlias) + doc, err := es.FirstDoc(esIndexName, req.IndexId) + if err != nil { + e.OutErr(c, e.ERR, err.Error()) + return + } + if doc == nil { + e.OutErr(c, e.ERR_NO_DATA, "文档记录为空") + return + } + _, err = es.UpdateDoc(esIndexName, req.IndexId, map[string]interface{}{ + "score_value": req.Score, + "score_value_kind": 1, + }) + if err != nil { + e.OutErr(c, e.ERR, err.Error()) + return + } + e.OutSuc(c, "success", nil) +} diff --git a/app/md/institutional_management/egg_energy/md_egg_point.go b/app/md/institutional_management/egg_energy/md_egg_point.go new file mode 100644 index 0000000..ab3827e --- /dev/null +++ b/app/md/institutional_management/egg_energy/md_egg_point.go @@ -0,0 +1,115 @@ +package md + +import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + +type StatisticsEggPointReq struct { + Year string `json:"year" example:"年份"` + Week string `json:"week" example:"周份"` +} + +type UserEggIndexReq struct { + Year string `json:"year" example:"年份"` + Week string `json:"week" example:"周份"` +} + +type StatisticsEggPointResp struct { + Year string `json:"year" example:"年份"` + Week string `json:"week" example:"周份"` + YearAndWeekList map[string][]string `json:"year_list"` //年份&&周份列表 + StatisticsUserEggScoreValueRange []map[string]string `json:"statistics_user_egg_score_value_range"` //统计用户蛋蛋分范围 + StatisticsUserEggKindProportion []map[string]interface{} `json:"statistics_user_egg_kind_proportion"` //统计用户蛋蛋分"评比类型"占比 + StatisticsUserEggEcpmRange []map[string]string `json:"statistics_user_egg_ecpm_range"` //统计用户"ecpm"范围 + StatisticsUserEggInviteUserNumsRange []map[string]string `json:"statistics_user_egg_invite_user_nums_range"` //统计用户"拉新人数"范围 + StatisticsUserEggTeamActivityNumsRange []map[string]string `json:"statistics_user_egg_team_activity_nums_range"` //统计用户"团队活跃次数"范围 + StatisticsUserEggSignInNumsRange []map[string]string `json:"statistics_user_egg_sign_in_nums_range"` //统计用户"签到次数"范围 + StatisticsUserEggSendRedPackageNumsRange []map[string]string `json:"statistics_user_egg_send_red_package_nums_range"` //统计用户"发红包次数"范围 + StatisticsUserEggEggEnergyExchangeAccountBalanceRange []map[string]string `json:"statistics_user_egg_egg_energy_exchange_account_balance_range"` //统计用户"蛋蛋能量兑换余额数量"范围 + StatisticsUserEggAccountBalanceExchangeEggEnergyNumsRange []map[string]string `json:"statistics_user_egg_account_balance_exchange_egg_energy_nums_range"` //统计用户"余额兑换蛋蛋能量数量"范围 + StatisticsUserEggSendCircleOfFriendNumsRange []map[string]string `json:"statistics_user_egg_send_circle_of_friend_nums_range"` //统计用户"发朋友圈次数"范围 + StatisticsUserEggForumCommentsNumsRange []map[string]string `json:"statistics_user_egg_forum_comments_nums_range"` //统计用户"论坛评论次数"范围 + StatisticsUserEggCollegeLearningNumsRange []map[string]string `json:"statistics_user_egg_college_learning_nums_range"` //统计用户"学院学习次数"范围 + StatisticsUserEggViolateNumsRange []map[string]string `json:"statistics_user_egg_violate_nums_range"` //统计用户"违规次数"范围 + StatisticsUserEggBrowseInterfaceNumsRange []map[string]string `json:"statistics_user_egg_browse_interface_nums_range"` //统计用户"浏览界面次数"范围 + StatisticsUserEggPersonAddActivityValueRange []map[string]string `json:"statistics_user_egg_person_add_activity_value_range"` //统计用户"个人活跃积分增量值"范围 +} + +type UserEggIndexResp struct { + Year string `json:"year" example:"年份"` + Week string `json:"week" example:"周份"` + YearAndWeekList map[string][]string `json:"year_list"` //年份&&周份列表 + StatisticsUserEggScoreValueRange []map[string]string `json:"statistics_user_egg_score_value_range"` //统计用户蛋蛋分范围 + StatisticsUserEggKindProportion []map[string]interface{} `json:"statistics_user_egg_kind_proportion"` //统计用户蛋蛋分"评比类型"占比 + EggEnergyUserEggIndexWeight *model.EggEnergyUserEggIndexWeight `json:"egg_energy_user_egg_index_weight"` //蛋蛋分系数权重 +} + +type UserEggFlowReq struct { + Page int `json:"page,required"` // 页数 + PageSize int `json:"page_size,required"` // 每页大小 + Year string `json:"year" example:"年份"` + Week string `json:"week" example:"周份"` + ScoreValueStart string `json:"score_value_start" example:"蛋蛋分-起始值"` + ScoreValueEnd string `json:"score_value_end" example:"蛋蛋分-结束值"` + ScoreValueKind int `json:"score_value_kind"` //评分类型(0:未知 1:人工 2:系统) + EcpmStart string `json:"ecpm_start" example:"ecpm-起始值"` + EcpmEnd string `json:"ecpm_end" example:"ecpm-结束值"` + InviteUserNumsStart string `json:"invite_user_nums_start" example:"拉新人数-起始值"` + InviteUserNumsEnd string `json:"invite_user_nums_end" example:"拉新人数-结束值"` + TeamActivityNumsStart string `json:"team_activity_nums_start" example:"团队活跃次数-起始值"` + TeamActivityNumsEnd string `json:"team-activity-nums-end" example:"团队活跃次数-结束值"` + SignInNumsStart string `json:"sign_in_nums_start" example:"签到次数-起始值"` + SignInNumsEnd string `json:"sign_in_nums_end" example:"签到次数-结束值"` + ImActivityNumsStart string `json:"im_activity_nums_start" example:"im活跃次数-起始值"` + ImActivityNumsEnd string `json:"im_activity_nums_end" example:"im活跃次数-结束值"` + SendRedPackageNumsStart string `json:"send_red_package_nums_start" example:"发红包次数-起始值"` + SendRedPackageNumsEnd string `json:"send_red_package_nums_end" example:"发红包次数-结束值"` + EggEnergyExchangeAccountBalanceStart string `json:"egg_energy_exchange_account_balance_start" example:"蛋蛋能量兑换余额数量-起始值"` + EggEnergyExchangeAccountBalanceEnd string `json:"egg_energy_exchange_account_balance_end" example:"蛋蛋能量兑换余额数量-结束值"` + AccountBalanceExchangeEggEnergyNumsStart string `json:"account_balance_exchange_egg_energy_nums_start" example:"余额兑换蛋蛋能量数量-起始值"` + AccountBalanceExchangeEggEnergyNumsEnd string `json:"account_balance_exchange_egg_energy_nums_end" example:"余额兑换蛋蛋能量数量-结束值"` + SendCircleOfFriendNumsStart string `json:"send_circle_of_friend_nums_start" example:"发朋友圈次数-起始值"` + SendCircleOfFriendNumsEnd string `json:"send_circle_of_friend_nums_end" example:"发朋友圈次数-结束值"` + ForumCommentsNumsStart string `json:"forum_comments_nums_start" example:"论坛评论次数-起始值"` + ForumCommentsNumsEnd string `json:"forum_comments_nums_end" example:"论坛评论次数-结束值"` + CollegeLearningNumsStart string `json:"college_learning_nums_start" example:"学院学习次数-起始值"` + CollegeLearningNumsEnd string `json:"college_learning_nums_end" example:"学院学习次数-结束值"` + ViolateNumsStart string `json:"violate_nums_start" example:"违规次数-起始值"` + ViolateNumsEnd string `json:"violate_nums_end" example:"违规次数-结束值"` + BrowseInterfaceNumsStart string `json:"browse_interface_nums_start" example:"浏览界面次数-起始值"` + BrowseInterfaceNumsEnd string `json:"browse_interface_nums_end" example:"浏览界面次数-结束值"` + PersonAddActivityValueStart string `json:"person_add_activity_value_start" example:"个人活跃积分-起始值"` + PersonAddActivityValueEnd string `json:"person_add_activity_value_end" example:"个人活跃积分-结束值"` +} + +type ManualScoreReq struct { + IndexId string `json:"index_id,required"` //文档id + Score string `json:"score" example:"分数"` +} + +type UserEggFlowReqResp struct { + Page int `json:"page,required"` // 页数 + PageSize int `json:"page_size,required"` // 每页大小 + Year string `json:"year" example:"年份"` + Week string `json:"week" example:"周份"` + Total int64 `json:"total"` //总数量 + List []UserEggFlowReqRespList `json:"list"` +} + +type UserEggFlowReqRespList struct { + IndexId string `json:"index_id"` //文档id + ScoreValue float64 `json:"score_value"` //蛋蛋分-起始值 + ScoreValueKind int `json:"score_value_kind"` //评分类型(0:未知 1:人工 2:系统) + Ecpm float64 `json:"ecpm"` //ecpm + InviteUserNums int `json:"invite_user_nums"` //拉新人数 + TeamActivityNums int `json:"team_activity_nums"` //团队活跃次数 + SignInNums int `json:"sign_in_nums"` //签到次数 + ImActivityNums int `json:"im_activity_nums"` //im活跃次数 + SendRedPackageNums int `json:"send_red_package_nums"` //发红包次数 + EggEnergyExchangeAccountBalance int `json:"egg_energy_exchange_account_balance"` //蛋蛋能量兑换余额数量 + AccountBalanceExchangeEggEnergyNums int `json:"account_balance_exchange_egg_energy_nums"` //余额兑换蛋蛋能量数量 + SendCircleOfFriendNums int `json:"send_circle_of_friend_nums"` //发朋友圈次数 + ForumCommentsNums int `json:"forum_comments_nums"` //论坛评论次数 + CollegeLearningNums int `json:"college_learning_nums"` //学院学习次数 + ViolateNums int `json:"violate_nums"` //违规次数 + BrowseInterfaceNums int `json:"browse_interface_nums"` //浏览界面次数 + PersonAddActivityValue int `json:"person_add_activity_value"` //个人活跃积分 +} diff --git a/app/router/router.go b/app/router/router.go index 1983eb4..a33d622 100644 --- a/app/router/router.go +++ b/app/router/router.go @@ -131,6 +131,13 @@ func rInstitutionalManagement(r *gin.RouterGroup) { //制度管理 rPlatformRevenue.POST("/platformRevenueList", egg_energy.ListPlatformRevenue) rPlatformRevenue.POST("/platformRevenueAdd", egg_energy.AddPlatformRevenue) } + rEggPoint := rEggEnergy.Group("/eggPoint") + { + rEggPoint.POST("/userEggIndex", egg_energy.UserEggIndex) + rEggPoint.POST("/statisticsUserEggIndex", egg_energy.StatisticsUserEggIndex) + rEggPoint.POST("/userEggFlow", egg_energy.UserEggFlow) + rEggPoint.POST("/manualScore", egg_energy.ManualScore) + } } } diff --git a/app/svc/egg_energy/svc_egg_energy.go b/app/svc/egg_energy/svc_egg_energy.go new file mode 100644 index 0000000..b5791d6 --- /dev/null +++ b/app/svc/egg_energy/svc_egg_energy.go @@ -0,0 +1,1377 @@ +package egg_energy + +import ( + md2 "applet/app/md/institutional_management/egg_energy" + "applet/app/utils" + "code.fnuoos.com/EggPlanet/egg_system_rules.git/md" + "code.fnuoos.com/go_rely_warehouse/zyos_go_es.git/es" + "context" + "encoding/json" + "errors" + "fmt" + "github.com/olivere/elastic/v7" + "strconv" + "strings" +) + +// 查询Elasticsearch并返回结果 +func QueryElasticsearch(req md2.UserEggFlowReq, indexName string) (resp []md2.UserEggFlowReqRespList, total int64, err error) { + // 构建查询条件 + boolQuery := elastic.NewBoolQuery() + + if req.ScoreValueStart != "" && req.ScoreValueEnd != "" { + boolQuery = boolQuery.Filter(elastic.NewRangeQuery("score_value").Gte(req.ScoreValueStart).Lte(req.ScoreValueEnd)) + } + if req.EcpmStart != "" && req.EcpmEnd != "" { + boolQuery = boolQuery.Filter(elastic.NewRangeQuery("ecpm").Gte(req.EcpmStart).Lte(req.EcpmEnd)) + } + if req.InviteUserNumsStart != "" && req.InviteUserNumsEnd != "" { + boolQuery = boolQuery.Filter(elastic.NewRangeQuery("invite_user_nums").Gte(req.InviteUserNumsStart).Lte(req.InviteUserNumsEnd)) + } + if req.TeamActivityNumsStart != "" && req.TeamActivityNumsEnd != "" { + boolQuery = boolQuery.Filter(elastic.NewRangeQuery("team_activity_nums").Gte(req.TeamActivityNumsStart).Lte(req.TeamActivityNumsEnd)) + } + if req.SignInNumsStart != "" && req.SignInNumsEnd != "" { + boolQuery = boolQuery.Filter(elastic.NewRangeQuery("sign_in_nums").Gte(req.SignInNumsStart).Lte(req.SignInNumsEnd)) + } + if req.ImActivityNumsStart != "" && req.ImActivityNumsEnd != "" { + boolQuery = boolQuery.Filter(elastic.NewRangeQuery("im_activity_nums").Gte(req.ImActivityNumsStart).Lte(req.ImActivityNumsEnd)) + } + if req.SendRedPackageNumsStart != "" && req.SendRedPackageNumsEnd != "" { + boolQuery = boolQuery.Filter(elastic.NewRangeQuery("send_red_package_nums").Gte(req.SendRedPackageNumsStart).Lte(req.SendRedPackageNumsEnd)) + } + if req.EggEnergyExchangeAccountBalanceStart != "" && req.EggEnergyExchangeAccountBalanceEnd != "" { + boolQuery = boolQuery.Filter(elastic.NewRangeQuery("egg_energy_exchange_account_balance").Gte(req.EggEnergyExchangeAccountBalanceStart).Lte(req.EggEnergyExchangeAccountBalanceEnd)) + } + if req.AccountBalanceExchangeEggEnergyNumsStart != "" && req.AccountBalanceExchangeEggEnergyNumsEnd != "" { + boolQuery = boolQuery.Filter(elastic.NewRangeQuery("account_balance_exchange_egg_energy_nums").Gte(req.AccountBalanceExchangeEggEnergyNumsStart).Lte(req.AccountBalanceExchangeEggEnergyNumsEnd)) + } + if req.SendCircleOfFriendNumsStart != "" && req.SendCircleOfFriendNumsEnd != "" { + boolQuery = boolQuery.Filter(elastic.NewRangeQuery("send_circle_of_friend_nums").Gte(req.SendCircleOfFriendNumsStart).Lte(req.SendCircleOfFriendNumsEnd)) + } + if req.ForumCommentsNumsStart != "" && req.ForumCommentsNumsEnd != "" { + boolQuery = boolQuery.Filter(elastic.NewRangeQuery("forum_comments_nums").Gte(req.ForumCommentsNumsStart).Lte(req.ForumCommentsNumsEnd)) + } + if req.CollegeLearningNumsStart != "" && req.CollegeLearningNumsEnd != "" { + boolQuery = boolQuery.Filter(elastic.NewRangeQuery("college_learning_nums").Gte(req.CollegeLearningNumsStart).Lte(req.CollegeLearningNumsEnd)) + } + if req.ViolateNumsStart != "" && req.ViolateNumsEnd != "" { + boolQuery = boolQuery.Filter(elastic.NewRangeQuery("violate_nums").Gte(req.ViolateNumsStart).Lte(req.ViolateNumsEnd)) + } + if req.BrowseInterfaceNumsStart != "" && req.BrowseInterfaceNumsEnd != "" { + boolQuery = boolQuery.Filter(elastic.NewRangeQuery("browse_interface_nums").Gte(req.BrowseInterfaceNumsStart).Lte(req.BrowseInterfaceNumsEnd)) + } + if req.PersonAddActivityValueStart != "" && req.PersonAddActivityValueEnd != "" { + boolQuery = boolQuery.Filter(elastic.NewRangeQuery("person_add_activity_value").Gte(req.PersonAddActivityValueStart).Lte(req.PersonAddActivityValueEnd)) + } + + // 执行查询 + searchResult, err := es.EsClient.Search(). + Index(indexName). + Query(boolQuery). + From((req.Page - 1) * req.PageSize).Size(req.PageSize). + Pretty(true). + Do(context.Background()) + + if err != nil { + return + } + + // 检查是否有结果 + if searchResult.Hits.TotalHits.Value == 0 { + return + } + + // 解析结果 + for _, hit := range searchResult.Hits.Hits { + var doc md2.UserEggFlowReqRespList + err = json.Unmarshal(hit.Source, &doc) + if err != nil { + return + } + resp = append(resp, doc) + } + total = searchResult.Hits.TotalHits.Value + return +} + +// StatisticsUserEggScoreValueRange 统计用户蛋蛋分范围 +func StatisticsUserEggScoreValueRange(esIndexName string) (resp []map[string]string, err error) { + resp = []map[string]string{} + var result *elastic.SearchResult + boolQuery := elastic.NewBoolQuery().Must() // 创建bool查询 + + // 1、 创建 extended_stats 高级统计 + aggs := elastic.NewExtendedStatsAggregation().Field("score_value") + result, err = es.EsClient.Search(). + Index(esIndexName). + TrackTotalHits(true). + Query(boolQuery). // 设置查询条件 + Aggregation("result", aggs). // 设置聚合条件,并为聚合条件设置一个名字 + Size(0). // 设置分页参数 - 每页大小,设置为0,代表不返回搜索结果,仅返回聚合分析结果 + Pretty(true). // 返回可读的json格式 + Do(context.Background()) + if err != nil { + return resp, err + } + + // 使用Cardinality函数和前面定义的聚合条件名称,查询结果 + agg, found := result.Aggregations.ExtendedStats("result") + if !found { + // 打印结果,注意:这里使用的是取值运算符 + return resp, errors.New("未聚合出数据") + } + + if agg.StdDeviation != nil && *agg.StdDeviation != 0 { + //2、histogram 直方图聚合 + stdDeviation := *agg.StdDeviation //标准平方差 + min := *agg.Min //最小值 + max := *agg.Max //最大值 + avg := *agg.Avg //平均数 + totalCount := agg.Count //总数 + discreteCoefficient := stdDeviation / avg //离散系数 + newAggs := elastic.NewHistogramAggregation().Field("score_value").Interval(discreteCoefficient).ExtendedBounds(min, max) + searchResult, err := es.EsClient.Search(). + Index(esIndexName). + TrackTotalHits(true). + Query(boolQuery). // 设置查询条件 + Aggregation("result", newAggs). // 设置聚合条件,并为聚合条件设置一个名字 + Size(0). // 设置分页参数 - 每页大小,设置为0,代表不返回搜索结果,仅返回聚合分析结果 + Pretty(true). // 返回可读的json格式 + Do(context.Background()) + if err != nil { + return resp, err + } + // 使用Terms函数和前面定义的聚合条件名称,查询结果 + newAgg, found := searchResult.Aggregations.Histogram("result") + if !found { + return resp, errors.New("未聚合出数据") + } + + // 3、组装数据 + var keys []string + var values []int64 + var tempTotalDocCount int64 + var endStart, endEnd string + for _, bucket := range newAgg.Buckets { + // 每一个桶都有一个key值,其实就是分组的值,可以理解为SQL的group by值 + if bucket.Key <= stdDeviation { + bucketValue := bucket.Key + keys = append(keys, utils.Float64ToStr(bucketValue)) + values = append(values, bucket.DocCount) + } else { + bucketValue := bucket.Key + if tempTotalDocCount == 0 { + endStart = utils.Float64ToStr(bucketValue) + } + tempTotalDocCount += bucket.DocCount + endEnd = utils.Float64ToStr(bucketValue) + } + } + + for k, v := range keys { + value, _ := Operate(values[k], totalCount) + if k+1 == len(keys) { + resp = append(resp, map[string]string{ + "key": v + " ~ " + utils.AnyToString(max) + " 元", + "value": utils.Float64ToStrPrec10(value), + }) + } else { + resp = append(resp, map[string]string{ + "key": v + " ~ " + keys[k+1] + " 元", + "value": utils.Float64ToStrPrec10(value), + }) + } + } + if tempTotalDocCount > 0 { + temp, _ := Operate(tempTotalDocCount, totalCount) + resp = append(resp, map[string]string{ + "key": endStart + " ~ " + endEnd + " 元", + "value": utils.Float64ToStrPrec10(temp), + }) + } + } + return resp, nil +} + +// StatisticsUserEggKindProportion 统计用户蛋蛋分"评比类型"占比 +func StatisticsUserEggKindProportion(esIndexName string) (result []map[string]interface{}, err error) { + var res *elastic.SearchResult + boolQuery := elastic.NewBoolQuery().Must() // 创建bool查询 + + aggs := elastic.NewTermsAggregation().Field("score_value_kind") + res, err = es.EsClient.Search(). + Index(esIndexName). + TrackTotalHits(true). + Query(boolQuery). // 设置查询条件 + Aggregation("terms", aggs). // 设置聚合条件,并为聚合条件设置一个名字 + Size(0). // 设置分页参数 - 每页大小,设置为0,代表不返回搜索结果,仅返回聚合分析结果 + Pretty(true). // 返回可读的json格式 + Do(context.Background()) + if err != nil { + return result, err + } + // 使用Terms函数和前面定义的聚合条件名称,查询结果 + agg, _ := res.Aggregations.Terms("terms") + var total float64 + for _, bucket := range agg.Buckets { + var tmp = map[string]interface{}{} + bucketValue := bucket.Key + tmp["key"] = bucketValue + tmp["count"] = bucket.DocCount + switch bucketValue { + case 1: + tmp["name"] = "人工" + break + case 2: + tmp["name"] = "自动" + break + default: + tmp["name"] = "未知" + } + result = append(result, tmp) + total += utils.AnyToFloat64(bucket.DocCount) + } + for _, value := range result { + value["proportion"] = utils.AnyToString(utils.AnyToFloat64(value["count"]) / total) + } + return result, nil +} + +// StatisticsUserEggEcpmRange 统计用户"ecpm"范围 +func StatisticsUserEggEcpmRange(esIndexName string) (resp []map[string]string, err error) { + resp = []map[string]string{} + var result *elastic.SearchResult + boolQuery := elastic.NewBoolQuery().Must() // 创建bool查询 + + // 1、 创建 extended_stats 高级统计 + aggs := elastic.NewExtendedStatsAggregation().Field("ecpm") + result, err = es.EsClient.Search(). + Index(esIndexName). + TrackTotalHits(true). + Query(boolQuery). // 设置查询条件 + Aggregation("result", aggs). // 设置聚合条件,并为聚合条件设置一个名字 + Size(0). // 设置分页参数 - 每页大小,设置为0,代表不返回搜索结果,仅返回聚合分析结果 + Pretty(true). // 返回可读的json格式 + Do(context.Background()) + if err != nil { + return resp, err + } + + // 使用Cardinality函数和前面定义的聚合条件名称,查询结果 + agg, found := result.Aggregations.ExtendedStats("result") + if !found { + // 打印结果,注意:这里使用的是取值运算符 + return resp, errors.New("未聚合出数据") + } + + if agg.StdDeviation != nil && *agg.StdDeviation != 0 { + //2、histogram 直方图聚合 + stdDeviation := *agg.StdDeviation //标准平方差 + min := *agg.Min //最小值 + max := *agg.Max //最大值 + avg := *agg.Avg //平均数 + totalCount := agg.Count //总数 + discreteCoefficient := stdDeviation / avg //离散系数 + if stdDeviation < avg { + //TODO::如果标准差相对较小,而平均值较大,离散系数可能会导致较大的间隔,直接使用标准差或其他更合适的值作为间隔。 + discreteCoefficient = stdDeviation + } + newAggs := elastic.NewHistogramAggregation().Field("ecpm").Interval(discreteCoefficient).ExtendedBounds(min, max) + searchResult, err := es.EsClient.Search(). + Index(esIndexName). + TrackTotalHits(true). + Query(boolQuery). // 设置查询条件 + Aggregation("result", newAggs). // 设置聚合条件,并为聚合条件设置一个名字 + Size(0). // 设置分页参数 - 每页大小,设置为0,代表不返回搜索结果,仅返回聚合分析结果 + Pretty(true). // 返回可读的json格式 + Do(context.Background()) + if err != nil { + return resp, err + } + // 使用Terms函数和前面定义的聚合条件名称,查询结果 + newAgg, found := searchResult.Aggregations.Histogram("result") + if !found { + return resp, errors.New("未聚合出数据") + } + + // 3、组装数据 + var keys []string + var values []int64 + for _, bucket := range newAgg.Buckets { + // 每一个桶都有一个key值,其实就是分组的值,可以理解为SQL的group by值 + bucketValue := bucket.Key + keys = append(keys, utils.Float64ToStr(bucketValue)) + values = append(values, bucket.DocCount) + } + + for k, v := range keys { + value, _ := Operate(values[k], totalCount) + if k+1 == len(keys) { + resp = append(resp, map[string]string{ + "key": v + " ~ " + utils.Float64ToStr(max) + " 元", + "value": utils.Float64ToStrPrec10(value), + }) + } else { + resp = append(resp, map[string]string{ + "key": v + " ~ " + keys[k+1] + " 元", + "value": utils.Float64ToStrPrec10(value), + }) + } + } + } + return resp, nil +} + +// StatisticsUserEggInviteUserNumsRange 统计用户"拉新人数"范围 +func StatisticsUserEggInviteUserNumsRange(esIndexName string) (resp []map[string]string, err error) { + resp = []map[string]string{} + var result *elastic.SearchResult + boolQuery := elastic.NewBoolQuery().Must() // 创建bool查询 + + // 1、 创建 extended_stats 高级统计 + aggs := elastic.NewExtendedStatsAggregation().Field("invite_user_nums") + result, err = es.EsClient.Search(). + Index(esIndexName). + TrackTotalHits(true). + Query(boolQuery). // 设置查询条件 + Aggregation("result", aggs). // 设置聚合条件,并为聚合条件设置一个名字 + Size(0). // 设置分页参数 - 每页大小,设置为0,代表不返回搜索结果,仅返回聚合分析结果 + Pretty(true). // 返回可读的json格式 + Do(context.Background()) + if err != nil { + return resp, err + } + + // 使用Cardinality函数和前面定义的聚合条件名称,查询结果 + agg, found := result.Aggregations.ExtendedStats("result") + if !found { + // 打印结果,注意:这里使用的是取值运算符 + return resp, errors.New("未聚合出数据") + } + + if agg.StdDeviation != nil && *agg.StdDeviation != 0 { + //2、histogram 直方图聚合 + stdDeviation := *agg.StdDeviation //标准平方差 + min := *agg.Min //最小值 + max := *agg.Max //最大值 + avg := *agg.Avg //平均数 + totalCount := agg.Count //总数 + discreteCoefficient := stdDeviation / avg //离散系数 + if stdDeviation < avg { + //TODO::如果标准差相对较小,而平均值较大,离散系数可能会导致较大的间隔,直接使用标准差或其他更合适的值作为间隔。 + discreteCoefficient = stdDeviation + } + newAggs := elastic.NewHistogramAggregation().Field("invite_user_nums").Interval(discreteCoefficient).ExtendedBounds(min, max) + searchResult, err := es.EsClient.Search(). + Index(esIndexName). + TrackTotalHits(true). + Query(boolQuery). // 设置查询条件 + Aggregation("result", newAggs). // 设置聚合条件,并为聚合条件设置一个名字 + Size(0). // 设置分页参数 - 每页大小,设置为0,代表不返回搜索结果,仅返回聚合分析结果 + Pretty(true). // 返回可读的json格式 + Do(context.Background()) + if err != nil { + return resp, err + } + // 使用Terms函数和前面定义的聚合条件名称,查询结果 + newAgg, found := searchResult.Aggregations.Histogram("result") + if !found { + return resp, errors.New("未聚合出数据") + } + + // 3、组装数据 + var keys []string + var values []int64 + for _, bucket := range newAgg.Buckets { + // 每一个桶都有一个key值,其实就是分组的值,可以理解为SQL的group by值 + bucketValue := bucket.Key + keys = append(keys, utils.Float64ToStr(bucketValue)) + values = append(values, bucket.DocCount) + } + + for k, v := range keys { + value, _ := Operate(values[k], totalCount) + if k+1 == len(keys) { + resp = append(resp, map[string]string{ + "key": v + " ~ " + utils.Float64ToStr(max) + " 元", + "value": utils.Float64ToStrPrec10(value), + }) + } else { + resp = append(resp, map[string]string{ + "key": v + " ~ " + keys[k+1] + " 元", + "value": utils.Float64ToStrPrec10(value), + }) + } + } + } + return resp, nil +} + +// StatisticsUserEggTeamActivityNumsRange 统计用户"团队活跃次数"范围 +func StatisticsUserEggTeamActivityNumsRange(esIndexName string) (resp []map[string]string, err error) { + resp = []map[string]string{} + var result *elastic.SearchResult + boolQuery := elastic.NewBoolQuery().Must() // 创建bool查询 + + // 1、 创建 extended_stats 高级统计 + aggs := elastic.NewExtendedStatsAggregation().Field("team_activity_nums") + result, err = es.EsClient.Search(). + Index(esIndexName). + TrackTotalHits(true). + Query(boolQuery). // 设置查询条件 + Aggregation("result", aggs). // 设置聚合条件,并为聚合条件设置一个名字 + Size(0). // 设置分页参数 - 每页大小,设置为0,代表不返回搜索结果,仅返回聚合分析结果 + Pretty(true). // 返回可读的json格式 + Do(context.Background()) + if err != nil { + return resp, err + } + + // 使用Cardinality函数和前面定义的聚合条件名称,查询结果 + agg, found := result.Aggregations.ExtendedStats("result") + if !found { + // 打印结果,注意:这里使用的是取值运算符 + return resp, errors.New("未聚合出数据") + } + + if agg.StdDeviation != nil && *agg.StdDeviation != 0 { + //2、histogram 直方图聚合 + stdDeviation := *agg.StdDeviation //标准平方差 + min := *agg.Min //最小值 + max := *agg.Max //最大值 + avg := *agg.Avg //平均数 + totalCount := agg.Count //总数 + discreteCoefficient := stdDeviation / avg //离散系数 + if stdDeviation < avg { + //TODO::如果标准差相对较小,而平均值较大,离散系数可能会导致较大的间隔,直接使用标准差或其他更合适的值作为间隔。 + discreteCoefficient = stdDeviation + } + newAggs := elastic.NewHistogramAggregation().Field("team_activity_nums").Interval(discreteCoefficient).ExtendedBounds(min, max) + searchResult, err := es.EsClient.Search(). + Index(esIndexName). + TrackTotalHits(true). + Query(boolQuery). // 设置查询条件 + Aggregation("result", newAggs). // 设置聚合条件,并为聚合条件设置一个名字 + Size(0). // 设置分页参数 - 每页大小,设置为0,代表不返回搜索结果,仅返回聚合分析结果 + Pretty(true). // 返回可读的json格式 + Do(context.Background()) + if err != nil { + return resp, err + } + // 使用Terms函数和前面定义的聚合条件名称,查询结果 + newAgg, found := searchResult.Aggregations.Histogram("result") + if !found { + return resp, errors.New("未聚合出数据") + } + + // 3、组装数据 + var keys []string + var values []int64 + for _, bucket := range newAgg.Buckets { + // 每一个桶都有一个key值,其实就是分组的值,可以理解为SQL的group by值 + bucketValue := bucket.Key + keys = append(keys, utils.Float64ToStr(bucketValue)) + values = append(values, bucket.DocCount) + } + + for k, v := range keys { + value, _ := Operate(values[k], totalCount) + if k+1 == len(keys) { + resp = append(resp, map[string]string{ + "key": v + " ~ " + utils.Float64ToStr(max) + " 元", + "value": utils.Float64ToStrPrec10(value), + }) + } else { + resp = append(resp, map[string]string{ + "key": v + " ~ " + keys[k+1] + " 元", + "value": utils.Float64ToStrPrec10(value), + }) + } + } + } + return resp, nil +} + +// StatisticsUserEggSignInNumsRange 统计用户"签到次数"范围 +func StatisticsUserEggSignInNumsRange(esIndexName string) (resp []map[string]string, err error) { + resp = []map[string]string{} + var result *elastic.SearchResult + boolQuery := elastic.NewBoolQuery().Must() // 创建bool查询 + + // 1、 创建 extended_stats 高级统计 + aggs := elastic.NewExtendedStatsAggregation().Field("sign_in_nums") + result, err = es.EsClient.Search(). + Index(esIndexName). + TrackTotalHits(true). + Query(boolQuery). // 设置查询条件 + Aggregation("result", aggs). // 设置聚合条件,并为聚合条件设置一个名字 + Size(0). // 设置分页参数 - 每页大小,设置为0,代表不返回搜索结果,仅返回聚合分析结果 + Pretty(true). // 返回可读的json格式 + Do(context.Background()) + if err != nil { + return resp, err + } + + // 使用Cardinality函数和前面定义的聚合条件名称,查询结果 + agg, found := result.Aggregations.ExtendedStats("result") + if !found { + // 打印结果,注意:这里使用的是取值运算符 + return resp, errors.New("未聚合出数据") + } + + if agg.StdDeviation != nil && *agg.StdDeviation != 0 { + //2、histogram 直方图聚合 + stdDeviation := *agg.StdDeviation //标准平方差 + min := *agg.Min //最小值 + max := *agg.Max //最大值 + avg := *agg.Avg //平均数 + totalCount := agg.Count //总数 + discreteCoefficient := stdDeviation / avg //离散系数 + if stdDeviation < avg { + //TODO::如果标准差相对较小,而平均值较大,离散系数可能会导致较大的间隔,直接使用标准差或其他更合适的值作为间隔。 + discreteCoefficient = stdDeviation + } + newAggs := elastic.NewHistogramAggregation().Field("sign_in_nums").Interval(discreteCoefficient).ExtendedBounds(min, max) + searchResult, err := es.EsClient.Search(). + Index(esIndexName). + TrackTotalHits(true). + Query(boolQuery). // 设置查询条件 + Aggregation("result", newAggs). // 设置聚合条件,并为聚合条件设置一个名字 + Size(0). // 设置分页参数 - 每页大小,设置为0,代表不返回搜索结果,仅返回聚合分析结果 + Pretty(true). // 返回可读的json格式 + Do(context.Background()) + if err != nil { + return resp, err + } + // 使用Terms函数和前面定义的聚合条件名称,查询结果 + newAgg, found := searchResult.Aggregations.Histogram("result") + if !found { + return resp, errors.New("未聚合出数据") + } + + // 3、组装数据 + var keys []string + var values []int64 + for _, bucket := range newAgg.Buckets { + // 每一个桶都有一个key值,其实就是分组的值,可以理解为SQL的group by值 + bucketValue := bucket.Key + keys = append(keys, utils.Float64ToStr(bucketValue)) + values = append(values, bucket.DocCount) + } + + for k, v := range keys { + value, _ := Operate(values[k], totalCount) + if k+1 == len(keys) { + resp = append(resp, map[string]string{ + "key": v + " ~ " + utils.Float64ToStr(max) + " 元", + "value": utils.Float64ToStrPrec10(value), + }) + } else { + resp = append(resp, map[string]string{ + "key": v + " ~ " + keys[k+1] + " 元", + "value": utils.Float64ToStrPrec10(value), + }) + } + } + } + return resp, nil +} + +// StatisticsUserEggSendRedPackageNumsRange 统计用户"发红包次数"范围 +func StatisticsUserEggSendRedPackageNumsRange(esIndexName string) (resp []map[string]string, err error) { + resp = []map[string]string{} + var result *elastic.SearchResult + boolQuery := elastic.NewBoolQuery().Must() // 创建bool查询 + + // 1、 创建 extended_stats 高级统计 + aggs := elastic.NewExtendedStatsAggregation().Field("send_red_package_nums") + result, err = es.EsClient.Search(). + Index(esIndexName). + TrackTotalHits(true). + Query(boolQuery). // 设置查询条件 + Aggregation("result", aggs). // 设置聚合条件,并为聚合条件设置一个名字 + Size(0). // 设置分页参数 - 每页大小,设置为0,代表不返回搜索结果,仅返回聚合分析结果 + Pretty(true). // 返回可读的json格式 + Do(context.Background()) + if err != nil { + return resp, err + } + + // 使用Cardinality函数和前面定义的聚合条件名称,查询结果 + agg, found := result.Aggregations.ExtendedStats("result") + if !found { + // 打印结果,注意:这里使用的是取值运算符 + return resp, errors.New("未聚合出数据") + } + + if agg.StdDeviation != nil && *agg.StdDeviation != 0 { + //2、histogram 直方图聚合 + stdDeviation := *agg.StdDeviation //标准平方差 + min := *agg.Min //最小值 + max := *agg.Max //最大值 + avg := *agg.Avg //平均数 + totalCount := agg.Count //总数 + discreteCoefficient := stdDeviation / avg //离散系数 + if stdDeviation < avg { + //TODO::如果标准差相对较小,而平均值较大,离散系数可能会导致较大的间隔,直接使用标准差或其他更合适的值作为间隔。 + discreteCoefficient = stdDeviation + } + newAggs := elastic.NewHistogramAggregation().Field("send_red_package_nums").Interval(discreteCoefficient).ExtendedBounds(min, max) + searchResult, err := es.EsClient.Search(). + Index(esIndexName). + TrackTotalHits(true). + Query(boolQuery). // 设置查询条件 + Aggregation("result", newAggs). // 设置聚合条件,并为聚合条件设置一个名字 + Size(0). // 设置分页参数 - 每页大小,设置为0,代表不返回搜索结果,仅返回聚合分析结果 + Pretty(true). // 返回可读的json格式 + Do(context.Background()) + if err != nil { + return resp, err + } + // 使用Terms函数和前面定义的聚合条件名称,查询结果 + newAgg, found := searchResult.Aggregations.Histogram("result") + if !found { + return resp, errors.New("未聚合出数据") + } + + // 3、组装数据 + var keys []string + var values []int64 + for _, bucket := range newAgg.Buckets { + // 每一个桶都有一个key值,其实就是分组的值,可以理解为SQL的group by值 + bucketValue := bucket.Key + keys = append(keys, utils.Float64ToStr(bucketValue)) + values = append(values, bucket.DocCount) + } + + for k, v := range keys { + value, _ := Operate(values[k], totalCount) + if k+1 == len(keys) { + resp = append(resp, map[string]string{ + "key": v + " ~ " + utils.Float64ToStr(max) + " 元", + "value": utils.Float64ToStrPrec10(value), + }) + } else { + resp = append(resp, map[string]string{ + "key": v + " ~ " + keys[k+1] + " 元", + "value": utils.Float64ToStrPrec10(value), + }) + } + } + } + return resp, nil +} + +// StatisticsUserEggEggEnergyExchangeAccountBalanceRange 统计用户"蛋蛋能量兑换余额数量"范围 +func StatisticsUserEggEggEnergyExchangeAccountBalanceRange(esIndexName string) (resp []map[string]string, err error) { + resp = []map[string]string{} + var result *elastic.SearchResult + boolQuery := elastic.NewBoolQuery().Must() // 创建bool查询 + + // 1、 创建 extended_stats 高级统计 + aggs := elastic.NewExtendedStatsAggregation().Field("account_balance_exchange_egg_energy_nums") + result, err = es.EsClient.Search(). + Index(esIndexName). + TrackTotalHits(true). + Query(boolQuery). // 设置查询条件 + Aggregation("result", aggs). // 设置聚合条件,并为聚合条件设置一个名字 + Size(0). // 设置分页参数 - 每页大小,设置为0,代表不返回搜索结果,仅返回聚合分析结果 + Pretty(true). // 返回可读的json格式 + Do(context.Background()) + if err != nil { + return resp, err + } + + // 使用Cardinality函数和前面定义的聚合条件名称,查询结果 + agg, found := result.Aggregations.ExtendedStats("result") + if !found { + // 打印结果,注意:这里使用的是取值运算符 + return resp, errors.New("未聚合出数据") + } + + if agg.StdDeviation != nil && *agg.StdDeviation != 0 { + //2、histogram 直方图聚合 + stdDeviation := *agg.StdDeviation //标准平方差 + min := *agg.Min //最小值 + max := *agg.Max //最大值 + avg := *agg.Avg //平均数 + totalCount := agg.Count //总数 + discreteCoefficient := stdDeviation / avg //离散系数 + if stdDeviation < avg { + //TODO::如果标准差相对较小,而平均值较大,离散系数可能会导致较大的间隔,直接使用标准差或其他更合适的值作为间隔。 + discreteCoefficient = stdDeviation + } + newAggs := elastic.NewHistogramAggregation().Field("account_balance_exchange_egg_energy_nums").Interval(discreteCoefficient).ExtendedBounds(min, max) + searchResult, err := es.EsClient.Search(). + Index(esIndexName). + TrackTotalHits(true). + Query(boolQuery). // 设置查询条件 + Aggregation("result", newAggs). // 设置聚合条件,并为聚合条件设置一个名字 + Size(0). // 设置分页参数 - 每页大小,设置为0,代表不返回搜索结果,仅返回聚合分析结果 + Pretty(true). // 返回可读的json格式 + Do(context.Background()) + if err != nil { + return resp, err + } + // 使用Terms函数和前面定义的聚合条件名称,查询结果 + newAgg, found := searchResult.Aggregations.Histogram("result") + if !found { + return resp, errors.New("未聚合出数据") + } + + // 3、组装数据 + var keys []string + var values []int64 + for _, bucket := range newAgg.Buckets { + // 每一个桶都有一个key值,其实就是分组的值,可以理解为SQL的group by值 + bucketValue := bucket.Key + keys = append(keys, utils.Float64ToStr(bucketValue)) + values = append(values, bucket.DocCount) + } + + for k, v := range keys { + value, _ := Operate(values[k], totalCount) + if k+1 == len(keys) { + resp = append(resp, map[string]string{ + "key": v + " ~ " + utils.Float64ToStr(max) + " 元", + "value": utils.Float64ToStrPrec10(value), + }) + } else { + resp = append(resp, map[string]string{ + "key": v + " ~ " + keys[k+1] + " 元", + "value": utils.Float64ToStrPrec10(value), + }) + } + } + } + return resp, nil +} + +// StatisticsUserEggAccountBalanceExchangeEggEnergyNumsRange 统计用户"余额兑换蛋蛋能量数量"范围 +func StatisticsUserEggAccountBalanceExchangeEggEnergyNumsRange(esIndexName string) (resp []map[string]string, err error) { + resp = []map[string]string{} + var result *elastic.SearchResult + boolQuery := elastic.NewBoolQuery().Must() // 创建bool查询 + + // 1、 创建 extended_stats 高级统计 + aggs := elastic.NewExtendedStatsAggregation().Field("egg_energy_exchange_account_balance") + result, err = es.EsClient.Search(). + Index(esIndexName). + TrackTotalHits(true). + Query(boolQuery). // 设置查询条件 + Aggregation("result", aggs). // 设置聚合条件,并为聚合条件设置一个名字 + Size(0). // 设置分页参数 - 每页大小,设置为0,代表不返回搜索结果,仅返回聚合分析结果 + Pretty(true). // 返回可读的json格式 + Do(context.Background()) + if err != nil { + return resp, err + } + + // 使用Cardinality函数和前面定义的聚合条件名称,查询结果 + agg, found := result.Aggregations.ExtendedStats("result") + if !found { + // 打印结果,注意:这里使用的是取值运算符 + return resp, errors.New("未聚合出数据") + } + + if agg.StdDeviation != nil && *agg.StdDeviation != 0 { + //2、histogram 直方图聚合 + stdDeviation := *agg.StdDeviation //标准平方差 + min := *agg.Min //最小值 + max := *agg.Max //最大值 + avg := *agg.Avg //平均数 + totalCount := agg.Count //总数 + discreteCoefficient := stdDeviation / avg //离散系数 + if stdDeviation < avg { + //TODO::如果标准差相对较小,而平均值较大,离散系数可能会导致较大的间隔,直接使用标准差或其他更合适的值作为间隔。 + discreteCoefficient = stdDeviation + } + newAggs := elastic.NewHistogramAggregation().Field("egg_energy_exchange_account_balance").Interval(discreteCoefficient).ExtendedBounds(min, max) + searchResult, err := es.EsClient.Search(). + Index(esIndexName). + TrackTotalHits(true). + Query(boolQuery). // 设置查询条件 + Aggregation("result", newAggs). // 设置聚合条件,并为聚合条件设置一个名字 + Size(0). // 设置分页参数 - 每页大小,设置为0,代表不返回搜索结果,仅返回聚合分析结果 + Pretty(true). // 返回可读的json格式 + Do(context.Background()) + if err != nil { + return resp, err + } + // 使用Terms函数和前面定义的聚合条件名称,查询结果 + newAgg, found := searchResult.Aggregations.Histogram("result") + if !found { + return resp, errors.New("未聚合出数据") + } + + // 3、组装数据 + var keys []string + var values []int64 + for _, bucket := range newAgg.Buckets { + // 每一个桶都有一个key值,其实就是分组的值,可以理解为SQL的group by值 + bucketValue := bucket.Key + keys = append(keys, utils.Float64ToStr(bucketValue)) + values = append(values, bucket.DocCount) + } + + for k, v := range keys { + value, _ := Operate(values[k], totalCount) + if k+1 == len(keys) { + resp = append(resp, map[string]string{ + "key": v + " ~ " + utils.Float64ToStr(max) + " 元", + "value": utils.Float64ToStrPrec10(value), + }) + } else { + resp = append(resp, map[string]string{ + "key": v + " ~ " + keys[k+1] + " 元", + "value": utils.Float64ToStrPrec10(value), + }) + } + } + } + return resp, nil +} + +// StatisticsUserEggSendCircleOfFriendNumsRange 统计用户"发朋友圈次数"范围 +func StatisticsUserEggSendCircleOfFriendNumsRange(esIndexName string) (resp []map[string]string, err error) { + resp = []map[string]string{} + var result *elastic.SearchResult + boolQuery := elastic.NewBoolQuery().Must() // 创建bool查询 + + // 1、 创建 extended_stats 高级统计 + aggs := elastic.NewExtendedStatsAggregation().Field("send_circle_of_friend_nums") + result, err = es.EsClient.Search(). + Index(esIndexName). + TrackTotalHits(true). + Query(boolQuery). // 设置查询条件 + Aggregation("result", aggs). // 设置聚合条件,并为聚合条件设置一个名字 + Size(0). // 设置分页参数 - 每页大小,设置为0,代表不返回搜索结果,仅返回聚合分析结果 + Pretty(true). // 返回可读的json格式 + Do(context.Background()) + if err != nil { + return resp, err + } + + // 使用Cardinality函数和前面定义的聚合条件名称,查询结果 + agg, found := result.Aggregations.ExtendedStats("result") + if !found { + // 打印结果,注意:这里使用的是取值运算符 + return resp, errors.New("未聚合出数据") + } + + if agg.StdDeviation != nil && *agg.StdDeviation != 0 { + //2、histogram 直方图聚合 + stdDeviation := *agg.StdDeviation //标准平方差 + min := *agg.Min //最小值 + max := *agg.Max //最大值 + avg := *agg.Avg //平均数 + totalCount := agg.Count //总数 + discreteCoefficient := stdDeviation / avg //离散系数 + if stdDeviation < avg { + //TODO::如果标准差相对较小,而平均值较大,离散系数可能会导致较大的间隔,直接使用标准差或其他更合适的值作为间隔。 + discreteCoefficient = stdDeviation + } + newAggs := elastic.NewHistogramAggregation().Field("send_circle_of_friend_nums").Interval(discreteCoefficient).ExtendedBounds(min, max) + searchResult, err := es.EsClient.Search(). + Index(esIndexName). + TrackTotalHits(true). + Query(boolQuery). // 设置查询条件 + Aggregation("result", newAggs). // 设置聚合条件,并为聚合条件设置一个名字 + Size(0). // 设置分页参数 - 每页大小,设置为0,代表不返回搜索结果,仅返回聚合分析结果 + Pretty(true). // 返回可读的json格式 + Do(context.Background()) + if err != nil { + return resp, err + } + // 使用Terms函数和前面定义的聚合条件名称,查询结果 + newAgg, found := searchResult.Aggregations.Histogram("result") + if !found { + return resp, errors.New("未聚合出数据") + } + + // 3、组装数据 + var keys []string + var values []int64 + for _, bucket := range newAgg.Buckets { + // 每一个桶都有一个key值,其实就是分组的值,可以理解为SQL的group by值 + bucketValue := bucket.Key + keys = append(keys, utils.Float64ToStr(bucketValue)) + values = append(values, bucket.DocCount) + } + + for k, v := range keys { + value, _ := Operate(values[k], totalCount) + if k+1 == len(keys) { + resp = append(resp, map[string]string{ + "key": v + " ~ " + utils.Float64ToStr(max) + " 元", + "value": utils.Float64ToStrPrec10(value), + }) + } else { + resp = append(resp, map[string]string{ + "key": v + " ~ " + keys[k+1] + " 元", + "value": utils.Float64ToStrPrec10(value), + }) + } + } + } + return resp, nil +} + +// StatisticsUserEggForumCommentsNumsRange 统计用户"论坛评论次数"范围 +func StatisticsUserEggForumCommentsNumsRange(esIndexName string) (resp []map[string]string, err error) { + resp = []map[string]string{} + var result *elastic.SearchResult + boolQuery := elastic.NewBoolQuery().Must() // 创建bool查询 + + // 1、 创建 extended_stats 高级统计 + aggs := elastic.NewExtendedStatsAggregation().Field("forum_comments_nums") + result, err = es.EsClient.Search(). + Index(esIndexName). + TrackTotalHits(true). + Query(boolQuery). // 设置查询条件 + Aggregation("result", aggs). // 设置聚合条件,并为聚合条件设置一个名字 + Size(0). // 设置分页参数 - 每页大小,设置为0,代表不返回搜索结果,仅返回聚合分析结果 + Pretty(true). // 返回可读的json格式 + Do(context.Background()) + if err != nil { + return resp, err + } + + // 使用Cardinality函数和前面定义的聚合条件名称,查询结果 + agg, found := result.Aggregations.ExtendedStats("result") + if !found { + // 打印结果,注意:这里使用的是取值运算符 + return resp, errors.New("未聚合出数据") + } + + if agg.StdDeviation != nil && *agg.StdDeviation != 0 { + //2、histogram 直方图聚合 + stdDeviation := *agg.StdDeviation //标准平方差 + min := *agg.Min //最小值 + max := *agg.Max //最大值 + avg := *agg.Avg //平均数 + totalCount := agg.Count //总数 + discreteCoefficient := stdDeviation / avg //离散系数 + if stdDeviation < avg { + //TODO::如果标准差相对较小,而平均值较大,离散系数可能会导致较大的间隔,直接使用标准差或其他更合适的值作为间隔。 + discreteCoefficient = stdDeviation + } + newAggs := elastic.NewHistogramAggregation().Field("forum_comments_nums").Interval(discreteCoefficient).ExtendedBounds(min, max) + searchResult, err := es.EsClient.Search(). + Index(esIndexName). + TrackTotalHits(true). + Query(boolQuery). // 设置查询条件 + Aggregation("result", newAggs). // 设置聚合条件,并为聚合条件设置一个名字 + Size(0). // 设置分页参数 - 每页大小,设置为0,代表不返回搜索结果,仅返回聚合分析结果 + Pretty(true). // 返回可读的json格式 + Do(context.Background()) + if err != nil { + return resp, err + } + // 使用Terms函数和前面定义的聚合条件名称,查询结果 + newAgg, found := searchResult.Aggregations.Histogram("result") + if !found { + return resp, errors.New("未聚合出数据") + } + + // 3、组装数据 + var keys []string + var values []int64 + for _, bucket := range newAgg.Buckets { + // 每一个桶都有一个key值,其实就是分组的值,可以理解为SQL的group by值 + bucketValue := bucket.Key + keys = append(keys, utils.Float64ToStr(bucketValue)) + values = append(values, bucket.DocCount) + } + + for k, v := range keys { + value, _ := Operate(values[k], totalCount) + if k+1 == len(keys) { + resp = append(resp, map[string]string{ + "key": v + " ~ " + utils.Float64ToStr(max) + " 元", + "value": utils.Float64ToStrPrec10(value), + }) + } else { + resp = append(resp, map[string]string{ + "key": v + " ~ " + keys[k+1] + " 元", + "value": utils.Float64ToStrPrec10(value), + }) + } + } + } + return resp, nil +} + +// StatisticsUserEggCollegeLearningNumsRange 统计用户"学院学习次数"范围 +func StatisticsUserEggCollegeLearningNumsRange(esIndexName string) (resp []map[string]string, err error) { + resp = []map[string]string{} + var result *elastic.SearchResult + boolQuery := elastic.NewBoolQuery().Must() // 创建bool查询 + + // 1、 创建 extended_stats 高级统计 + aggs := elastic.NewExtendedStatsAggregation().Field("college_learning_nums") + result, err = es.EsClient.Search(). + Index(esIndexName). + TrackTotalHits(true). + Query(boolQuery). // 设置查询条件 + Aggregation("result", aggs). // 设置聚合条件,并为聚合条件设置一个名字 + Size(0). // 设置分页参数 - 每页大小,设置为0,代表不返回搜索结果,仅返回聚合分析结果 + Pretty(true). // 返回可读的json格式 + Do(context.Background()) + if err != nil { + return resp, err + } + + // 使用Cardinality函数和前面定义的聚合条件名称,查询结果 + agg, found := result.Aggregations.ExtendedStats("result") + if !found { + // 打印结果,注意:这里使用的是取值运算符 + return resp, errors.New("未聚合出数据") + } + + if agg.StdDeviation != nil && *agg.StdDeviation != 0 { + //2、histogram 直方图聚合 + stdDeviation := *agg.StdDeviation //标准平方差 + min := *agg.Min //最小值 + max := *agg.Max //最大值 + avg := *agg.Avg //平均数 + totalCount := agg.Count //总数 + discreteCoefficient := stdDeviation / avg //离散系数 + if stdDeviation < avg { + //TODO::如果标准差相对较小,而平均值较大,离散系数可能会导致较大的间隔,直接使用标准差或其他更合适的值作为间隔。 + discreteCoefficient = stdDeviation + } + newAggs := elastic.NewHistogramAggregation().Field("college_learning_nums").Interval(discreteCoefficient).ExtendedBounds(min, max) + searchResult, err := es.EsClient.Search(). + Index(esIndexName). + TrackTotalHits(true). + Query(boolQuery). // 设置查询条件 + Aggregation("result", newAggs). // 设置聚合条件,并为聚合条件设置一个名字 + Size(0). // 设置分页参数 - 每页大小,设置为0,代表不返回搜索结果,仅返回聚合分析结果 + Pretty(true). // 返回可读的json格式 + Do(context.Background()) + if err != nil { + return resp, err + } + // 使用Terms函数和前面定义的聚合条件名称,查询结果 + newAgg, found := searchResult.Aggregations.Histogram("result") + if !found { + return resp, errors.New("未聚合出数据") + } + + // 3、组装数据 + var keys []string + var values []int64 + for _, bucket := range newAgg.Buckets { + // 每一个桶都有一个key值,其实就是分组的值,可以理解为SQL的group by值 + bucketValue := bucket.Key + keys = append(keys, utils.Float64ToStr(bucketValue)) + values = append(values, bucket.DocCount) + } + + for k, v := range keys { + value, _ := Operate(values[k], totalCount) + if k+1 == len(keys) { + resp = append(resp, map[string]string{ + "key": v + " ~ " + utils.Float64ToStr(max) + " 元", + "value": utils.Float64ToStrPrec10(value), + }) + } else { + resp = append(resp, map[string]string{ + "key": v + " ~ " + keys[k+1] + " 元", + "value": utils.Float64ToStrPrec10(value), + }) + } + } + } + return resp, nil +} + +// StatisticsUserEggViolateNumsRange 统计用户"违规次数"范围 +func StatisticsUserEggViolateNumsRange(esIndexName string) (resp []map[string]string, err error) { + resp = []map[string]string{} + var result *elastic.SearchResult + boolQuery := elastic.NewBoolQuery().Must() // 创建bool查询 + + // 1、 创建 extended_stats 高级统计 + aggs := elastic.NewExtendedStatsAggregation().Field("violate_nums") + result, err = es.EsClient.Search(). + Index(esIndexName). + TrackTotalHits(true). + Query(boolQuery). // 设置查询条件 + Aggregation("result", aggs). // 设置聚合条件,并为聚合条件设置一个名字 + Size(0). // 设置分页参数 - 每页大小,设置为0,代表不返回搜索结果,仅返回聚合分析结果 + Pretty(true). // 返回可读的json格式 + Do(context.Background()) + if err != nil { + return resp, err + } + + // 使用Cardinality函数和前面定义的聚合条件名称,查询结果 + agg, found := result.Aggregations.ExtendedStats("result") + if !found { + // 打印结果,注意:这里使用的是取值运算符 + return resp, errors.New("未聚合出数据") + } + + if agg.StdDeviation != nil && *agg.StdDeviation != 0 { + //2、histogram 直方图聚合 + stdDeviation := *agg.StdDeviation //标准平方差 + min := *agg.Min //最小值 + max := *agg.Max //最大值 + avg := *agg.Avg //平均数 + totalCount := agg.Count //总数 + discreteCoefficient := stdDeviation / avg //离散系数 + if stdDeviation < avg { + //TODO::如果标准差相对较小,而平均值较大,离散系数可能会导致较大的间隔,直接使用标准差或其他更合适的值作为间隔。 + discreteCoefficient = stdDeviation + } + newAggs := elastic.NewHistogramAggregation().Field("violate_nums").Interval(discreteCoefficient).ExtendedBounds(min, max) + searchResult, err := es.EsClient.Search(). + Index(esIndexName). + TrackTotalHits(true). + Query(boolQuery). // 设置查询条件 + Aggregation("result", newAggs). // 设置聚合条件,并为聚合条件设置一个名字 + Size(0). // 设置分页参数 - 每页大小,设置为0,代表不返回搜索结果,仅返回聚合分析结果 + Pretty(true). // 返回可读的json格式 + Do(context.Background()) + if err != nil { + return resp, err + } + // 使用Terms函数和前面定义的聚合条件名称,查询结果 + newAgg, found := searchResult.Aggregations.Histogram("result") + if !found { + return resp, errors.New("未聚合出数据") + } + + // 3、组装数据 + var keys []string + var values []int64 + for _, bucket := range newAgg.Buckets { + // 每一个桶都有一个key值,其实就是分组的值,可以理解为SQL的group by值 + bucketValue := bucket.Key + keys = append(keys, utils.Float64ToStr(bucketValue)) + values = append(values, bucket.DocCount) + } + + for k, v := range keys { + value, _ := Operate(values[k], totalCount) + if k+1 == len(keys) { + resp = append(resp, map[string]string{ + "key": v + " ~ " + utils.Float64ToStr(max) + " 元", + "value": utils.Float64ToStrPrec10(value), + }) + } else { + resp = append(resp, map[string]string{ + "key": v + " ~ " + keys[k+1] + " 元", + "value": utils.Float64ToStrPrec10(value), + }) + } + } + } + return resp, nil +} + +// StatisticsUserEggBrowseInterfaceNumsRange 统计用户"浏览界面次数"范围 +func StatisticsUserEggBrowseInterfaceNumsRange(esIndexName string) (resp []map[string]string, err error) { + resp = []map[string]string{} + var result *elastic.SearchResult + boolQuery := elastic.NewBoolQuery().Must() // 创建bool查询 + + // 1、 创建 extended_stats 高级统计 + aggs := elastic.NewExtendedStatsAggregation().Field("browse_interface_nums") + result, err = es.EsClient.Search(). + Index(esIndexName). + TrackTotalHits(true). + Query(boolQuery). // 设置查询条件 + Aggregation("result", aggs). // 设置聚合条件,并为聚合条件设置一个名字 + Size(0). // 设置分页参数 - 每页大小,设置为0,代表不返回搜索结果,仅返回聚合分析结果 + Pretty(true). // 返回可读的json格式 + Do(context.Background()) + if err != nil { + return resp, err + } + + // 使用Cardinality函数和前面定义的聚合条件名称,查询结果 + agg, found := result.Aggregations.ExtendedStats("result") + if !found { + // 打印结果,注意:这里使用的是取值运算符 + return resp, errors.New("未聚合出数据") + } + + if agg.StdDeviation != nil && *agg.StdDeviation != 0 { + //2、histogram 直方图聚合 + stdDeviation := *agg.StdDeviation //标准平方差 + min := *agg.Min //最小值 + max := *agg.Max //最大值 + avg := *agg.Avg //平均数 + totalCount := agg.Count //总数 + discreteCoefficient := stdDeviation / avg //离散系数 + if stdDeviation < avg { + //TODO::如果标准差相对较小,而平均值较大,离散系数可能会导致较大的间隔,直接使用标准差或其他更合适的值作为间隔。 + discreteCoefficient = stdDeviation + } + newAggs := elastic.NewHistogramAggregation().Field("browse_interface_nums").Interval(discreteCoefficient).ExtendedBounds(min, max) + searchResult, err := es.EsClient.Search(). + Index(esIndexName). + TrackTotalHits(true). + Query(boolQuery). // 设置查询条件 + Aggregation("result", newAggs). // 设置聚合条件,并为聚合条件设置一个名字 + Size(0). // 设置分页参数 - 每页大小,设置为0,代表不返回搜索结果,仅返回聚合分析结果 + Pretty(true). // 返回可读的json格式 + Do(context.Background()) + if err != nil { + return resp, err + } + // 使用Terms函数和前面定义的聚合条件名称,查询结果 + newAgg, found := searchResult.Aggregations.Histogram("result") + if !found { + return resp, errors.New("未聚合出数据") + } + + // 3、组装数据 + var keys []string + var values []int64 + for _, bucket := range newAgg.Buckets { + // 每一个桶都有一个key值,其实就是分组的值,可以理解为SQL的group by值 + bucketValue := bucket.Key + keys = append(keys, utils.Float64ToStr(bucketValue)) + values = append(values, bucket.DocCount) + } + + for k, v := range keys { + value, _ := Operate(values[k], totalCount) + if k+1 == len(keys) { + resp = append(resp, map[string]string{ + "key": v + " ~ " + utils.Float64ToStr(max) + " 元", + "value": utils.Float64ToStrPrec10(value), + }) + } else { + resp = append(resp, map[string]string{ + "key": v + " ~ " + keys[k+1] + " 元", + "value": utils.Float64ToStrPrec10(value), + }) + } + } + } + return resp, nil +} + +// StatisticsUserEggPersonAddActivityValueRange 统计用户"个人活跃积分增量值"范围 +func StatisticsUserEggPersonAddActivityValueRange(esIndexName string) (resp []map[string]string, err error) { + resp = []map[string]string{} + var result *elastic.SearchResult + boolQuery := elastic.NewBoolQuery().Must() // 创建bool查询 + + // 1、 创建 extended_stats 高级统计 + aggs := elastic.NewExtendedStatsAggregation().Field("person_add_activity_value") + result, err = es.EsClient.Search(). + Index(esIndexName). + TrackTotalHits(true). + Query(boolQuery). // 设置查询条件 + Aggregation("result", aggs). // 设置聚合条件,并为聚合条件设置一个名字 + Size(0). // 设置分页参数 - 每页大小,设置为0,代表不返回搜索结果,仅返回聚合分析结果 + Pretty(true). // 返回可读的json格式 + Do(context.Background()) + if err != nil { + return resp, err + } + + // 使用Cardinality函数和前面定义的聚合条件名称,查询结果 + agg, found := result.Aggregations.ExtendedStats("result") + if !found { + // 打印结果,注意:这里使用的是取值运算符 + return resp, errors.New("未聚合出数据") + } + + if agg.StdDeviation != nil && *agg.StdDeviation != 0 { + //2、histogram 直方图聚合 + stdDeviation := *agg.StdDeviation //标准平方差 + min := *agg.Min //最小值 + max := *agg.Max //最大值 + avg := *agg.Avg //平均数 + totalCount := agg.Count //总数 + discreteCoefficient := stdDeviation / avg //离散系数 + if stdDeviation < avg { + //TODO::如果标准差相对较小,而平均值较大,离散系数可能会导致较大的间隔,直接使用标准差或其他更合适的值作为间隔。 + discreteCoefficient = stdDeviation + } + newAggs := elastic.NewHistogramAggregation().Field("person_add_activity_value").Interval(discreteCoefficient).ExtendedBounds(min, max) + searchResult, err := es.EsClient.Search(). + Index(esIndexName). + TrackTotalHits(true). + Query(boolQuery). // 设置查询条件 + Aggregation("result", newAggs). // 设置聚合条件,并为聚合条件设置一个名字 + Size(0). // 设置分页参数 - 每页大小,设置为0,代表不返回搜索结果,仅返回聚合分析结果 + Pretty(true). // 返回可读的json格式 + Do(context.Background()) + if err != nil { + return resp, err + } + // 使用Terms函数和前面定义的聚合条件名称,查询结果 + newAgg, found := searchResult.Aggregations.Histogram("result") + if !found { + return resp, errors.New("未聚合出数据") + } + + // 3、组装数据 + var keys []string + var values []int64 + for _, bucket := range newAgg.Buckets { + // 每一个桶都有一个key值,其实就是分组的值,可以理解为SQL的group by值 + bucketValue := bucket.Key + keys = append(keys, utils.Float64ToStr(bucketValue)) + values = append(values, bucket.DocCount) + } + + for k, v := range keys { + value, _ := Operate(values[k], totalCount) + if k+1 == len(keys) { + resp = append(resp, map[string]string{ + "key": v + " ~ " + utils.Float64ToStr(max) + " 元", + "value": utils.Float64ToStrPrec10(value), + }) + } else { + resp = append(resp, map[string]string{ + "key": v + " ~ " + keys[k+1] + " 元", + "value": utils.Float64ToStrPrec10(value), + }) + } + } + } + return resp, nil +} + +func GetYearsAndWeeks() (resp map[string][]string, err error) { + // 1、 获取到所有的索引 + indices, err := es.GetIndexFromAlias(md.EggEnergyUserEggScoreEsAlias) + if err != nil { + return nil, err + } + + //2、组装数据 + resp = map[string][]string{} + for _, index := range indices { + // 分割字符串 + parts := strings.Split(index, "_") + + // 提取 2024 和 46 + resp[parts[len(parts)-1][:4]] = append(resp[parts[len(parts)-1][:4]], parts[len(parts)-1][4:]) + } + return +} + +func GetYearsAndWeekStr(esIndexName string) (string, string) { + parts := strings.Split(esIndexName, "_") + return parts[len(parts)-1][:4], parts[len(parts)-1][4:] +} + +// Operate 除运算保留10位小数 +func Operate(num1, num2 int64) (float64, error) { + value, err := strconv.ParseFloat(fmt.Sprintf("%.10f", float64(num1)/float64(num2)), 64) + if err != nil { + return 0, err + } + return value, nil +} diff --git a/app/task/svc/svc_egg_energy_modify_price.go b/app/task/svc/svc_egg_energy_modify_price.go deleted file mode 100644 index bcf64b5..0000000 --- a/app/task/svc/svc_egg_energy_modify_price.go +++ /dev/null @@ -1,56 +0,0 @@ -package svc - -import ( - "applet/app/cfg" - "applet/app/utils" - "applet/app/utils/cache" - "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" - "code.fnuoos.com/EggPlanet/egg_system_rules.git" - "code.fnuoos.com/EggPlanet/egg_system_rules.git/enum" - "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/md" - "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/svc" - "fmt" - "xorm.io/xorm" -) - -// EggEnergyModifyPrice 蛋蛋能量-价格调整 -func EggEnergyModifyPrice(engine *xorm.Engine) { - fmt.Println("modify_price...") - defer func() { - if err := recover(); err != nil { - fmt.Println(err) - return - } - }() - - // 1. 获取并解析价格设置 - conn := cache.GetPool().Get() - cfgDb := implement.NewSysCfgDb(engine, conn) - settingStr, err1 := cfgDb.SysCfgGetOne(enum.PriceSetting) - if err1 != nil { - fmt.Println("EggEnergyModifyPrice_ERR:::::", err1.Error()) - return - } - var setting md.PriceSettingStruct - utils.Unserialize([]byte(settingStr.Val), &setting) - - // 2. 查询当前价格 - egg_system_rules.Init(cfg.RedisAddr) - eggEnergyCoreData, cb, err2 := svc.GetEggEnergyCoreData(engine) - if err2 != nil { - fmt.Println("EggEnergyModifyPrice_ERR:::::", err2.Error()) - return - } - if cb != nil { - defer cb() // 释放锁 - } - - // 3.判断价格是否在范围内 - if eggEnergyCoreData.NowPrice > setting.PriceBelowValue && eggEnergyCoreData.NowPrice < setting.PriceBelowValue { - // 3.1 在价格范围内 - return - } else { - // 3.2 不在价格范围内 调整价格 - // todo 调整价格 - } -} diff --git a/app/task/svc/svc_egg_energy_user_egg_score_auto_create_es_index.go b/app/task/svc/svc_egg_energy_user_egg_score_auto_create_es_index.go new file mode 100644 index 0000000..d763b24 --- /dev/null +++ b/app/task/svc/svc_egg_energy_user_egg_score_auto_create_es_index.go @@ -0,0 +1,46 @@ +package svc + +import ( + "applet/app/utils" + "applet/app/utils/logx" + "code.fnuoos.com/EggPlanet/egg_system_rules.git/md" + "code.fnuoos.com/go_rely_warehouse/zyos_go_es.git/es" + "fmt" + "time" +) + +// EggEnergyUserEggScoreAutoCreateEsIndex 蛋蛋能量-自动创建蛋蛋分elasticsearch索引 +func EggEnergyUserEggScoreAutoCreateEsIndex() { + fmt.Println("svc_egg_energy_user_egg_score_auto_create_es_index...") + defer func() { + if err := recover(); err != nil { + fmt.Println(err) + return + } + }() + + now := time.Now() + fmt.Println(now.Hour()) + if !(now.Hour() >= 0 && now.Hour() < 2) { + //TODO::只在凌晨一点 ~ 凌晨 2 点运行 + return + } + + //1、获取当前为本年第几周 + year, week := now.ISOWeek() + esIndex := md.EggEnergyUserEggScoreEsAlias + "_" + utils.IntToStr(year) + utils.IntToStr(week) + nowEsIndex, err := es.GetLatestIndexFromAlias(md.EggEnergyUserEggScoreEsAlias) + if err != nil { + logx.Warn("EggEnergyUserEggScoreAutoCreateEsIndex:::", err) + return + } + + if esIndex != nowEsIndex { + //2、创建新的索引 + err = es.CreateIndexIfNotExists(esIndex, md.EggEnergyUserEggScoreEsMapping) + if err != nil { + logx.Warn("EggEnergyUserEggScoreAutoCreateEsIndex:::", err) + } + } + return +} diff --git a/app/task/svc/utils_test.go b/app/task/svc/utils_test.go new file mode 100644 index 0000000..1aeb7d8 --- /dev/null +++ b/app/task/svc/utils_test.go @@ -0,0 +1,12 @@ +package svc + +import ( + "code.fnuoos.com/go_rely_warehouse/zyos_go_es.git/es" + "testing" +) + +func TestEggEnergyUserEggScoreAutoCreateEsIndex(t *testing.T) { + es.Init("http://120.55.48.175:9200", "elastic", "fnuo123") + EggEnergyUserEggScoreAutoCreateEsIndex() + //fmt.Printf("esIndex ==> %+v \n\n", index) +} diff --git a/app/utils/convert.go b/app/utils/convert.go index a638d37..2655f93 100644 --- a/app/utils/convert.go +++ b/app/utils/convert.go @@ -276,7 +276,9 @@ func Float64ToStr(f float64) string { func Float64ToStrPrec1(f float64) string { return strconv.FormatFloat(f, 'f', 1, 64) } - +func Float64ToStrPrec10(f float64) string { + return strconv.FormatFloat(f, 'f', 10, 64) +} func Float32ToStr(f float32) string { return Float64ToStr(float64(f)) } diff --git a/docs/docs.go b/docs/docs.go index 1adf59f..d7ab54b 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -233,6 +233,147 @@ const docTemplate = `{ } } }, + "/api/institutionalManagement/eggEnergy/eggPoint/manualScore": { + "post": { + "description": "蛋蛋分管理(人工打分)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "蛋蛋能量" + ], + "summary": "制度中心-蛋蛋能量-蛋蛋分管理(人工打分)", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "请求参数", + "name": "req", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.ManualScoreReq" + } + } + ], + "responses": { + "200": { + "description": "成功返回", + "schema": { + "type": "string" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, + "/api/institutionalManagement/eggEnergy/eggPoint/statisticsUserEggIndex": { + "post": { + "description": "蛋蛋分管理(着陆页数据分析)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "蛋蛋能量" + ], + "summary": "制度中心-蛋蛋能量-蛋蛋分管理(着陆页数据分析)", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "请求参数", + "name": "req", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.StatisticsEggPointReq" + } + } + ], + "responses": { + "200": { + "description": "成功返回", + "schema": { + "$ref": "#/definitions/md.StatisticsEggPointResp" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, + "/api/institutionalManagement/eggEnergy/eggPoint/userEggFlow": { + "post": { + "description": "蛋蛋分管理(用户数据列表)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "蛋蛋能量" + ], + "summary": "制度中心-蛋蛋能量-蛋蛋分管理(用户数据列表)", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "请求参数", + "name": "req", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.UserEggFlowReq" + } + } + ], + "responses": { + "200": { + "description": "成功返回", + "schema": { + "$ref": "#/definitions/md.UserEggFlowReqResp" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, "/api/institutionalManagement/eggEnergy/getBasic": { "get": { "description": "基础设置(获取)", @@ -1730,6 +1871,100 @@ const docTemplate = `{ } } } + }, + "/api/memberCenter/userManagement/getUserList": { + "post": { + "description": "用户信息管理(获取)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "会员中心" + ], + "summary": "制度中心-会员中心-用户信息管理(获取)", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "分页信息必填", + "name": "req", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.UserManagementGetUserListReq" + } + } + ], + "responses": { + "200": { + "description": "具体数据", + "schema": { + "$ref": "#/definitions/md.UserManagementGetUserListResp" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, + "/api/memberCenter/userManagement/updateUserInfo": { + "post": { + "description": "用户信息管理(更新)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "会员中心" + ], + "summary": "制度中心-会员中心-用户信息管理(更新)", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "用户ID 必传", + "name": "req", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.UserManagementUpdateUserInfoReq" + } + } + ], + "responses": { + "200": { + "description": "修改数据行数", + "schema": { + "type": "int" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } } }, "definitions": { @@ -1783,6 +2018,23 @@ const docTemplate = `{ } } }, + "applet_app_md_institutional_management_member_center.Paginate": { + "type": "object", + "properties": { + "limit": { + "description": "每页大小", + "type": "integer" + }, + "page": { + "description": "页数", + "type": "integer" + }, + "total": { + "description": "总数据量", + "type": "integer" + } + } + }, "applet_app_md_institutional_management_new_user_red_package.Paginate": { "type": "object", "properties": { @@ -3074,6 +3326,19 @@ const docTemplate = `{ } } }, + "md.ManualScoreReq": { + "type": "object", + "properties": { + "index_id": { + "description": "文档id", + "type": "string" + }, + "score": { + "type": "string", + "example": "分数" + } + } + }, "md.NewUserRedPackageGetBasicResp": { "type": "object", "properties": { @@ -3478,43 +3743,227 @@ const docTemplate = `{ } } }, - "md.SubUser": { + "md.StatisticsEggPointReq": { "type": "object", "properties": { - "avatar_url": { - "type": "string", - "example": "头像" - }, - "level": { - "description": "整个系统中的等级", - "type": "integer" - }, - "nickname": { + "week": { "type": "string", - "example": "昵称" + "example": "周份" }, - "phone": { + "year": { "type": "string", - "example": "手机号" - }, - "pid": { - "type": "integer" - }, - "position": { - "description": "以pid1为创始人中网的位置", - "type": "integer" - }, - "uid": { - "type": "integer" + "example": "年份" } } }, - "md.TeamRewardSettingStruct": { + "md.StatisticsEggPointResp": { "type": "object", "properties": { - "member_self_is_open_get_team_reward": { - "description": "会员是否活跃得到团队奖励", - "type": "string" + "statistics_user_egg_account_balance_exchange_egg_energy_nums_range": { + "description": "统计用户\"余额兑换蛋蛋能量数量\"范围", + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "statistics_user_egg_browse_interface_nums_range": { + "description": "统计用户\"浏览界面次数\"范围", + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "statistics_user_egg_college_learning_nums_range": { + "description": "统计用户\"学院学习次数\"范围", + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "statistics_user_egg_ecpm_range": { + "description": "统计用户\"ecpm\"范围", + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "statistics_user_egg_egg_energy_exchange_account_balance_range": { + "description": "统计用户\"蛋蛋能量兑换余额数量\"范围", + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "statistics_user_egg_forum_comments_nums_range": { + "description": "统计用户\"论坛评论次数\"范围", + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "statistics_user_egg_invite_user_nums_range": { + "description": "统计用户\"拉新人数\"范围", + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "statistics_user_egg_kind_proportion": { + "description": "统计用户蛋蛋分\"评比类型\"占比", + "type": "array", + "items": { + "type": "object", + "additionalProperties": true + } + }, + "statistics_user_egg_person_add_activity_value_range": { + "description": "统计用户\"个人活跃积分增量值\"范围", + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "statistics_user_egg_score_value_range": { + "description": "统计用户蛋蛋分范围", + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "statistics_user_egg_send_circle_of_friend_nums_range": { + "description": "统计用户\"发朋友圈次数\"范围", + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "statistics_user_egg_send_red_package_nums_range": { + "description": "统计用户\"发红包次数\"范围", + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "statistics_user_egg_sign_in_nums_range": { + "description": "统计用户\"签到次数\"范围", + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "statistics_user_egg_team_activity_nums_range": { + "description": "统计用户\"团队活跃次数\"范围", + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "statistics_user_egg_violate_nums_range": { + "description": "统计用户\"违规次数\"范围", + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "week": { + "type": "string", + "example": "周份" + }, + "year": { + "type": "string", + "example": "年份" + }, + "year_list": { + "description": "年份\u0026\u0026周份列表", + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + }, + "md.SubUser": { + "type": "object", + "properties": { + "avatar_url": { + "type": "string", + "example": "头像" + }, + "level": { + "description": "整个系统中的等级", + "type": "integer" + }, + "nickname": { + "type": "string", + "example": "昵称" + }, + "phone": { + "type": "string", + "example": "手机号" + }, + "pid": { + "type": "integer" + }, + "position": { + "description": "以pid1为创始人中网的位置", + "type": "integer" + }, + "uid": { + "type": "integer" + } + } + }, + "md.TeamRewardSettingStruct": { + "type": "object", + "properties": { + "member_self_is_open_get_team_reward": { + "description": "会员是否活跃得到团队奖励", + "type": "string" }, "one_round_duration": { "description": "一轮持续时间", @@ -3720,66 +4169,627 @@ const docTemplate = `{ } } }, - "md.UserVirtualCoinFlow": { + "md.UserEggFlowReq": { "type": "object", "properties": { - "after_amount": { + "account_balance_exchange_egg_energy_nums_end": { "type": "string", - "example": "变更后数量" + "example": "余额兑换蛋蛋能量数量-结束值" }, - "amount": { + "account_balance_exchange_egg_energy_nums_start": { "type": "string", - "example": "变更数量" + "example": "余额兑换蛋蛋能量数量-起始值" }, - "before_amount": { + "browse_interface_nums_end": { "type": "string", - "example": "变更前数量" + "example": "浏览界面次数-结束值" }, - "coin_id": { - "description": "虚拟币 ID", - "type": "integer" + "browse_interface_nums_start": { + "type": "string", + "example": "浏览界面次数-起始值" }, - "create_at": { + "college_learning_nums_end": { "type": "string", - "example": "创建时间" + "example": "学院学习次数-结束值" }, - "direction": { - "description": "方向:1收入 2支出", + "college_learning_nums_start": { + "type": "string", + "example": "学院学习次数-起始值" + }, + "ecpm_end": { + "type": "string", + "example": "ecpm-结束值" + }, + "ecpm_start": { + "type": "string", + "example": "ecpm-起始值" + }, + "egg_energy_exchange_account_balance_end": { + "type": "string", + "example": "蛋蛋能量兑换余额数量-结束值" + }, + "egg_energy_exchange_account_balance_start": { + "type": "string", + "example": "蛋蛋能量兑换余额数量-起始值" + }, + "forum_comments_nums_end": { + "type": "string", + "example": "论坛评论次数-结束值" + }, + "forum_comments_nums_start": { + "type": "string", + "example": "论坛评论次数-起始值" + }, + "im_activity_nums_end": { + "type": "string", + "example": "im活跃次数-结束值" + }, + "im_activity_nums_start": { + "type": "string", + "example": "im活跃次数-起始值" + }, + "invite_user_nums_end": { + "type": "string", + "example": "拉新人数-结束值" + }, + "invite_user_nums_start": { + "type": "string", + "example": "拉新人数-起始值" + }, + "page": { + "description": "页数", "type": "integer" }, - "id": { + "page_size": { + "description": "每页大小", "type": "integer" }, - "sys_fee": { + "person_add_activity_value_end": { "type": "string", - "example": "手续费" + "example": "个人活跃积分-结束值" }, - "title": { + "person_add_activity_value_start": { "type": "string", - "example": "标题" + "example": "个人活跃积分-起始值" }, - "transfer_type": { - "description": "转账类型", - "type": "integer" + "score_value_end": { + "type": "string", + "example": "蛋蛋分-结束值" }, - "uid": { - "description": "用户 ID", + "score_value_kind": { + "description": "评分类型(0:未知 1:人工 2:系统)", "type": "integer" }, - "update_at": { + "score_value_start": { "type": "string", - "example": "更新时间" + "example": "蛋蛋分-起始值" + }, + "send_circle_of_friend_nums_end": { + "type": "string", + "example": "发朋友圈次数-结束值" + }, + "send_circle_of_friend_nums_start": { + "type": "string", + "example": "发朋友圈次数-起始值" + }, + "send_red_package_nums_end": { + "type": "string", + "example": "发红包次数-结束值" + }, + "send_red_package_nums_start": { + "type": "string", + "example": "发红包次数-起始值" + }, + "sign_in_nums_end": { + "type": "string", + "example": "签到次数-结束值" + }, + "sign_in_nums_start": { + "type": "string", + "example": "签到次数-起始值" + }, + "team-activity-nums-end": { + "type": "string", + "example": "团队活跃次数-结束值" + }, + "team_activity_nums_start": { + "type": "string", + "example": "团队活跃次数-起始值" + }, + "violate_nums_end": { + "type": "string", + "example": "违规次数-结束值" + }, + "violate_nums_start": { + "type": "string", + "example": "违规次数-起始值" + }, + "week": { + "type": "string", + "example": "周份" + }, + "year": { + "type": "string", + "example": "年份" } } }, - "md.VideoRewardSetting": { + "md.UserEggFlowReqResp": { "type": "object", "properties": { - "video_reward_is_open": { - "description": "视频奖励是否开启(1:开启 0:关闭)", + "list": { + "type": "array", + "items": { + "$ref": "#/definitions/md.UserEggFlowReqRespList" + } + }, + "page": { + "description": "页数", "type": "integer" }, - "video_reward_system": { + "page_size": { + "description": "每页大小", + "type": "integer" + }, + "total": { + "description": "总数量", + "type": "integer" + }, + "week": { + "type": "string", + "example": "周份" + }, + "year": { + "type": "string", + "example": "年份" + } + } + }, + "md.UserEggFlowReqRespList": { + "type": "object", + "properties": { + "account_balance_exchange_egg_energy_nums": { + "description": "余额兑换蛋蛋能量数量", + "type": "integer" + }, + "browse_interface_nums": { + "description": "浏览界面次数", + "type": "integer" + }, + "college_learning_nums": { + "description": "学院学习次数", + "type": "integer" + }, + "ecpm": { + "description": "ecpm", + "type": "number" + }, + "egg_energy_exchange_account_balance": { + "description": "蛋蛋能量兑换余额数量", + "type": "integer" + }, + "forum_comments_nums": { + "description": "论坛评论次数", + "type": "integer" + }, + "im_activity_nums": { + "description": "im活跃次数", + "type": "integer" + }, + "index_id": { + "description": "文档id", + "type": "string" + }, + "invite_user_nums": { + "description": "拉新人数", + "type": "integer" + }, + "person_add_activity_value": { + "description": "个人活跃积分", + "type": "integer" + }, + "score_value": { + "description": "蛋蛋分-起始值", + "type": "number" + }, + "score_value_kind": { + "description": "评分类型(0:未知 1:人工 2:系统)", + "type": "integer" + }, + "send_circle_of_friend_nums": { + "description": "发朋友圈次数", + "type": "integer" + }, + "send_red_package_nums": { + "description": "发红包次数", + "type": "integer" + }, + "sign_in_nums": { + "description": "签到次数", + "type": "integer" + }, + "team_activity_nums": { + "description": "团队活跃次数", + "type": "integer" + }, + "violate_nums": { + "description": "违规次数", + "type": "integer" + } + } + }, + "md.UserEggIndexReq": { + "type": "object", + "properties": { + "week": { + "type": "string", + "example": "周份" + }, + "year": { + "type": "string", + "example": "年份" + } + } + }, + "md.UserEggIndexResp": { + "type": "object", + "properties": { + "egg_energy_user_egg_index_weight": { + "description": "蛋蛋分系数权重", + "allOf": [ + { + "$ref": "#/definitions/model.EggEnergyUserEggIndexWeight" + } + ] + }, + "statistics_user_egg_kind_proportion": { + "description": "统计用户蛋蛋分\"评比类型\"占比", + "type": "array", + "items": { + "type": "object", + "additionalProperties": true + } + }, + "statistics_user_egg_score_value_range": { + "description": "统计用户蛋蛋分范围", + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "week": { + "type": "string", + "example": "周份" + }, + "year": { + "type": "string", + "example": "年份" + }, + "year_list": { + "description": "年份\u0026\u0026周份列表", + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + }, + "md.UserManagementGetUserListNode": { + "type": "object", + "properties": { + "avatar": { + "type": "string" + }, + "create_at": { + "type": "string" + }, + "custom_invite_code": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "invite_code": { + "type": "string", + "example": "会员邀请码" + }, + "invite_total": { + "type": "integer" + }, + "is_real_name": { + "type": "integer" + }, + "last_login_ip": { + "type": "string" + }, + "level": { + "type": "integer" + }, + "level_name": { + "description": "会员等级", + "type": "string" + }, + "memo": { + "type": "string" + }, + "nickname": { + "type": "string" + }, + "open_id": { + "type": "string" + }, + "parent_id": { + "description": "推荐人 ID", + "type": "integer" + }, + "parent_invite_code": { + "type": "string", + "example": "推荐人邀请码" + }, + "parent_phone": { + "type": "string", + "example": "推荐人手机号" + }, + "parent_uid": { + "type": "integer" + }, + "passcode": { + "type": "string" + }, + "password": { + "type": "string" + }, + "phone": { + "type": "string" + }, + "register_time": { + "description": "注册时间", + "type": "string" + }, + "register_type": { + "type": "integer" + }, + "sex": { + "type": "integer" + }, + "state": { + "type": "integer" + }, + "system_invite_code": { + "type": "string" + }, + "tag_name": { + "description": "会员标签", + "type": "string" + }, + "union_id": { + "type": "string" + }, + "update_at": { + "type": "string" + } + } + }, + "md.UserManagementGetUserListReq": { + "type": "object", + "properties": { + "effective": { + "description": "有效会员", + "type": "integer" + }, + "id": { + "description": "会员 ID", + "type": "integer" + }, + "invite_code": { + "type": "string", + "example": "会员邀请码" + }, + "is_real_name": { + "description": "是否实名 0.未实名,1.已实名", + "type": "integer" + }, + "level": { + "description": "会员等级", + "type": "integer" + }, + "limit": { + "type": "integer" + }, + "login_after": { + "description": "最近登录结束时间", + "type": "string" + }, + "login_before": { + "description": "最近登录开始时间", + "type": "string" + }, + "memo": { + "description": "备注", + "type": "string" + }, + "nickname": { + "type": "string", + "example": "会员昵称" + }, + "page": { + "type": "integer" + }, + "parent_invite_code": { + "type": "string", + "example": "上级邀请码" + }, + "parent_phone": { + "type": "string", + "example": "上级手机号" + }, + "phone": { + "type": "string", + "example": "会员手机号" + }, + "recommend_id": { + "description": "推荐人 ID", + "type": "integer" + }, + "register_after": { + "description": "注册时间终点", + "type": "string" + }, + "register_before": { + "description": "注册时间起点", + "type": "string" + }, + "register_type": { + "description": "注册类型(0.未知, 1.免验证码手机号注册,2.微信授权)", + "type": "integer" + }, + "sex": { + "description": "性别", + "type": "integer" + }, + "state": { + "description": "状态", + "type": "integer" + }, + "tag": { + "description": "标签 id", + "type": "integer" + }, + "union_id": { + "type": "string", + "example": "微信号" + } + } + }, + "md.UserManagementGetUserListResp": { + "type": "object", + "properties": { + "levels_list": { + "description": "等级列表", + "type": "array", + "items": { + "type": "object", + "additionalProperties": true + } + }, + "list": { + "type": "array", + "items": { + "$ref": "#/definitions/md.UserManagementGetUserListNode" + } + }, + "paginate": { + "description": "分页信息", + "allOf": [ + { + "$ref": "#/definitions/applet_app_md_institutional_management_member_center.Paginate" + } + ] + }, + "tags_list": { + "description": "标签列表", + "type": "array", + "items": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "md.UserManagementUpdateUserInfoReq": { + "type": "object", + "properties": { + "avatar": { + "description": "头像", + "type": "string" + }, + "disable": { + "description": "是否禁用用户", + "type": "boolean" + }, + "last_login_ip": { + "description": "用户最后登录 IP", + "type": "string" + }, + "memo": { + "type": "string", + "example": "备注" + }, + "tag": { + "description": "用户标签 ID", + "type": "integer" + }, + "uid": { + "type": "integer" + } + } + }, + "md.UserVirtualCoinFlow": { + "type": "object", + "properties": { + "after_amount": { + "type": "string", + "example": "变更后数量" + }, + "amount": { + "type": "string", + "example": "变更数量" + }, + "before_amount": { + "type": "string", + "example": "变更前数量" + }, + "coin_id": { + "description": "虚拟币 ID", + "type": "integer" + }, + "create_at": { + "type": "string", + "example": "创建时间" + }, + "direction": { + "description": "方向:1收入 2支出", + "type": "integer" + }, + "id": { + "type": "integer" + }, + "sys_fee": { + "type": "string", + "example": "手续费" + }, + "title": { + "type": "string", + "example": "标题" + }, + "transfer_type": { + "description": "转账类型", + "type": "integer" + }, + "uid": { + "description": "用户 ID", + "type": "integer" + }, + "update_at": { + "type": "string", + "example": "更新时间" + } + } + }, + "md.VideoRewardSetting": { + "type": "object", + "properties": { + "video_reward_is_open": { + "description": "视频奖励是否开启(1:开启 0:关闭)", + "type": "integer" + }, + "video_reward_system": { "description": "视频奖励机制", "allOf": [ { @@ -3853,6 +4863,62 @@ const docTemplate = `{ "example": "货币类型名称" } } + }, + "model.EggEnergyUserEggIndexWeight": { + "type": "object", + "properties": { + "account_balance_exchange_egg_energy_nums": { + "type": "string" + }, + "browse_interface_nums": { + "type": "string" + }, + "college_learning_nums": { + "type": "string" + }, + "create_at": { + "type": "string" + }, + "ecpm": { + "type": "string" + }, + "egg_energy_exchange_account_balance": { + "type": "string" + }, + "forum_comments_nums": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "im_activity_nums": { + "type": "string" + }, + "invite_user_nums": { + "type": "string" + }, + "person_add_activity_value": { + "type": "string" + }, + "send_circle_of_friend_nums": { + "type": "string" + }, + "send_red_package_nums": { + "type": "string" + }, + "sign_in_nums": { + "type": "string" + }, + "team_activity_nums": { + "type": "string" + }, + "update_at": { + "type": "string" + }, + "violate_nums": { + "type": "string" + } + } } }, "securityDefinitions": { diff --git a/docs/swagger.json b/docs/swagger.json index f1e6e51..5485ee8 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -226,6 +226,147 @@ } } }, + "/api/institutionalManagement/eggEnergy/eggPoint/manualScore": { + "post": { + "description": "蛋蛋分管理(人工打分)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "蛋蛋能量" + ], + "summary": "制度中心-蛋蛋能量-蛋蛋分管理(人工打分)", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "请求参数", + "name": "req", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.ManualScoreReq" + } + } + ], + "responses": { + "200": { + "description": "成功返回", + "schema": { + "type": "string" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, + "/api/institutionalManagement/eggEnergy/eggPoint/statisticsUserEggIndex": { + "post": { + "description": "蛋蛋分管理(着陆页数据分析)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "蛋蛋能量" + ], + "summary": "制度中心-蛋蛋能量-蛋蛋分管理(着陆页数据分析)", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "请求参数", + "name": "req", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.StatisticsEggPointReq" + } + } + ], + "responses": { + "200": { + "description": "成功返回", + "schema": { + "$ref": "#/definitions/md.StatisticsEggPointResp" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, + "/api/institutionalManagement/eggEnergy/eggPoint/userEggFlow": { + "post": { + "description": "蛋蛋分管理(用户数据列表)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "蛋蛋能量" + ], + "summary": "制度中心-蛋蛋能量-蛋蛋分管理(用户数据列表)", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "请求参数", + "name": "req", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.UserEggFlowReq" + } + } + ], + "responses": { + "200": { + "description": "成功返回", + "schema": { + "$ref": "#/definitions/md.UserEggFlowReqResp" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, "/api/institutionalManagement/eggEnergy/getBasic": { "get": { "description": "基础设置(获取)", @@ -1723,6 +1864,100 @@ } } } + }, + "/api/memberCenter/userManagement/getUserList": { + "post": { + "description": "用户信息管理(获取)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "会员中心" + ], + "summary": "制度中心-会员中心-用户信息管理(获取)", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "分页信息必填", + "name": "req", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.UserManagementGetUserListReq" + } + } + ], + "responses": { + "200": { + "description": "具体数据", + "schema": { + "$ref": "#/definitions/md.UserManagementGetUserListResp" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, + "/api/memberCenter/userManagement/updateUserInfo": { + "post": { + "description": "用户信息管理(更新)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "会员中心" + ], + "summary": "制度中心-会员中心-用户信息管理(更新)", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "用户ID 必传", + "name": "req", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.UserManagementUpdateUserInfoReq" + } + } + ], + "responses": { + "200": { + "description": "修改数据行数", + "schema": { + "type": "int" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } } }, "definitions": { @@ -1776,6 +2011,23 @@ } } }, + "applet_app_md_institutional_management_member_center.Paginate": { + "type": "object", + "properties": { + "limit": { + "description": "每页大小", + "type": "integer" + }, + "page": { + "description": "页数", + "type": "integer" + }, + "total": { + "description": "总数据量", + "type": "integer" + } + } + }, "applet_app_md_institutional_management_new_user_red_package.Paginate": { "type": "object", "properties": { @@ -3067,6 +3319,19 @@ } } }, + "md.ManualScoreReq": { + "type": "object", + "properties": { + "index_id": { + "description": "文档id", + "type": "string" + }, + "score": { + "type": "string", + "example": "分数" + } + } + }, "md.NewUserRedPackageGetBasicResp": { "type": "object", "properties": { @@ -3471,43 +3736,227 @@ } } }, - "md.SubUser": { + "md.StatisticsEggPointReq": { "type": "object", "properties": { - "avatar_url": { - "type": "string", - "example": "头像" - }, - "level": { - "description": "整个系统中的等级", - "type": "integer" - }, - "nickname": { + "week": { "type": "string", - "example": "昵称" + "example": "周份" }, - "phone": { + "year": { "type": "string", - "example": "手机号" - }, - "pid": { - "type": "integer" - }, - "position": { - "description": "以pid1为创始人中网的位置", - "type": "integer" - }, - "uid": { - "type": "integer" + "example": "年份" } } }, - "md.TeamRewardSettingStruct": { + "md.StatisticsEggPointResp": { "type": "object", "properties": { - "member_self_is_open_get_team_reward": { - "description": "会员是否活跃得到团队奖励", - "type": "string" + "statistics_user_egg_account_balance_exchange_egg_energy_nums_range": { + "description": "统计用户\"余额兑换蛋蛋能量数量\"范围", + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "statistics_user_egg_browse_interface_nums_range": { + "description": "统计用户\"浏览界面次数\"范围", + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "statistics_user_egg_college_learning_nums_range": { + "description": "统计用户\"学院学习次数\"范围", + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "statistics_user_egg_ecpm_range": { + "description": "统计用户\"ecpm\"范围", + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "statistics_user_egg_egg_energy_exchange_account_balance_range": { + "description": "统计用户\"蛋蛋能量兑换余额数量\"范围", + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "statistics_user_egg_forum_comments_nums_range": { + "description": "统计用户\"论坛评论次数\"范围", + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "statistics_user_egg_invite_user_nums_range": { + "description": "统计用户\"拉新人数\"范围", + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "statistics_user_egg_kind_proportion": { + "description": "统计用户蛋蛋分\"评比类型\"占比", + "type": "array", + "items": { + "type": "object", + "additionalProperties": true + } + }, + "statistics_user_egg_person_add_activity_value_range": { + "description": "统计用户\"个人活跃积分增量值\"范围", + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "statistics_user_egg_score_value_range": { + "description": "统计用户蛋蛋分范围", + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "statistics_user_egg_send_circle_of_friend_nums_range": { + "description": "统计用户\"发朋友圈次数\"范围", + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "statistics_user_egg_send_red_package_nums_range": { + "description": "统计用户\"发红包次数\"范围", + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "statistics_user_egg_sign_in_nums_range": { + "description": "统计用户\"签到次数\"范围", + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "statistics_user_egg_team_activity_nums_range": { + "description": "统计用户\"团队活跃次数\"范围", + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "statistics_user_egg_violate_nums_range": { + "description": "统计用户\"违规次数\"范围", + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "week": { + "type": "string", + "example": "周份" + }, + "year": { + "type": "string", + "example": "年份" + }, + "year_list": { + "description": "年份\u0026\u0026周份列表", + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + }, + "md.SubUser": { + "type": "object", + "properties": { + "avatar_url": { + "type": "string", + "example": "头像" + }, + "level": { + "description": "整个系统中的等级", + "type": "integer" + }, + "nickname": { + "type": "string", + "example": "昵称" + }, + "phone": { + "type": "string", + "example": "手机号" + }, + "pid": { + "type": "integer" + }, + "position": { + "description": "以pid1为创始人中网的位置", + "type": "integer" + }, + "uid": { + "type": "integer" + } + } + }, + "md.TeamRewardSettingStruct": { + "type": "object", + "properties": { + "member_self_is_open_get_team_reward": { + "description": "会员是否活跃得到团队奖励", + "type": "string" }, "one_round_duration": { "description": "一轮持续时间", @@ -3713,66 +4162,627 @@ } } }, - "md.UserVirtualCoinFlow": { + "md.UserEggFlowReq": { "type": "object", "properties": { - "after_amount": { + "account_balance_exchange_egg_energy_nums_end": { "type": "string", - "example": "变更后数量" + "example": "余额兑换蛋蛋能量数量-结束值" }, - "amount": { + "account_balance_exchange_egg_energy_nums_start": { "type": "string", - "example": "变更数量" + "example": "余额兑换蛋蛋能量数量-起始值" }, - "before_amount": { + "browse_interface_nums_end": { "type": "string", - "example": "变更前数量" + "example": "浏览界面次数-结束值" }, - "coin_id": { - "description": "虚拟币 ID", - "type": "integer" + "browse_interface_nums_start": { + "type": "string", + "example": "浏览界面次数-起始值" }, - "create_at": { + "college_learning_nums_end": { "type": "string", - "example": "创建时间" + "example": "学院学习次数-结束值" }, - "direction": { - "description": "方向:1收入 2支出", + "college_learning_nums_start": { + "type": "string", + "example": "学院学习次数-起始值" + }, + "ecpm_end": { + "type": "string", + "example": "ecpm-结束值" + }, + "ecpm_start": { + "type": "string", + "example": "ecpm-起始值" + }, + "egg_energy_exchange_account_balance_end": { + "type": "string", + "example": "蛋蛋能量兑换余额数量-结束值" + }, + "egg_energy_exchange_account_balance_start": { + "type": "string", + "example": "蛋蛋能量兑换余额数量-起始值" + }, + "forum_comments_nums_end": { + "type": "string", + "example": "论坛评论次数-结束值" + }, + "forum_comments_nums_start": { + "type": "string", + "example": "论坛评论次数-起始值" + }, + "im_activity_nums_end": { + "type": "string", + "example": "im活跃次数-结束值" + }, + "im_activity_nums_start": { + "type": "string", + "example": "im活跃次数-起始值" + }, + "invite_user_nums_end": { + "type": "string", + "example": "拉新人数-结束值" + }, + "invite_user_nums_start": { + "type": "string", + "example": "拉新人数-起始值" + }, + "page": { + "description": "页数", "type": "integer" }, - "id": { + "page_size": { + "description": "每页大小", "type": "integer" }, - "sys_fee": { + "person_add_activity_value_end": { "type": "string", - "example": "手续费" + "example": "个人活跃积分-结束值" }, - "title": { + "person_add_activity_value_start": { "type": "string", - "example": "标题" + "example": "个人活跃积分-起始值" }, - "transfer_type": { - "description": "转账类型", - "type": "integer" + "score_value_end": { + "type": "string", + "example": "蛋蛋分-结束值" }, - "uid": { - "description": "用户 ID", + "score_value_kind": { + "description": "评分类型(0:未知 1:人工 2:系统)", "type": "integer" }, - "update_at": { + "score_value_start": { "type": "string", - "example": "更新时间" + "example": "蛋蛋分-起始值" + }, + "send_circle_of_friend_nums_end": { + "type": "string", + "example": "发朋友圈次数-结束值" + }, + "send_circle_of_friend_nums_start": { + "type": "string", + "example": "发朋友圈次数-起始值" + }, + "send_red_package_nums_end": { + "type": "string", + "example": "发红包次数-结束值" + }, + "send_red_package_nums_start": { + "type": "string", + "example": "发红包次数-起始值" + }, + "sign_in_nums_end": { + "type": "string", + "example": "签到次数-结束值" + }, + "sign_in_nums_start": { + "type": "string", + "example": "签到次数-起始值" + }, + "team-activity-nums-end": { + "type": "string", + "example": "团队活跃次数-结束值" + }, + "team_activity_nums_start": { + "type": "string", + "example": "团队活跃次数-起始值" + }, + "violate_nums_end": { + "type": "string", + "example": "违规次数-结束值" + }, + "violate_nums_start": { + "type": "string", + "example": "违规次数-起始值" + }, + "week": { + "type": "string", + "example": "周份" + }, + "year": { + "type": "string", + "example": "年份" } } }, - "md.VideoRewardSetting": { + "md.UserEggFlowReqResp": { "type": "object", "properties": { - "video_reward_is_open": { - "description": "视频奖励是否开启(1:开启 0:关闭)", + "list": { + "type": "array", + "items": { + "$ref": "#/definitions/md.UserEggFlowReqRespList" + } + }, + "page": { + "description": "页数", "type": "integer" }, - "video_reward_system": { + "page_size": { + "description": "每页大小", + "type": "integer" + }, + "total": { + "description": "总数量", + "type": "integer" + }, + "week": { + "type": "string", + "example": "周份" + }, + "year": { + "type": "string", + "example": "年份" + } + } + }, + "md.UserEggFlowReqRespList": { + "type": "object", + "properties": { + "account_balance_exchange_egg_energy_nums": { + "description": "余额兑换蛋蛋能量数量", + "type": "integer" + }, + "browse_interface_nums": { + "description": "浏览界面次数", + "type": "integer" + }, + "college_learning_nums": { + "description": "学院学习次数", + "type": "integer" + }, + "ecpm": { + "description": "ecpm", + "type": "number" + }, + "egg_energy_exchange_account_balance": { + "description": "蛋蛋能量兑换余额数量", + "type": "integer" + }, + "forum_comments_nums": { + "description": "论坛评论次数", + "type": "integer" + }, + "im_activity_nums": { + "description": "im活跃次数", + "type": "integer" + }, + "index_id": { + "description": "文档id", + "type": "string" + }, + "invite_user_nums": { + "description": "拉新人数", + "type": "integer" + }, + "person_add_activity_value": { + "description": "个人活跃积分", + "type": "integer" + }, + "score_value": { + "description": "蛋蛋分-起始值", + "type": "number" + }, + "score_value_kind": { + "description": "评分类型(0:未知 1:人工 2:系统)", + "type": "integer" + }, + "send_circle_of_friend_nums": { + "description": "发朋友圈次数", + "type": "integer" + }, + "send_red_package_nums": { + "description": "发红包次数", + "type": "integer" + }, + "sign_in_nums": { + "description": "签到次数", + "type": "integer" + }, + "team_activity_nums": { + "description": "团队活跃次数", + "type": "integer" + }, + "violate_nums": { + "description": "违规次数", + "type": "integer" + } + } + }, + "md.UserEggIndexReq": { + "type": "object", + "properties": { + "week": { + "type": "string", + "example": "周份" + }, + "year": { + "type": "string", + "example": "年份" + } + } + }, + "md.UserEggIndexResp": { + "type": "object", + "properties": { + "egg_energy_user_egg_index_weight": { + "description": "蛋蛋分系数权重", + "allOf": [ + { + "$ref": "#/definitions/model.EggEnergyUserEggIndexWeight" + } + ] + }, + "statistics_user_egg_kind_proportion": { + "description": "统计用户蛋蛋分\"评比类型\"占比", + "type": "array", + "items": { + "type": "object", + "additionalProperties": true + } + }, + "statistics_user_egg_score_value_range": { + "description": "统计用户蛋蛋分范围", + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "week": { + "type": "string", + "example": "周份" + }, + "year": { + "type": "string", + "example": "年份" + }, + "year_list": { + "description": "年份\u0026\u0026周份列表", + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + }, + "md.UserManagementGetUserListNode": { + "type": "object", + "properties": { + "avatar": { + "type": "string" + }, + "create_at": { + "type": "string" + }, + "custom_invite_code": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "invite_code": { + "type": "string", + "example": "会员邀请码" + }, + "invite_total": { + "type": "integer" + }, + "is_real_name": { + "type": "integer" + }, + "last_login_ip": { + "type": "string" + }, + "level": { + "type": "integer" + }, + "level_name": { + "description": "会员等级", + "type": "string" + }, + "memo": { + "type": "string" + }, + "nickname": { + "type": "string" + }, + "open_id": { + "type": "string" + }, + "parent_id": { + "description": "推荐人 ID", + "type": "integer" + }, + "parent_invite_code": { + "type": "string", + "example": "推荐人邀请码" + }, + "parent_phone": { + "type": "string", + "example": "推荐人手机号" + }, + "parent_uid": { + "type": "integer" + }, + "passcode": { + "type": "string" + }, + "password": { + "type": "string" + }, + "phone": { + "type": "string" + }, + "register_time": { + "description": "注册时间", + "type": "string" + }, + "register_type": { + "type": "integer" + }, + "sex": { + "type": "integer" + }, + "state": { + "type": "integer" + }, + "system_invite_code": { + "type": "string" + }, + "tag_name": { + "description": "会员标签", + "type": "string" + }, + "union_id": { + "type": "string" + }, + "update_at": { + "type": "string" + } + } + }, + "md.UserManagementGetUserListReq": { + "type": "object", + "properties": { + "effective": { + "description": "有效会员", + "type": "integer" + }, + "id": { + "description": "会员 ID", + "type": "integer" + }, + "invite_code": { + "type": "string", + "example": "会员邀请码" + }, + "is_real_name": { + "description": "是否实名 0.未实名,1.已实名", + "type": "integer" + }, + "level": { + "description": "会员等级", + "type": "integer" + }, + "limit": { + "type": "integer" + }, + "login_after": { + "description": "最近登录结束时间", + "type": "string" + }, + "login_before": { + "description": "最近登录开始时间", + "type": "string" + }, + "memo": { + "description": "备注", + "type": "string" + }, + "nickname": { + "type": "string", + "example": "会员昵称" + }, + "page": { + "type": "integer" + }, + "parent_invite_code": { + "type": "string", + "example": "上级邀请码" + }, + "parent_phone": { + "type": "string", + "example": "上级手机号" + }, + "phone": { + "type": "string", + "example": "会员手机号" + }, + "recommend_id": { + "description": "推荐人 ID", + "type": "integer" + }, + "register_after": { + "description": "注册时间终点", + "type": "string" + }, + "register_before": { + "description": "注册时间起点", + "type": "string" + }, + "register_type": { + "description": "注册类型(0.未知, 1.免验证码手机号注册,2.微信授权)", + "type": "integer" + }, + "sex": { + "description": "性别", + "type": "integer" + }, + "state": { + "description": "状态", + "type": "integer" + }, + "tag": { + "description": "标签 id", + "type": "integer" + }, + "union_id": { + "type": "string", + "example": "微信号" + } + } + }, + "md.UserManagementGetUserListResp": { + "type": "object", + "properties": { + "levels_list": { + "description": "等级列表", + "type": "array", + "items": { + "type": "object", + "additionalProperties": true + } + }, + "list": { + "type": "array", + "items": { + "$ref": "#/definitions/md.UserManagementGetUserListNode" + } + }, + "paginate": { + "description": "分页信息", + "allOf": [ + { + "$ref": "#/definitions/applet_app_md_institutional_management_member_center.Paginate" + } + ] + }, + "tags_list": { + "description": "标签列表", + "type": "array", + "items": { + "type": "object", + "additionalProperties": true + } + } + } + }, + "md.UserManagementUpdateUserInfoReq": { + "type": "object", + "properties": { + "avatar": { + "description": "头像", + "type": "string" + }, + "disable": { + "description": "是否禁用用户", + "type": "boolean" + }, + "last_login_ip": { + "description": "用户最后登录 IP", + "type": "string" + }, + "memo": { + "type": "string", + "example": "备注" + }, + "tag": { + "description": "用户标签 ID", + "type": "integer" + }, + "uid": { + "type": "integer" + } + } + }, + "md.UserVirtualCoinFlow": { + "type": "object", + "properties": { + "after_amount": { + "type": "string", + "example": "变更后数量" + }, + "amount": { + "type": "string", + "example": "变更数量" + }, + "before_amount": { + "type": "string", + "example": "变更前数量" + }, + "coin_id": { + "description": "虚拟币 ID", + "type": "integer" + }, + "create_at": { + "type": "string", + "example": "创建时间" + }, + "direction": { + "description": "方向:1收入 2支出", + "type": "integer" + }, + "id": { + "type": "integer" + }, + "sys_fee": { + "type": "string", + "example": "手续费" + }, + "title": { + "type": "string", + "example": "标题" + }, + "transfer_type": { + "description": "转账类型", + "type": "integer" + }, + "uid": { + "description": "用户 ID", + "type": "integer" + }, + "update_at": { + "type": "string", + "example": "更新时间" + } + } + }, + "md.VideoRewardSetting": { + "type": "object", + "properties": { + "video_reward_is_open": { + "description": "视频奖励是否开启(1:开启 0:关闭)", + "type": "integer" + }, + "video_reward_system": { "description": "视频奖励机制", "allOf": [ { @@ -3846,6 +4856,62 @@ "example": "货币类型名称" } } + }, + "model.EggEnergyUserEggIndexWeight": { + "type": "object", + "properties": { + "account_balance_exchange_egg_energy_nums": { + "type": "string" + }, + "browse_interface_nums": { + "type": "string" + }, + "college_learning_nums": { + "type": "string" + }, + "create_at": { + "type": "string" + }, + "ecpm": { + "type": "string" + }, + "egg_energy_exchange_account_balance": { + "type": "string" + }, + "forum_comments_nums": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "im_activity_nums": { + "type": "string" + }, + "invite_user_nums": { + "type": "string" + }, + "person_add_activity_value": { + "type": "string" + }, + "send_circle_of_friend_nums": { + "type": "string" + }, + "send_red_package_nums": { + "type": "string" + }, + "sign_in_nums": { + "type": "string" + }, + "team_activity_nums": { + "type": "string" + }, + "update_at": { + "type": "string" + }, + "violate_nums": { + "type": "string" + } + } } }, "securityDefinitions": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 80b4245..0db3487 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -33,6 +33,18 @@ definitions: description: 总数据量 type: integer type: object + applet_app_md_institutional_management_member_center.Paginate: + properties: + limit: + description: 每页大小 + type: integer + page: + description: 页数 + type: integer + total: + description: 总数据量 + type: integer + type: object applet_app_md_institutional_management_new_user_red_package.Paginate: properties: limit: @@ -917,6 +929,15 @@ definitions: token: type: string type: object + md.ManualScoreReq: + properties: + index_id: + description: 文档id + type: string + score: + example: 分数 + type: string + type: object md.NewUserRedPackageGetBasicResp: properties: create_at: @@ -1204,6 +1225,135 @@ definitions: description: 查询用户活跃子节点 ID type: integer type: object + md.StatisticsEggPointReq: + properties: + week: + example: 周份 + type: string + year: + example: 年份 + type: string + type: object + md.StatisticsEggPointResp: + properties: + statistics_user_egg_account_balance_exchange_egg_energy_nums_range: + description: 统计用户"余额兑换蛋蛋能量数量"范围 + items: + additionalProperties: + type: string + type: object + type: array + statistics_user_egg_browse_interface_nums_range: + description: 统计用户"浏览界面次数"范围 + items: + additionalProperties: + type: string + type: object + type: array + statistics_user_egg_college_learning_nums_range: + description: 统计用户"学院学习次数"范围 + items: + additionalProperties: + type: string + type: object + type: array + statistics_user_egg_ecpm_range: + description: 统计用户"ecpm"范围 + items: + additionalProperties: + type: string + type: object + type: array + statistics_user_egg_egg_energy_exchange_account_balance_range: + description: 统计用户"蛋蛋能量兑换余额数量"范围 + items: + additionalProperties: + type: string + type: object + type: array + statistics_user_egg_forum_comments_nums_range: + description: 统计用户"论坛评论次数"范围 + items: + additionalProperties: + type: string + type: object + type: array + statistics_user_egg_invite_user_nums_range: + description: 统计用户"拉新人数"范围 + items: + additionalProperties: + type: string + type: object + type: array + statistics_user_egg_kind_proportion: + description: 统计用户蛋蛋分"评比类型"占比 + items: + additionalProperties: true + type: object + type: array + statistics_user_egg_person_add_activity_value_range: + description: 统计用户"个人活跃积分增量值"范围 + items: + additionalProperties: + type: string + type: object + type: array + statistics_user_egg_score_value_range: + description: 统计用户蛋蛋分范围 + items: + additionalProperties: + type: string + type: object + type: array + statistics_user_egg_send_circle_of_friend_nums_range: + description: 统计用户"发朋友圈次数"范围 + items: + additionalProperties: + type: string + type: object + type: array + statistics_user_egg_send_red_package_nums_range: + description: 统计用户"发红包次数"范围 + items: + additionalProperties: + type: string + type: object + type: array + statistics_user_egg_sign_in_nums_range: + description: 统计用户"签到次数"范围 + items: + additionalProperties: + type: string + type: object + type: array + statistics_user_egg_team_activity_nums_range: + description: 统计用户"团队活跃次数"范围 + items: + additionalProperties: + type: string + type: object + type: array + statistics_user_egg_violate_nums_range: + description: 统计用户"违规次数"范围 + items: + additionalProperties: + type: string + type: object + type: array + week: + example: 周份 + type: string + year: + example: 年份 + type: string + year_list: + additionalProperties: + items: + type: string + type: array + description: 年份&&周份列表 + type: object + type: object md.SubUser: properties: avatar_url: @@ -1360,6 +1510,408 @@ definitions: - $ref: '#/definitions/md.DailyActivityAnalysisTopData' description: 统计信息 type: object + md.UserEggFlowReq: + properties: + account_balance_exchange_egg_energy_nums_end: + example: 余额兑换蛋蛋能量数量-结束值 + type: string + account_balance_exchange_egg_energy_nums_start: + example: 余额兑换蛋蛋能量数量-起始值 + type: string + browse_interface_nums_end: + example: 浏览界面次数-结束值 + type: string + browse_interface_nums_start: + example: 浏览界面次数-起始值 + type: string + college_learning_nums_end: + example: 学院学习次数-结束值 + type: string + college_learning_nums_start: + example: 学院学习次数-起始值 + type: string + ecpm_end: + example: ecpm-结束值 + type: string + ecpm_start: + example: ecpm-起始值 + type: string + egg_energy_exchange_account_balance_end: + example: 蛋蛋能量兑换余额数量-结束值 + type: string + egg_energy_exchange_account_balance_start: + example: 蛋蛋能量兑换余额数量-起始值 + type: string + forum_comments_nums_end: + example: 论坛评论次数-结束值 + type: string + forum_comments_nums_start: + example: 论坛评论次数-起始值 + type: string + im_activity_nums_end: + example: im活跃次数-结束值 + type: string + im_activity_nums_start: + example: im活跃次数-起始值 + type: string + invite_user_nums_end: + example: 拉新人数-结束值 + type: string + invite_user_nums_start: + example: 拉新人数-起始值 + type: string + page: + description: 页数 + type: integer + page_size: + description: 每页大小 + type: integer + person_add_activity_value_end: + example: 个人活跃积分-结束值 + type: string + person_add_activity_value_start: + example: 个人活跃积分-起始值 + type: string + score_value_end: + example: 蛋蛋分-结束值 + type: string + score_value_kind: + description: 评分类型(0:未知 1:人工 2:系统) + type: integer + score_value_start: + example: 蛋蛋分-起始值 + type: string + send_circle_of_friend_nums_end: + example: 发朋友圈次数-结束值 + type: string + send_circle_of_friend_nums_start: + example: 发朋友圈次数-起始值 + type: string + send_red_package_nums_end: + example: 发红包次数-结束值 + type: string + send_red_package_nums_start: + example: 发红包次数-起始值 + type: string + sign_in_nums_end: + example: 签到次数-结束值 + type: string + sign_in_nums_start: + example: 签到次数-起始值 + type: string + team-activity-nums-end: + example: 团队活跃次数-结束值 + type: string + team_activity_nums_start: + example: 团队活跃次数-起始值 + type: string + violate_nums_end: + example: 违规次数-结束值 + type: string + violate_nums_start: + example: 违规次数-起始值 + type: string + week: + example: 周份 + type: string + year: + example: 年份 + type: string + type: object + md.UserEggFlowReqResp: + properties: + list: + items: + $ref: '#/definitions/md.UserEggFlowReqRespList' + type: array + page: + description: 页数 + type: integer + page_size: + description: 每页大小 + type: integer + total: + description: 总数量 + type: integer + week: + example: 周份 + type: string + year: + example: 年份 + type: string + type: object + md.UserEggFlowReqRespList: + properties: + account_balance_exchange_egg_energy_nums: + description: 余额兑换蛋蛋能量数量 + type: integer + browse_interface_nums: + description: 浏览界面次数 + type: integer + college_learning_nums: + description: 学院学习次数 + type: integer + ecpm: + description: ecpm + type: number + egg_energy_exchange_account_balance: + description: 蛋蛋能量兑换余额数量 + type: integer + forum_comments_nums: + description: 论坛评论次数 + type: integer + im_activity_nums: + description: im活跃次数 + type: integer + index_id: + description: 文档id + type: string + invite_user_nums: + description: 拉新人数 + type: integer + person_add_activity_value: + description: 个人活跃积分 + type: integer + score_value: + description: 蛋蛋分-起始值 + type: number + score_value_kind: + description: 评分类型(0:未知 1:人工 2:系统) + type: integer + send_circle_of_friend_nums: + description: 发朋友圈次数 + type: integer + send_red_package_nums: + description: 发红包次数 + type: integer + sign_in_nums: + description: 签到次数 + type: integer + team_activity_nums: + description: 团队活跃次数 + type: integer + violate_nums: + description: 违规次数 + type: integer + type: object + md.UserEggIndexReq: + properties: + week: + example: 周份 + type: string + year: + example: 年份 + type: string + type: object + md.UserEggIndexResp: + properties: + egg_energy_user_egg_index_weight: + allOf: + - $ref: '#/definitions/model.EggEnergyUserEggIndexWeight' + description: 蛋蛋分系数权重 + statistics_user_egg_kind_proportion: + description: 统计用户蛋蛋分"评比类型"占比 + items: + additionalProperties: true + type: object + type: array + statistics_user_egg_score_value_range: + description: 统计用户蛋蛋分范围 + items: + additionalProperties: + type: string + type: object + type: array + week: + example: 周份 + type: string + year: + example: 年份 + type: string + year_list: + additionalProperties: + items: + type: string + type: array + description: 年份&&周份列表 + type: object + type: object + md.UserManagementGetUserListNode: + properties: + avatar: + type: string + create_at: + type: string + custom_invite_code: + type: string + id: + type: integer + invite_code: + example: 会员邀请码 + type: string + invite_total: + type: integer + is_real_name: + type: integer + last_login_ip: + type: string + level: + type: integer + level_name: + description: 会员等级 + type: string + memo: + type: string + nickname: + type: string + open_id: + type: string + parent_id: + description: 推荐人 ID + type: integer + parent_invite_code: + example: 推荐人邀请码 + type: string + parent_phone: + example: 推荐人手机号 + type: string + parent_uid: + type: integer + passcode: + type: string + password: + type: string + phone: + type: string + register_time: + description: 注册时间 + type: string + register_type: + type: integer + sex: + type: integer + state: + type: integer + system_invite_code: + type: string + tag_name: + description: 会员标签 + type: string + union_id: + type: string + update_at: + type: string + type: object + md.UserManagementGetUserListReq: + properties: + effective: + description: 有效会员 + type: integer + id: + description: 会员 ID + type: integer + invite_code: + example: 会员邀请码 + type: string + is_real_name: + description: 是否实名 0.未实名,1.已实名 + type: integer + level: + description: 会员等级 + type: integer + limit: + type: integer + login_after: + description: 最近登录结束时间 + type: string + login_before: + description: 最近登录开始时间 + type: string + memo: + description: 备注 + type: string + nickname: + example: 会员昵称 + type: string + page: + type: integer + parent_invite_code: + example: 上级邀请码 + type: string + parent_phone: + example: 上级手机号 + type: string + phone: + example: 会员手机号 + type: string + recommend_id: + description: 推荐人 ID + type: integer + register_after: + description: 注册时间终点 + type: string + register_before: + description: 注册时间起点 + type: string + register_type: + description: 注册类型(0.未知, 1.免验证码手机号注册,2.微信授权) + type: integer + sex: + description: 性别 + type: integer + state: + description: 状态 + type: integer + tag: + description: 标签 id + type: integer + union_id: + example: 微信号 + type: string + type: object + md.UserManagementGetUserListResp: + properties: + levels_list: + description: 等级列表 + items: + additionalProperties: true + type: object + type: array + list: + items: + $ref: '#/definitions/md.UserManagementGetUserListNode' + type: array + paginate: + allOf: + - $ref: '#/definitions/applet_app_md_institutional_management_member_center.Paginate' + description: 分页信息 + tags_list: + description: 标签列表 + items: + additionalProperties: true + type: object + type: array + type: object + md.UserManagementUpdateUserInfoReq: + properties: + avatar: + description: 头像 + type: string + disable: + description: 是否禁用用户 + type: boolean + last_login_ip: + description: 用户最后登录 IP + type: string + memo: + example: 备注 + type: string + tag: + description: 用户标签 ID + type: integer + uid: + type: integer + type: object md.UserVirtualCoinFlow: properties: after_amount: @@ -1454,6 +2006,43 @@ definitions: example: 货币类型名称 type: string type: object + model.EggEnergyUserEggIndexWeight: + properties: + account_balance_exchange_egg_energy_nums: + type: string + browse_interface_nums: + type: string + college_learning_nums: + type: string + create_at: + type: string + ecpm: + type: string + egg_energy_exchange_account_balance: + type: string + forum_comments_nums: + type: string + id: + type: integer + im_activity_nums: + type: string + invite_user_nums: + type: string + person_add_activity_value: + type: string + send_circle_of_friend_nums: + type: string + send_red_package_nums: + type: string + sign_in_nums: + type: string + team_activity_nums: + type: string + update_at: + type: string + violate_nums: + type: string + type: object host: localhost:4001 info: contact: @@ -1606,6 +2195,99 @@ paths: summary: 制度中心-动态数据-动态数据流水(获取) tags: - 公排管理 + /api/institutionalManagement/eggEnergy/eggPoint/manualScore: + post: + consumes: + - application/json + description: 蛋蛋分管理(人工打分) + parameters: + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization + required: true + type: string + - description: 请求参数 + in: body + name: req + required: true + schema: + $ref: '#/definitions/md.ManualScoreReq' + produces: + - application/json + responses: + "200": + description: 成功返回 + schema: + type: string + "400": + description: 具体错误 + schema: + $ref: '#/definitions/md.Response' + summary: 制度中心-蛋蛋能量-蛋蛋分管理(人工打分) + tags: + - 蛋蛋能量 + /api/institutionalManagement/eggEnergy/eggPoint/statisticsUserEggIndex: + post: + consumes: + - application/json + description: 蛋蛋分管理(着陆页数据分析) + parameters: + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization + required: true + type: string + - description: 请求参数 + in: body + name: req + required: true + schema: + $ref: '#/definitions/md.StatisticsEggPointReq' + produces: + - application/json + responses: + "200": + description: 成功返回 + schema: + $ref: '#/definitions/md.StatisticsEggPointResp' + "400": + description: 具体错误 + schema: + $ref: '#/definitions/md.Response' + summary: 制度中心-蛋蛋能量-蛋蛋分管理(着陆页数据分析) + tags: + - 蛋蛋能量 + /api/institutionalManagement/eggEnergy/eggPoint/userEggFlow: + post: + consumes: + - application/json + description: 蛋蛋分管理(用户数据列表) + parameters: + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization + required: true + type: string + - description: 请求参数 + in: body + name: req + required: true + schema: + $ref: '#/definitions/md.UserEggFlowReq' + produces: + - application/json + responses: + "200": + description: 成功返回 + schema: + $ref: '#/definitions/md.UserEggFlowReqResp' + "400": + description: 具体错误 + schema: + $ref: '#/definitions/md.Response' + summary: 制度中心-蛋蛋能量-蛋蛋分管理(用户数据列表) + tags: + - 蛋蛋能量 /api/institutionalManagement/eggEnergy/getBasic: get: consumes: @@ -2594,6 +3276,68 @@ paths: summary: 制度中心-营销应用-新人红包设置(修改) tags: - 营销应用 + /api/memberCenter/userManagement/getUserList: + post: + consumes: + - application/json + description: 用户信息管理(获取) + parameters: + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization + required: true + type: string + - description: 分页信息必填 + in: body + name: req + required: true + schema: + $ref: '#/definitions/md.UserManagementGetUserListReq' + produces: + - application/json + responses: + "200": + description: 具体数据 + schema: + $ref: '#/definitions/md.UserManagementGetUserListResp' + "400": + description: 具体错误 + schema: + $ref: '#/definitions/md.Response' + summary: 制度中心-会员中心-用户信息管理(获取) + tags: + - 会员中心 + /api/memberCenter/userManagement/updateUserInfo: + post: + consumes: + - application/json + description: 用户信息管理(更新) + parameters: + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization + required: true + type: string + - description: 用户ID 必传 + in: body + name: req + required: true + schema: + $ref: '#/definitions/md.UserManagementUpdateUserInfoReq' + produces: + - application/json + responses: + "200": + description: 修改数据行数 + schema: + type: int + "400": + description: 具体错误 + schema: + $ref: '#/definitions/md.Response' + summary: 制度中心-会员中心-用户信息管理(更新) + tags: + - 会员中心 securityDefinitions: MasterID: in: header diff --git a/etc/cfg.yml b/etc/cfg.yml index a144434..1240dec 100644 --- a/etc/cfg.yml +++ b/etc/cfg.yml @@ -38,4 +38,15 @@ mq: host: '116.62.62.35' port: '5672' user: 'zhios' - pwd: 'ZHIoscnfnuo123' \ No newline at end of file + pwd: 'ZHIoscnfnuo123' + + # 连接ElasticSearch + #es: + # url: 'http://zhios-es-53m.public.cn-hangzhou.es-serverless.aliyuncs.com:9200' + # user: 'zhios-es-53m' + # pwd: 'ZHIoscnfnuo123@' + +es: + url: 'http://120.55.48.175:9200' + user: 'elastic' + pwd: 'fnuo123' \ No newline at end of file diff --git a/go.mod b/go.mod index baeffb8..9579f01 100644 --- a/go.mod +++ b/go.mod @@ -2,22 +2,22 @@ module applet go 1.19 -// replace code.fnuoos.com/EggPlanet/egg_models.git => E:/company/Egg/egg_models - -// replace code.fnuoos.com/EggPlanet/egg_system_rules.git => E:/company/Egg/egg_system_rules +//replace code.fnuoos.com/EggPlanet/egg_models.git => E:/company/Egg/egg_models +// +//replace code.fnuoos.com/go_rely_warehouse/zyos_go_es.git => E:\company\go_rely_warehouse\zyos_go_es +// +//replace code.fnuoos.com/EggPlanet/egg_system_rules.git => E:/company/Egg/egg_system_rules require ( github.com/boombuler/barcode v1.0.1 github.com/dchest/uniuri v0.0.0-20200228104902-7aecb25e1fe5 github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/forgoer/openssl v0.0.0-20201023062029-c3112b0c8700 - github.com/gin-contrib/sessions v0.0.3 - github.com/gin-gonic/gin v1.9.0 + github.com/gin-gonic/gin v1.9.1 github.com/go-playground/locales v0.14.1 github.com/go-playground/universal-translator v0.18.1 github.com/go-playground/validator/v10 v10.20.0 github.com/go-redis/redis v6.15.9+incompatible - github.com/gomodule/redigo v2.0.0+incompatible github.com/iGoogle-ink/gopay v1.5.36 github.com/makiuchi-d/gozxing v0.0.0-20210324052758-57132e828831 github.com/qiniu/api.v7/v7 v7.8.2 @@ -34,12 +34,16 @@ require ( ) require ( - code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241118064045-6ecc894c9bf8 - code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.3 + code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241118081439-70519d0b030c + code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241118084151-870d25b871af + code.fnuoos.com/go_rely_warehouse/zyos_go_es.git v1.0.1-0.20241118083738-0f22da9ba0be code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5 github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible + github.com/gin-contrib/sessions v1.0.1 github.com/go-sql-driver/mysql v1.8.1 github.com/gocolly/colly v1.2.0 + github.com/gomodule/redigo v2.0.0+incompatible + github.com/olivere/elastic/v7 v7.0.32 github.com/shopspring/decimal v1.3.1 github.com/tidwall/gjson v1.14.1 ) @@ -69,9 +73,9 @@ require ( github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/gookit/color v1.3.8 // indirect - github.com/gorilla/context v1.1.1 // indirect - github.com/gorilla/securecookie v1.1.1 // indirect - github.com/gorilla/sessions v1.2.1 // indirect + github.com/gorilla/context v1.1.2 // indirect + github.com/gorilla/securecookie v1.1.2 // indirect + github.com/gorilla/sessions v1.2.2 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/kennygrant/sanitize v1.2.4 // indirect @@ -81,8 +85,7 @@ require ( github.com/mattn/go-isatty v0.0.20 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/onsi/ginkgo v1.16.5 // indirect - github.com/onsi/gomega v1.19.0 // indirect + github.com/nxadm/tail v1.4.8 // indirect github.com/pelletier/go-toml/v2 v2.2.1 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d // indirect diff --git a/main.go b/main.go index c4f1741..7917546 100644 --- a/main.go +++ b/main.go @@ -22,6 +22,7 @@ func init() { cfg.InitLog() // 日志初始化 cfg.InitCache() // 缓存初始化 cfg.InitMq() // 队列初始化 + cfg.InitEs() //ElasticSearch初始化 if cfg.Debug { // 判断是否是debug if err := db.InitDB(cfg.DB); err != nil { // 主数据库初始化 panic(err)