@@ -17,7 +17,8 @@ import ( | |||||
func DataCenterIncomeDataList(c *gin.Context, req md.DataCenterGenerateDataReq) md.DataCenterIncomeDataRes { | func DataCenterIncomeDataList(c *gin.Context, req md.DataCenterGenerateDataReq) md.DataCenterIncomeDataRes { | ||||
engine := db.Db | engine := db.Db | ||||
NewGenerateWxAdDataDb := implement.NewGenerateWxAdDataDb(engine) | NewGenerateWxAdDataDb := implement.NewGenerateWxAdDataDb(engine) | ||||
appId := GetAppletId(c, req.Name, req.Platform) | |||||
user := GetUser(c) | |||||
appId := GetAppletIdByAdminId(c, user.AdmId, req.Name, req.Platform) | |||||
slotId := GetSlotId(c, req.State) | slotId := GetSlotId(c, req.State) | ||||
MediumList, total, _ := NewGenerateWxAdDataDb.FindGenerateWxAdDataListMedium(c.GetString("mid"), appId, slotId, req.StartTime, req.EndTime, utils.StrToInt(req.Page), utils.StrToInt(req.Limit)) | MediumList, total, _ := NewGenerateWxAdDataDb.FindGenerateWxAdDataListMedium(c.GetString("mid"), appId, slotId, req.StartTime, req.EndTime, utils.StrToInt(req.Page), utils.StrToInt(req.Limit)) | ||||
data := make([]md.DataCenterIncomeDataData, 0) | data := make([]md.DataCenterIncomeDataData, 0) | ||||
@@ -120,7 +121,8 @@ func DataCenterIncomeDataDetail(c *gin.Context, req md.DataCenterGenerateDataCom | |||||
func DataCenterGenerateDataList(c *gin.Context, req md.DataCenterGenerateDataReq) md.DataCenterGenerateDataRes { | func DataCenterGenerateDataList(c *gin.Context, req md.DataCenterGenerateDataReq) md.DataCenterGenerateDataRes { | ||||
engine := db.Db | engine := db.Db | ||||
NewGenerateWxAdDataDb := implement.NewGenerateWxAdDataDb(engine) | NewGenerateWxAdDataDb := implement.NewGenerateWxAdDataDb(engine) | ||||
appId := GetAppletId(c, req.Name, req.Platform) | |||||
user := GetUser(c) | |||||
appId := GetAppletIdByAdminId(c, user.AdmId, req.Name, req.Platform) | |||||
slotId := GetSlotId(c, req.State) | slotId := GetSlotId(c, req.State) | ||||
MediumList, total, _ := NewGenerateWxAdDataDb.FindGenerateWxAdDataList(c.GetString("mid"), appId, slotId, req.StartTime, req.EndTime, utils.StrToInt(req.Page), utils.StrToInt(req.Limit)) | MediumList, total, _ := NewGenerateWxAdDataDb.FindGenerateWxAdDataList(c.GetString("mid"), appId, slotId, req.StartTime, req.EndTime, utils.StrToInt(req.Page), utils.StrToInt(req.Limit)) | ||||
data := make([]md.DataCenterGenerateDataData, 0) | data := make([]md.DataCenterGenerateDataData, 0) | ||||
@@ -21,7 +21,8 @@ import ( | |||||
func DataCenterOriginalDataList(c *gin.Context, req md.DataCenterOriginalDataReq) md.DataCenterOriginalDataRes { | func DataCenterOriginalDataList(c *gin.Context, req md.DataCenterOriginalDataReq) md.DataCenterOriginalDataRes { | ||||
engine := db.Db | engine := db.Db | ||||
NewOriginalWxAdDataDb := implement.NewOriginalWxAdDataDb(engine) | NewOriginalWxAdDataDb := implement.NewOriginalWxAdDataDb(engine) | ||||
appId := GetAppletId(c, req.Name, req.Platform) | |||||
user := GetUser(c) | |||||
appId := GetAppletIdByAdminId(c, user.AdmId, req.Name, req.Platform) | |||||
slotId := GetSlotId(c, req.State) | slotId := GetSlotId(c, req.State) | ||||
MediumList, total, _ := NewOriginalWxAdDataDb.FindOriginalWxAdDataList(c.GetString("mid"), appId, slotId, req.StartTime, req.EndTime, utils.StrToInt(req.Page), utils.StrToInt(req.Limit)) | MediumList, total, _ := NewOriginalWxAdDataDb.FindOriginalWxAdDataList(c.GetString("mid"), appId, slotId, req.StartTime, req.EndTime, utils.StrToInt(req.Page), utils.StrToInt(req.Limit)) | ||||
data := make([]md.DataCenterOriginalDataData, 0) | data := make([]md.DataCenterOriginalDataData, 0) | ||||
@@ -376,6 +377,34 @@ func GetAppletId(c *gin.Context, name, platform string) string { | |||||
} | } | ||||
return mediumId | return mediumId | ||||
} | } | ||||
func GetAppletIdByAdminId(c *gin.Context, admId int, name, platform string) string { | |||||
appId := GetAppletId(c, name, platform) | |||||
appIds := []string{"-1"} | |||||
NewAdminBindMediumDb := implement2.NewAdminBindMediumDb(MasterDb(c)) | |||||
list := NewAdminBindMediumDb.FindAll(admId) | |||||
ids := make([]string, 0) | |||||
for _, v := range list { | |||||
appIds = append(appIds, utils.IntToStr(v.MediumId)) | |||||
ids = append(ids, utils.IntToStr(v.MediumId)) | |||||
} | |||||
if len(list) == 0 { //为空就查全部 | |||||
appIds = []string{} | |||||
} | |||||
if appId != "" { //不为空就判断 有没有在列表里面 | |||||
appIds = []string{"-1"} | |||||
ex := strings.Split(appId, ",") | |||||
for _, v := range ex { | |||||
if utils.InArr(v, ids) || len(list) == 0 { | |||||
appIds = append(appIds, v) | |||||
} | |||||
} | |||||
} | |||||
str := "" | |||||
if len(appIds) > 0 { | |||||
str = strings.Join(appIds, ",") | |||||
} | |||||
return str | |||||
} | |||||
// 广告位 | // 广告位 | ||||
func GetSlotId(c *gin.Context, state string) string { | func GetSlotId(c *gin.Context, state string) string { | ||||
@@ -16,7 +16,9 @@ func MediumQualificationEnterprise(c *gin.Context, minState int, req md.MediumQu | |||||
engine := db.Db | engine := db.Db | ||||
MediumListDb := implement.NewMediumListDb(engine) | MediumListDb := implement.NewMediumListDb(engine) | ||||
MediumList, total, _ := MediumListDb.FindMediumList(c.GetString("mid"), req.Name, req.State, minState, utils.StrToInt(req.Page), utils.StrToInt(req.Limit)) | |||||
user := GetUser(c) | |||||
appIds := GetMediumIdStr(c, user.AdmId, req.Name, "") | |||||
MediumList, total, _ := MediumListDb.FindMediumList(c.GetString("mid"), appIds, req.State, minState, utils.StrToInt(req.Page), utils.StrToInt(req.Limit)) | |||||
data := make([]md.MediumQualificationEnterpriseData, 0) | data := make([]md.MediumQualificationEnterpriseData, 0) | ||||
if len(MediumList) > 0 { | if len(MediumList) > 0 { | ||||
NewMediumDb := implement2.NewMediumDb(MasterDb(c)) | NewMediumDb := implement2.NewMediumDb(MasterDb(c)) | ||||
@@ -92,7 +94,9 @@ func MediumQualificationEnterpriseAudit(c *gin.Context, req md.MediumQualificati | |||||
func MediumQualificationBank(c *gin.Context, req md.MediumQualificationEnterpriseReq) md.MediumQualificationBankRes { | func MediumQualificationBank(c *gin.Context, req md.MediumQualificationEnterpriseReq) md.MediumQualificationBankRes { | ||||
engine := db.Db | engine := db.Db | ||||
MediumListDb := implement.NewMediumBankInfoDb(engine) | MediumListDb := implement.NewMediumBankInfoDb(engine) | ||||
MediumList, total, _ := MediumListDb.FindMediumBankInfoList(c.GetString("mid"), req.Name, req.State, utils.StrToInt(req.Page), utils.StrToInt(req.Limit)) | |||||
user := GetUser(c) | |||||
appIds := GetMediumIdStr(c, user.AdmId, req.Name, "") | |||||
MediumList, total, _ := MediumListDb.FindMediumBankInfoList(c.GetString("mid"), appIds, req.State, utils.StrToInt(req.Page), utils.StrToInt(req.Limit)) | |||||
list := make([]md.MediumQualificationBankData, 0) | list := make([]md.MediumQualificationBankData, 0) | ||||
if MediumList != nil { | if MediumList != nil { | ||||
@@ -175,7 +179,9 @@ func MediumQualificationContactInfo(c *gin.Context, req md.MediumQualificationEn | |||||
engine := db.Db | engine := db.Db | ||||
MediumListDb := implement.NewMediumContactInfoDb(engine) | MediumListDb := implement.NewMediumContactInfoDb(engine) | ||||
MediumList, total, _ := MediumListDb.FindMediumContactInfoList(c.GetString("mid"), req.Name, req.State, utils.StrToInt(req.Page), utils.StrToInt(req.Limit)) | |||||
user := GetUser(c) | |||||
appIds := GetMediumIdStr(c, user.AdmId, req.Name, "") | |||||
MediumList, total, _ := MediumListDb.FindMediumContactInfoList(c.GetString("mid"), appIds, req.State, utils.StrToInt(req.Page), utils.StrToInt(req.Limit)) | |||||
list := make([]md.MediumQualificationContactData, 0) | list := make([]md.MediumQualificationContactData, 0) | ||||
if MediumList != nil { | if MediumList != nil { | ||||
@@ -166,6 +166,11 @@ func commOperatorTotal(c *gin.Context, startDate, endDate string) []map[string]s | |||||
if endDate != "" { | if endDate != "" { | ||||
where += " and date<='" + endDate + "'" | where += " and date<='" + endDate + "'" | ||||
} | } | ||||
user := GetUser(c) | |||||
appId := GetMediumIdStr(c, user.AdmId, "", "") | |||||
if appId != "" { | |||||
where += " and medium_id in(" + appId + ")" | |||||
} | |||||
sql = fmt.Sprintf(sql, where) | sql = fmt.Sprintf(sql, where) | ||||
nativeString, _ := db.QueryNativeString(db.Db, sql) | nativeString, _ := db.QueryNativeString(db.Db, sql) | ||||
if len(nativeString) == 0 { | if len(nativeString) == 0 { | ||||
@@ -197,9 +202,10 @@ func commOperatorTotalByApp(c *gin.Context, req md.IndexAppListReq, appId []stri | |||||
if req.EndDate != "" { | if req.EndDate != "" { | ||||
where += " and date<='" + req.EndDate + "'" | where += " and date<='" + req.EndDate + "'" | ||||
} | } | ||||
if req.Name != "" { | |||||
mediumId := GetMediumId(c, req.Name) | |||||
where += " and medium_id in(" + mediumId + ")" | |||||
user := GetUser(c) | |||||
appIds := GetMediumIdStr(c, user.AdmId, req.Name, "") | |||||
if appIds != "" { | |||||
where += " and medium_id in(" + appIds + ")" | |||||
} | } | ||||
if len(appId) > 0 { | if len(appId) > 0 { | ||||
where += " and app_id in('" + strings.Join(appId, ",") + "')" | where += " and app_id in('" + strings.Join(appId, ",") + "')" | ||||
@@ -12,7 +12,8 @@ import ( | |||||
func SettleCenterMediumList(c *gin.Context, req md.SettleCenterDataReq) md.SettleCenterDataRes { | func SettleCenterMediumList(c *gin.Context, req md.SettleCenterDataReq) md.SettleCenterDataRes { | ||||
engine := db.Db | engine := db.Db | ||||
NewOriginalWxAdDataDb := implement.NewMediumListDb(engine) | NewOriginalWxAdDataDb := implement.NewMediumListDb(engine) | ||||
appId := GetMediumByAccountId(c, req.Name, req.Account) | |||||
user := GetUser(c) | |||||
appId := GetMediumIdStr(c, user.AdmId, req.Name, req.Account) | |||||
MediumList, total, _ := NewOriginalWxAdDataDb.FindMediumListBySettleType(c.GetString("mid"), appId, req.State, utils.StrToInt(req.Page), utils.StrToInt(req.Limit)) | MediumList, total, _ := NewOriginalWxAdDataDb.FindMediumListBySettleType(c.GetString("mid"), appId, req.State, utils.StrToInt(req.Page), utils.StrToInt(req.Limit)) | ||||
data := make([]md.SettleCenterDataData, 0) | data := make([]md.SettleCenterDataData, 0) | ||||
if len(MediumList) > 0 { | if len(MediumList) > 0 { | ||||