diff --git a/app/hdl/institutional_management/egg_energy/hdl_platform_revenue.go b/app/hdl/institutional_management/egg_energy/hdl_platform_revenue.go index 3732575..6a56c03 100644 --- a/app/hdl/institutional_management/egg_energy/hdl_platform_revenue.go +++ b/app/hdl/institutional_management/egg_energy/hdl_platform_revenue.go @@ -13,8 +13,46 @@ import ( "time" ) +// GetVideoReward +// @Summary 制度中心-蛋蛋能量-平台营收-激励视频(获取) +// @Tags 蛋蛋能量 +// @Description 激励视频(获取) +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @param req body md.SetVideoRewardReq true "落地页不填页大小默认20条数据" +// @Success 200 {object} md.GetVideoRewardResp +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/institutionalManagement/eggEnergy/platformRevenue/getVideoReward [post] +func GetVideoReward(c *gin.Context) { + conn := cache.GetPool().Get() + cfgDb := implement.NewSysCfgDb(db.Db, conn) + unitPrice, err2 := cfgDb.SysCfgGetOneNoDataNoErr(enum2.VideoReward(enum2.VideoRewardUnitPrice).String()) + if err2 != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err2.Error()) + return + } + if unitPrice == nil { + cfgDb.SysCfgInsert(enum2.VideoRewardUnitPrice, "", enum2.VideoReward(enum2.VideoRewardUnitPrice).String()) + } + + ecpm, err3 := cfgDb.SysCfgGetOneNoDataNoErr(enum2.VideoReward(enum2.VideoRewardECPM).String()) + if err3 != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err3.Error()) + return + } + if ecpm == nil { + cfgDb.SysCfgInsert(enum2.VideoRewardECPM, "", enum2.VideoReward(enum2.VideoRewardECPM).String()) + } + + e.OutSuc(c, md.GetVideoRewardResp{ + UnitPrice: unitPrice.Val, + Ecpm: ecpm.Val, + }, nil) +} + // SetVideoReward -// @Summary 制度中心-蛋蛋能量-激励视频(设置) +// @Summary 制度中心-蛋蛋能量-平台营收-激励视频(设置) // @Tags 蛋蛋能量 // @Description 激励视频(设置) // @Accept json @@ -23,7 +61,7 @@ import ( // @param req body md.SetVideoRewardReq true "落地页不填页大小默认20条数据" // @Success 200 {string} "success" // @Failure 400 {object} md.Response "具体错误" -// @Router /api/institutionalManagement/eggEnergy/platformRevenue/SetVideoReward [post] +// @Router /api/institutionalManagement/eggEnergy/platformRevenue/setVideoReward [post] func SetVideoReward(c *gin.Context) { var req *md.SetVideoRewardReq if err1 := c.ShouldBindJSON(&req); err1 != nil { @@ -33,38 +71,24 @@ func SetVideoReward(c *gin.Context) { conn := cache.GetPool().Get() cfgDb := implement.NewSysCfgDb(db.Db, conn) - unitPrice, err2 := cfgDb.SysCfgGetOneNoDataNoErr(enum2.VideoReward(enum2.VideoRewardUnitPrice).String()) - if err2 != nil { - e.OutErr(c, e.ERR_INVALID_ARGS, err2.Error()) + + if !cfgDb.SysCfgUpdate(enum2.VideoRewardUnitPrice, req.UnitPrice) { + e.OutErr(c, e.ERR_DB_ORM, "更新:"+enum2.VideoReward.String(enum2.VideoRewardUnitPrice)+"失败!") return } - if unitPrice == nil { - cfgDb.SysCfgInsert(enum2.VideoReward(enum2.VideoRewardUnitPrice).String(), req.UnitPrice, "激励视频单价") - } else { - cfgDb.SysCfgUpdate(enum2.VideoReward(enum2.VideoRewardUnitPrice).String(), req.UnitPrice) - } - emcp, err3 := cfgDb.SysCfgGetOneNoDataNoErr(enum2.VideoReward(enum2.VideoRewardECMP).String()) - if err3 != nil { - e.OutErr(c, e.ERR_INVALID_ARGS, err3.Error()) + if !cfgDb.SysCfgUpdate(enum2.VideoRewardECPM, req.Ecpm) { + e.OutErr(c, e.ERR_DB_ORM, "更新:"+enum2.VideoReward.String(enum2.VideoRewardECPM)+"失败!") return } - if emcp == nil { - cfgDb.SysCfgInsert(enum2.VideoReward(enum2.VideoRewardECMP).String(), req.ECMP, "当前 ecmp 值") - } else { - cfgDb.SysCfgUpdate(enum2.VideoReward(enum2.VideoRewardECMP).String(), req.ECMP) - } - - cfgDb.SysCfgInsert(enum2.VideoReward(enum2.VideoRewardECMP).String(), req.ECMP, "当前 ecmp 值") e.OutSuc(c, "success", nil) - } // ListPlatformRevenue -// @Summary 制度中心-蛋蛋能量-平台营收数据(获取) +// @Summary 制度中心-蛋蛋能量-平台营收-其他广告设置数据(获取) // @Tags 蛋蛋能量 -// @Description 平台营收数据(获取) +// @Description 其他广告设置数据(获取) // @Accept json // @Produce json // @param Authorization header string true "验证参数Bearer和token空格拼接" @@ -130,9 +154,9 @@ func ListPlatformRevenue(c *gin.Context) { } // AddPlatformRevenue -// @Summary 制度中心-蛋蛋能量-平台营收数据(新增) +// @Summary 制度中心-蛋蛋能量-平台营收-其他广告设置数据(新增) // @Tags 蛋蛋能量 -// @Description 平台营收数据(新增) +// @Description 其他广告设置数据(新增) // @Accept json // @Produce json // @param Authorization header string true "验证参数Bearer和token空格拼接" diff --git a/app/md/institutional_management/egg_energy/md_platform_revenue.go b/app/md/institutional_management/egg_energy/md_platform_revenue.go index ea80cd6..cb11c32 100644 --- a/app/md/institutional_management/egg_energy/md_platform_revenue.go +++ b/app/md/institutional_management/egg_energy/md_platform_revenue.go @@ -2,7 +2,12 @@ package md type SetVideoRewardReq struct { UnitPrice string `json:"unit_price,required"` // 单价 - ECMP string `json:"ecmp,required"` // 当前 Ecmp 值 + Ecpm string `json:"ecpm,required"` // 当前 Ecpm 值 +} + +type GetVideoRewardResp struct { + UnitPrice string `json:"unit_price"` // 单价 + Ecpm string `json:"ecmp"` // 当前 Ecpm 值 } type ListPlatformRevenueReq struct { diff --git a/app/md/institutional_management/member_center/md_user_management.go b/app/md/institutional_management/member_center/md_user_management.go index 16ea110..8b7a233 100644 --- a/app/md/institutional_management/member_center/md_user_management.go +++ b/app/md/institutional_management/member_center/md_user_management.go @@ -2,7 +2,6 @@ package md import ( "code.fnuoos.com/EggPlanet/egg_models.git/src/model" - "time" ) type UserManagementGetUserListReq struct { @@ -37,19 +36,19 @@ type Paginate struct { } type UserManagementGetUserListNode struct { - ID int64 `json:"id"` // 会员 ID - Tag string `json:"tag_name"` // 会员标签 - Avatar string `json:"avatar"` // 头像 - Nickname string `json:"nickname"` // 昵称 - Phone string `json:"phone"` // 手机号 - IsRealName int `json:"is_real_name"` // 是否实名 0.未实名,1.已实名 - Level string `json:"level_name"` // 会员等级 - InviteCode string `json:"invite_code" example:"会员邀请码"` - ParentID int64 `json:"parent_id"` // 推荐人 ID - ParentInviteCode string `json:"parent_invite_code" example:"推荐人邀请码"` - ParentPhone string `json:"parent_phone" example:"推荐人手机号"` - RegisterTime time.Time `json:"register_time"` // 注册时间 - Memo string `json:"memo"` // 备注 + ID int64 `json:"id"` // 会员 ID + Tag string `json:"tag_name"` // 会员标签 + Avatar string `json:"avatar"` // 头像 + Nickname string `json:"nickname"` // 昵称 + Phone string `json:"phone"` // 手机号 + IsRealName int `json:"is_real_name"` // 是否实名 0.未实名,1.已实名 + Level string `json:"level_name"` // 会员等级 + InviteCode string `json:"invite_code" example:"会员邀请码"` + ParentID int64 `json:"parent_id"` // 推荐人 ID + ParentInviteCode string `json:"parent_invite_code" example:"推荐人邀请码"` + ParentPhone string `json:"parent_phone" example:"推荐人手机号"` + RegisterTime string `json:"register_time"` // 注册时间 + Memo string `json:"memo"` // 备注 model.User } diff --git a/app/router/router.go b/app/router/router.go index db76361..45d55ed 100644 --- a/app/router/router.go +++ b/app/router/router.go @@ -131,6 +131,7 @@ func rInstitutionalManagement(r *gin.RouterGroup) { //制度管理 } rPlatformRevenue := rEggEnergy.Group("/platformRevenue") { + rPlatformRevenue.POST("/getVideoReward", egg_energy.GetVideoReward) rPlatformRevenue.POST("/setVideoReward", egg_energy.SetVideoReward) rPlatformRevenue.POST("/platformRevenueList", egg_energy.ListPlatformRevenue) rPlatformRevenue.POST("/platformRevenueAdd", egg_energy.AddPlatformRevenue) diff --git a/go.mod b/go.mod index 0affc02..c7467c1 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( 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/gomodule/redigo v1.9.2 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 @@ -33,12 +33,11 @@ require ( ) require ( - code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241118141706-576f2789ac24 - code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241118084151-870d25b871af + code.fnuoos.com/EggPlanet/egg_models.git v0.2.0 + code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241119073336-d4afc68102da 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/olivere/elastic/v7 v7.0.32