diff --git a/app/svc/svc_data_center_generate_data.go b/app/svc/svc_data_center_generate_data.go index f2ab750..0c87d32 100644 --- a/app/svc/svc_data_center_generate_data.go +++ b/app/svc/svc_data_center_generate_data.go @@ -71,7 +71,9 @@ func DataCenterIncomeDataList(c *gin.Context, req md.DataCenterGenerateDataReq) appId := GetAppletId(c, req.Name, req.Platform, req.AppId) mediumId := GetMediumIdStr(c, user.AdmId, "", "") slotId := GetSlotId(c, req.State) - MediumList, total, _ := NewGenerateWxAdDataDb.FindGenerateWxAdDataListMedium(c.GetString("mid"), appId, mediumId, slotId, req.AdType, req.StartTime, req.EndTime, utils.StrToInt(req.Page), utils.StrToInt(req.Limit)) + _, adType := GetSlotIds(c, req.AdType) + + MediumList, total, _ := NewGenerateWxAdDataDb.FindGenerateWxAdDataListMedium(c.GetString("mid"), appId, mediumId, slotId, adType, req.StartTime, req.EndTime, utils.StrToInt(req.Page), utils.StrToInt(req.Limit)) data := make([]md.DataCenterIncomeDataData, 0) if len(MediumList) > 0 { for _, v := range MediumList { @@ -120,8 +122,9 @@ func DataCenterIncomeDataListOutput(c *gin.Context, req md.DataCenterGenerateDat appId := GetAppletId(c, req.Name, req.Platform, req.AppId) mediumId := GetMediumIdStr(c, user.AdmId, "", "") slotId := GetSlotId(c, req.State) + _, adType := GetSlotIds(c, req.AdType) req.Limit = "3000" - MediumList, _ := NewGenerateWxAdDataDb.FindGenerateWxAdDataListMediumAll(c.GetString("mid"), appId, mediumId, slotId, req.AdType, req.StartTime, req.EndTime, utils.StrToInt(req.Page), utils.StrToInt(req.Limit)) + MediumList, _ := NewGenerateWxAdDataDb.FindGenerateWxAdDataListMediumAll(c.GetString("mid"), appId, mediumId, slotId, adType, req.StartTime, req.EndTime, utils.StrToInt(req.Page), utils.StrToInt(req.Limit)) data := map[string]string{ "A1": "名称", "B1": "日期", @@ -510,7 +513,8 @@ func comm(c *gin.Context, isTotal int, req md.DataCenterRecordReq) ([]map[string where += " and app_id in(" + str + ")" } if req.AdType != "" { - where += " and ad_slot='" + req.AdType + "'" + adType, _ := GetSlotIds(c, req.AdType) + where += " and slot_id in(" + adType + ")" } if req.StartDate != "" { where += " and date>='" + req.StartDate + "'" diff --git a/app/svc/svc_data_center_original_data.go b/app/svc/svc_data_center_original_data.go index b4340c3..c572d6d 100644 --- a/app/svc/svc_data_center_original_data.go +++ b/app/svc/svc_data_center_original_data.go @@ -429,6 +429,23 @@ func GetSlotId(c *gin.Context, state string) string { } return mediumId } +func GetSlotIds(c *gin.Context, adType string) (string, string) { + adId := "" + adIds := "" + if adType != "" { + adId = "'-1'" + ids := []string{"-1"} + var tmp []model2.AppletApplicationAdSpaceList + MasterDb(c).Where("kind=?", adType).Find(&tmp) + for _, v := range tmp { + adId += ",'" + v.AdId + "'" + ids = append(ids, v.AdId) + } + adIds = strings.Join(ids, ",") + + } + return adId, adIds +} // 应用 func GetAppletInfo(c *gin.Context, id string) map[string]string { diff --git a/go.mod b/go.mod index 7e4b86c..dacd484 100644 --- a/go.mod +++ b/go.mod @@ -36,7 +36,7 @@ require ( require ( code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5 code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git v1.1.21-0.20240830072333-a1980ffb256e - code.fnuoos.com/zhimeng/model.git v0.0.3-0.20241029082303-49c46bad02b0 + code.fnuoos.com/zhimeng/model.git v0.0.3-0.20241029093801-ac7d9e08df0e github.com/360EntSecGroup-Skylar/excelize v1.4.1 github.com/gin-contrib/cors v1.7.2 github.com/jinzhu/copier v0.4.0