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