Bladeren bron

add elastsearch

master
dengbiao 5 dagen geleden
bovenliggende
commit
58adcab324
17 gewijzigde bestanden met toevoegingen van 4847 en 185 verwijderingen
  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. +0
    -56
      app/task/svc/svc_egg_energy_modify_price.go
  9. +46
    -0
      app/task/svc/svc_egg_energy_user_egg_score_auto_create_es_index.go
  10. +12
    -0
      app/task/svc/utils_test.go
  11. +3
    -1
      app/utils/convert.go
  12. +1123
    -57
      docs/docs.go
  13. +1123
    -57
      docs/swagger.json
  14. +744
    -0
      docs/swagger.yaml
  15. +12
    -1
      etc/cfg.yml
  16. +16
    -13
      go.mod
  17. +1
    -0
      main.go

+ 7
- 0
app/cfg/cfg_app.go Bestand weergeven

@@ -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 Bestand weergeven

@@ -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 Bestand weergeven

@@ -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 Bestand weergeven

@@ -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 Bestand weergeven

@@ -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 Bestand weergeven

@@ -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)
}
}
}



+ 1377
- 0
app/svc/egg_energy/svc_egg_energy.go
Diff onderdrukt omdat het te groot bestand
Bestand weergeven


+ 0
- 56
app/task/svc/svc_egg_energy_modify_price.go Bestand weergeven

@@ -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 调整价格
}
}

+ 46
- 0
app/task/svc/svc_egg_energy_user_egg_score_auto_create_es_index.go Bestand weergeven

@@ -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 Bestand weergeven

@@ -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
- 1
app/utils/convert.go Bestand weergeven

@@ -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))
}


+ 1123
- 57
docs/docs.go
Diff onderdrukt omdat het te groot bestand
Bestand weergeven


+ 1123
- 57
docs/swagger.json
Diff onderdrukt omdat het te groot bestand
Bestand weergeven


+ 744
- 0
docs/swagger.yaml Bestand weergeven

@@ -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


+ 12
- 1
etc/cfg.yml Bestand weergeven

@@ -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'

+ 16
- 13
go.mod Bestand weergeven

@@ -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


+ 1
- 0
main.go Bestand weergeven

@@ -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)


Laden…
Annuleren
Opslaan