瀏覽代碼

update

master
dengbiao 6 天之前
父節點
當前提交
86a33a1abc
共有 16 個檔案被更改,包括 3752 行新增6 行删除
  1. +7
    -0
      app/cfg/cfg_app.go
  2. +2
    -0
      app/cfg/init_cfg.go
  3. +12
    -0
      app/cfg/init_es.go
  4. +247
    -0
      app/hdl/institutional_management/egg_energy/hdl_egg_point.go
  5. +115
    -0
      app/md/institutional_management/egg_energy/md_egg_point.go
  6. +7
    -0
      app/router/router.go
  7. +1377
    -0
      app/svc/egg_energy/svc_egg_energy.go
  8. +46
    -0
      app/task/svc/svc_egg_energy_user_egg_score_auto_create_es_index.go
  9. +12
    -0
      app/task/svc/utils_test.go
  10. +3
    -0
      app/utils/convert.go
  11. +705
    -0
      docs/docs.go
  12. +705
    -0
      docs/swagger.json
  13. +494
    -0
      docs/swagger.yaml
  14. +12
    -1
      etc/cfg.yml
  15. +7
    -5
      go.mod
  16. +1
    -0
      main.go

+ 7
- 0
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"`
}

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

+ 12
- 0
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)
}

+ 247
- 0
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)
}

+ 115
- 0
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"` //个人活跃积分
}

+ 7
- 0
app/router/router.go 查看文件

@@ -129,6 +129,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)
}
}
}



+ 1377
- 0
app/svc/egg_energy/svc_egg_energy.go
文件差異過大導致無法顯示
查看文件


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

+ 12
- 0
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)
}

+ 3
- 0
app/utils/convert.go 查看文件

@@ -276,6 +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))


+ 705
- 0
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": "基础设置(获取)",
@@ -3074,6 +3215,19 @@ const docTemplate = `{
}
}
},
"md.ManualScoreReq": {
"type": "object",
"properties": {
"index_id": {
"description": "文档id",
"type": "string"
},
"score": {
"type": "string",
"example": "分数"
}
}
},
"md.NewUserRedPackageGetBasicResp": {
"type": "object",
"properties": {
@@ -3478,6 +3632,190 @@ const docTemplate = `{
}
}
},
"md.StatisticsEggPointReq": {
"type": "object",
"properties": {
"week": {
"type": "string",
"example": "周份"
},
"year": {
"type": "string",
"example": "年份"
}
}
},
"md.StatisticsEggPointResp": {
"type": "object",
"properties": {
"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": {
@@ -3720,6 +4058,317 @@ const docTemplate = `{
}
}
},
"md.UserEggFlowReq": {
"type": "object",
"properties": {
"account_balance_exchange_egg_energy_nums_end": {
"type": "string",
"example": "余额兑换蛋蛋能量数量-结束值"
},
"account_balance_exchange_egg_energy_nums_start": {
"type": "string",
"example": "余额兑换蛋蛋能量数量-起始值"
},
"browse_interface_nums_end": {
"type": "string",
"example": "浏览界面次数-结束值"
},
"browse_interface_nums_start": {
"type": "string",
"example": "浏览界面次数-起始值"
},
"college_learning_nums_end": {
"type": "string",
"example": "学院学习次数-结束值"
},
"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"
},
"page_size": {
"description": "每页大小",
"type": "integer"
},
"person_add_activity_value_end": {
"type": "string",
"example": "个人活跃积分-结束值"
},
"person_add_activity_value_start": {
"type": "string",
"example": "个人活跃积分-起始值"
},
"score_value_end": {
"type": "string",
"example": "蛋蛋分-结束值"
},
"score_value_kind": {
"description": "评分类型(0:未知 1:人工 2:系统)",
"type": "integer"
},
"score_value_start": {
"type": "string",
"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.UserEggFlowReqResp": {
"type": "object",
"properties": {
"list": {
"type": "array",
"items": {
"$ref": "#/definitions/md.UserEggFlowReqRespList"
}
},
"page": {
"description": "页数",
"type": "integer"
},
"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.UserVirtualCoinFlow": {
"type": "object",
"properties": {
@@ -3853,6 +4502,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": {


+ 705
- 0
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": "基础设置(获取)",
@@ -3067,6 +3208,19 @@
}
}
},
"md.ManualScoreReq": {
"type": "object",
"properties": {
"index_id": {
"description": "文档id",
"type": "string"
},
"score": {
"type": "string",
"example": "分数"
}
}
},
"md.NewUserRedPackageGetBasicResp": {
"type": "object",
"properties": {
@@ -3471,6 +3625,190 @@
}
}
},
"md.StatisticsEggPointReq": {
"type": "object",
"properties": {
"week": {
"type": "string",
"example": "周份"
},
"year": {
"type": "string",
"example": "年份"
}
}
},
"md.StatisticsEggPointResp": {
"type": "object",
"properties": {
"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": {
@@ -3713,6 +4051,317 @@
}
}
},
"md.UserEggFlowReq": {
"type": "object",
"properties": {
"account_balance_exchange_egg_energy_nums_end": {
"type": "string",
"example": "余额兑换蛋蛋能量数量-结束值"
},
"account_balance_exchange_egg_energy_nums_start": {
"type": "string",
"example": "余额兑换蛋蛋能量数量-起始值"
},
"browse_interface_nums_end": {
"type": "string",
"example": "浏览界面次数-结束值"
},
"browse_interface_nums_start": {
"type": "string",
"example": "浏览界面次数-起始值"
},
"college_learning_nums_end": {
"type": "string",
"example": "学院学习次数-结束值"
},
"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"
},
"page_size": {
"description": "每页大小",
"type": "integer"
},
"person_add_activity_value_end": {
"type": "string",
"example": "个人活跃积分-结束值"
},
"person_add_activity_value_start": {
"type": "string",
"example": "个人活跃积分-起始值"
},
"score_value_end": {
"type": "string",
"example": "蛋蛋分-结束值"
},
"score_value_kind": {
"description": "评分类型(0:未知 1:人工 2:系统)",
"type": "integer"
},
"score_value_start": {
"type": "string",
"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.UserEggFlowReqResp": {
"type": "object",
"properties": {
"list": {
"type": "array",
"items": {
"$ref": "#/definitions/md.UserEggFlowReqRespList"
}
},
"page": {
"description": "页数",
"type": "integer"
},
"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.UserVirtualCoinFlow": {
"type": "object",
"properties": {
@@ -3846,6 +4495,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": {


+ 494
- 0
docs/swagger.yaml 查看文件

@@ -917,6 +917,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 +1213,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 +1498,232 @@ 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.UserVirtualCoinFlow:
properties:
after_amount:
@@ -1454,6 +1818,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 +2007,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:


+ 12
- 1
etc/cfg.yml 查看文件

@@ -38,4 +38,15 @@ mq:
host: '116.62.62.35'
port: '5672'
user: 'zhios'
pwd: 'ZHIoscnfnuo123'
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'

+ 7
- 5
go.mod 查看文件

@@ -2,10 +2,11 @@ module applet

go 1.19

//replace code.fnuoos.com/EggPlanet/egg_models.git => E:/company/Egg/egg_models
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/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
@@ -37,10 +38,12 @@ require (
require (
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241115090315-a9a84aba8235
code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.3
code.fnuoos.com/go_rely_warehouse/zyos_go_es.git v1.0.1-0.20230707081910-52e70aa52998
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/go-sql-driver/mysql v1.8.1
github.com/gocolly/colly v1.2.0
github.com/olivere/elastic/v7 v7.0.32
github.com/shopspring/decimal v1.3.1
github.com/tidwall/gjson v1.14.1
)
@@ -82,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


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


Loading…
取消
儲存