diff --git a/app/svc/svc_data_center_original_data.go b/app/svc/svc_data_center_original_data.go index 8e4f467..c74e092 100644 --- a/app/svc/svc_data_center_original_data.go +++ b/app/svc/svc_data_center_original_data.go @@ -150,14 +150,14 @@ func DataCenterOriginalDataTotal(c *gin.Context, req md.DataCenterOriginalDataCo e.OutErr(c, 400, e.NewErr(400, "记录不存在")) return } - //应用 + // 应用 NewAppletApplicationDb := implement2.NewAppletApplicationDb(MasterDb(c)) appid, _ := NewAppletApplicationDb.GetAppletApplicationListByAppid(data.AppId) if appid == nil { e.OutErr(c, 400, e.NewErr(400, "应用不存在")) return } - //分成策略 + // 分成策略 NewMediumDivisionStrategyDb := implement.NewMediumDivisionStrategyDb(db.Db) strategy, _ := NewMediumDivisionStrategyDb.GetOriginalWxAdDataByMediumId(appid.MediumId) if strategy == nil { @@ -170,7 +170,7 @@ func DataCenterOriginalDataTotal(c *gin.Context, req md.DataCenterOriginalDataCo GenerateDataId: data.Id, } _, ecpm := ClacEcpm(ecpmReq) - + fmt.Println(utils.Float64ToStr(utils.StrToFloat64(ecpm) / 100)) res := md.MediumDivisionStrategy{ PlatformRetentionRate: utils.IntToStr(strategy.PlatformRetentionRate), CommissionRetentionRate: utils.IntToStr(strategy.CommissionRetentionRate), @@ -208,7 +208,7 @@ func DataCenterOriginalDataDoing(c *gin.Context, req md.DataCenterDataCenterOrig OriginalExposureCount: data.ExposureCount, OriginalEcpm: data.Ecpm, NowExposureCount: utils.StrToInt(req.NowExposureCount), - NowEcpm: utils.Float64ToStr(utils.StrToFloat64(req.NowEcpm) * 100), + NowEcpm: req.NowEcpm, } err, _ = GenerateWxAdData(args) if err != nil { @@ -285,7 +285,7 @@ func OriginalDataMoreApplicationDoing(c *gin.Context, req md.DataCenterOriginalD return nil } func OriginalDataOneApplicationTotal(c *gin.Context, req md.DataCenterOriginalDataOneApplicationDoingReq) { - //1、查找对应 user_wx_applet_list 记录 + // 1、查找对应 user_wx_applet_list 记录 userWxAppletListDb := implement.NewUserWxAppletListDb(db.Db) masterId := c.GetString("mid") UserWxAppletList, err := userWxAppletListDb.GetUserWxAppletList(masterId) diff --git a/app/svc/svc_wx_data.go b/app/svc/svc_wx_data.go index 2c286a9..1b24c25 100644 --- a/app/svc/svc_wx_data.go +++ b/app/svc/svc_wx_data.go @@ -52,7 +52,14 @@ func GenerateWxAdData(req md.GenerateWxAdData) (err error, generateWxAdData mode // 3、判断是否有调价留存 var priceAdjustmentRetention int - if req.NowEcpm != req.OriginalEcpm || req.NowExposureCount != req.OriginalExposureCount { + ecpmReq := md.ClacEcpmReq{ + OriginalExposureCount: originalWxAdData.ExposureCount, + OriginalEcpm: originalWxAdData.Ecpm, + GenerateDataId: originalWxAdData.Id, + } + _, ecpm := ClacEcpm(ecpmReq) + fmt.Println(utils.Float64ToStr(utils.StrToFloat64(ecpm) / 100)) + if req.NowEcpm != utils.Float64ToStr(utils.StrToFloat64(ecpm)/100) || req.NowExposureCount != req.OriginalExposureCount { tmpMediaRevenue := int(utils.StrToFloat64(req.NowEcpm) * float64(req.NowExposureCount) / 1000) priceAdjustmentRetention = int(float64(tmpMediaRevenue) - mediaRevenue) mediaRevenue = float64(tmpMediaRevenue)