diff --git a/app/svc/svc_data_center.go b/app/svc/svc_data_center.go index 8da5671..9b3fb57 100644 --- a/app/svc/svc_data_center.go +++ b/app/svc/svc_data_center.go @@ -119,7 +119,7 @@ func DataCenterRecordOutPut(c *gin.Context, req md.DataCenterRecordOutPutReq) { adMap[v.AdId] = v } name := req.StartDate + "~" + req.EndDate + "(第" + req.Page + "页 " + utils.IntToStr(len(nativeString)) + "条)" - //写入数据 + // 写入数据 data := map[string]string{ "A1": "日期", "B1": "应用名称", @@ -278,7 +278,7 @@ func DataCenterCommissionRecordOutPut(c *gin.Context, req md.DataCenterRecordOut adMap[v.AdId] = v } name := req.StartDate + "~" + req.EndDate + "(第" + req.Page + "页 " + utils.IntToStr(len(nativeString)) + "条)" - //写入数据 + // 写入数据 data := map[string]string{ "A1": "日期", "B1": "应用名称", @@ -331,7 +331,7 @@ func DataCenterProfitRecordOutPut(c *gin.Context, req md.DataCenterProfitRecordO } name := req.StartDate + "~" + req.EndDate + "(第" + req.Page + "页 " + utils.IntToStr(len(nativeString)) + "条)" - //写入数据 + // 写入数据 data := map[string]string{ "A1": "日期", "B1": "应用名称", @@ -440,30 +440,32 @@ func commAgentProfit(c *gin.Context, isTotal int, req md.DataCenterProfitRecordR sql := ` SELECT %s - FROM generate_wx_ad_data_with_agent_flow + FROM generate_wx_ad_data_with_agent_flow as gf + LEFT JOIN generate_wx_ad_data AS g + ON gf.generate_data_id = g.id where %s %s ` user := GetUser(c) - where := "is_generate_report=1 and uuid=" + c.GetString("mid") + " and agent_id =" + utils.IntToStr(user.AgentId) + where := "g.is_generate_report=1 and gf.uuid=" + c.GetString("mid") + " and gf.agent_id =" + utils.IntToStr(user.AgentId) if req.AppId != "" || req.Platform != "" { - where += " and app_id in(" + appId + ")" + where += " and gf.app_id in(" + appId + ")" } if req.StartDate != "" { - where += " and date>='" + req.StartDate + "'" + where += " and gf.date >= '" + req.StartDate + "'" } if req.EndDate != "" { - where += " and date<='" + req.EndDate + "'" + where += " and gf.date<= '" + req.EndDate + "'" } - field := `%s,app_id,SUM(agent_revenue) as agent_revenue,SUM(extra_revenue) as extra_revenue` + field := `%s,gf.app_id,SUM(gf.agent_revenue) as agent_revenue,SUM(gf.extra_revenue) as extra_revenue` start := (utils.StrToInt(req.Page) - 1) * utils.StrToInt(req.Limit) - groupBy := " group by %s,app_id order by date desc,id desc" + groupBy := " group by %s,gf.app_id order by gf.date desc,gf.id desc" if req.Page != "" { groupBy += " limit " + utils.IntToStr(start) + "," + req.Limit } else { groupBy = " group by %s,app_id order by date asc,id asc" } - timeStr := "date" - if req.Type == "1" { + timeStr := "gf.date" + if req.Type == "0" { timeStr = "DATE_FORMAT(date, '%Y-%m')" } if req.Type == "2" { diff --git a/go.mod b/go.mod index cbfd343..c69bb44 100644 --- a/go.mod +++ b/go.mod @@ -37,7 +37,7 @@ require ( ) require ( - code.fnuoos.com/zhimeng/model.git v0.0.3-0.20241009031730-6c5d31eb7458 + code.fnuoos.com/zhimeng/model.git v0.0.3-0.20241009095023-24f5079bb959 github.com/360EntSecGroup-Skylar/excelize v1.4.1 )