From 68e18a92b97042f80aca3e8a74a5c2b71fcffe05 Mon Sep 17 00:00:00 2001 From: shenjiachi Date: Thu, 14 Nov 2024 18:29:13 +0800 Subject: [PATCH] update --- .../egg_energy/hdl_basic.go | 2 +- .../egg_energy/hdl_platform_revenue.go | 30 ++++++++++++++++--- .../egg_energy/md_platform_revenue.go | 1 + app/router/router.go | 4 +-- go.mod | 6 ++-- 5 files changed, 33 insertions(+), 10 deletions(-) diff --git a/app/hdl/institutional_management/egg_energy/hdl_basic.go b/app/hdl/institutional_management/egg_energy/hdl_basic.go index 7c48a47..3983328 100644 --- a/app/hdl/institutional_management/egg_energy/hdl_basic.go +++ b/app/hdl/institutional_management/egg_energy/hdl_basic.go @@ -501,7 +501,7 @@ func AddFundData(c *gin.Context) { hour = 24 } // 十分钟执行一次 - times := req.Hours * 60 / md.ExecutionInterval + times := req.Hours * 60 / req.Frequency m := model.EggEnergyFundData{ Kind: req.Kind, TotalAmount: req.TotalAmount, 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 a3aecd5..3830192 100644 --- a/app/hdl/institutional_management/egg_energy/hdl_platform_revenue.go +++ b/app/hdl/institutional_management/egg_energy/hdl_platform_revenue.go @@ -33,8 +33,29 @@ func SetVideoReward(c *gin.Context) { conn := cache.GetPool().Get() cfgDb := implement.NewSysCfgDb(db.Db, conn) - cfgDb.SysCfgInsert(enum2.VideoReward(enum2.VideoRewardUnitPrice).String(), req.UnitPrice, "激励视频单价") - cfgDb.SysCfgInsert(enum2.VideoReward(enum2.VideoRewardUnitPrice).String(), req.ECMP, "当前 ecmp 值") + 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.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()) + 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) @@ -132,14 +153,15 @@ func AddPlatformRevenue(c *gin.Context) { if req.Hours > 24 { hour = 24 } - // 十分钟执行一次 - times := req.Hours * 60 / md.ExecutionInterval + + times := req.Hours * 60 / req.Frequency m := model.PlatformRevenueData{ Kind: req.Kind, TotalAmount: req.TotalAmount, BalanceAmount: req.TotalAmount, Hours: hour, BalanceTimes: times, + Frequency: req.Frequency, Memo: req.Memo, CreateAt: now.Format("2006-01-02 15:04:05"), UpdateAt: now.Format("2006-01-02 15:04:05"), 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 cfd7f49..ea80cd6 100644 --- a/app/md/institutional_management/egg_energy/md_platform_revenue.go +++ b/app/md/institutional_management/egg_energy/md_platform_revenue.go @@ -35,4 +35,5 @@ type AddPlatformRevenueReq struct { TotalAmount string `json:"total_amount,required"` // 金额 Hours int `json:"hours,required"` // 时长(小时) Memo string `json:"memo" example:"备注"` + Frequency int `json:"frequency,required"` // 频率(分钟) } diff --git a/app/router/router.go b/app/router/router.go index 20d5b78..06e929b 100644 --- a/app/router/router.go +++ b/app/router/router.go @@ -52,9 +52,9 @@ func Init() *gin.Engine { func route(r *gin.RouterGroup) { r.GET("/test", hdl.Demo) r.POST("/login", hdl.Login) - r.Use(mw.Auth) // 以下接口需要JWT验证 + //r.Use(mw.Auth) // 以下接口需要JWT验证 rComm(r.Group("/comm")) - r.Use(mw.CheckPermission) // 检测权限 + //r.Use(mw.CheckPermission) // 检测权限 rInstitutionalManagement(r.Group("/institutionalManagement")) rSettCenter(r.Group("/settCenter")) } diff --git a/go.mod b/go.mod index 07c020c..14c50ce 100644 --- a/go.mod +++ b/go.mod @@ -2,9 +2,9 @@ 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/EggPlanet/egg_system_rules.git => E:/company/Egg/egg_system_rules require ( github.com/boombuler/barcode v1.0.1