diff --git a/app/hdl/hdl_data_center_generate_data.go b/app/hdl/hdl_data_center_generate_data.go index 446b9ca..05a21c5 100644 --- a/app/hdl/hdl_data_center_generate_data.go +++ b/app/hdl/hdl_data_center_generate_data.go @@ -11,7 +11,7 @@ import ( // GenerateDataList // @Summary 分成数据-列表 -// @Tags 数据中心------OPEN +// @Tags 数据中心------嘉俊 // @Description 数据中心-分成数据-列表 // @param Authorization header string true "验证参数Bearer和token空格拼接" // @Accept json @@ -54,10 +54,38 @@ func IncomeDataList(c *gin.Context) { e.OutErr(c, err1.Code, err1.Error()) return } + res := svc.DataCenterIncomeDataList(c, req) e.OutSuc(c, res, nil) return } + +// IncomeDataListForOpen +// @Summary 收益报表-列表 +// @Tags 数据中心-----OPEN +// @Description 数据中心-收益报表-列表 +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Accept json +// @Produce json +// @Param args body md.DataCenterGenerateDataReq true "请求参数" +// @Success 200 {object} md.DataCenterIncomeDataRes "具体看返回内容 这是data里面的数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/dataCenter/income/data/list [POST] +func IncomeDataListForOpen(c *gin.Context) { + var req md.DataCenterGenerateDataForOpenReq + err := c.ShouldBindJSON(&req) + if err != nil { + err = validate.HandleValidateErr(err) + err1 := err.(e.E) + e.OutErr(c, err1.Code, err1.Error()) + return + } + + res := svc.DataCenterIncomeDataListForOpen(c, req) + e.OutSuc(c, res, nil) + return +} + func IncomeDataListOutPut(c *gin.Context) { var req md.DataCenterGenerateDataReq err := c.ShouldBindJSON(&req) diff --git a/app/md/md_data_center_generate_data.go b/app/md/md_data_center_generate_data.go index 79395c3..20b106f 100644 --- a/app/md/md_data_center_generate_data.go +++ b/app/md/md_data_center_generate_data.go @@ -10,6 +10,14 @@ type DataCenterGenerateDataReq struct { EndTime string `json:"end_time"` } +type DataCenterGenerateDataForOpenReq struct { + Limit string `json:"limit"` + Page string `json:"page" ` + MediumId string `json:"medium_id" binding:"required"` //媒体id + StartTime string `json:"start_time"` + EndTime string `json:"end_time"` +} + type DataCenterGenerateDataRes struct { List []DataCenterGenerateDataData `json:"list" ` Total int64 `json:"total"` diff --git a/app/router/router.go b/app/router/router.go index 7680163..2b48413 100644 --- a/app/router/router.go +++ b/app/router/router.go @@ -241,13 +241,14 @@ func rDataCenter(r *gin.RouterGroup) { r.POST("/original/data/one/application/doing", hdl.OriginalDataOneApplicationDoing) // 数据中心-原始数据-单个应用数据操作 r.GET("/original/data/one/application/state", hdl.OriginalDataOneApplicationState) // 数据中心-原始数据-单个应用数据操作后的完成状态 - r.POST("/generate/data/list", hdl.GenerateDataList) // 数据中心-分成数据 - r.POST("/generate/data/del", hdl.GenerateDataDel) // 数据中心-分成数据-删除 - r.POST("/generate/data/detail", hdl.GenerateDataDetail) // 数据中心-分成数据-详情 - r.POST("/generate/data/doing", hdl.GenerateDataDoing) // 数据中心-分成数据-报表生成操作 - r.POST("/income/data/list", hdl.IncomeDataList) // 数据中心-收益报表 - r.POST("/income/data/list/output", hdl.IncomeDataListOutPut) // 数据中心-收益报表 - r.POST("/income/data/detail", hdl.IncomeDataDetail) // 数据中心-收益报表-详情 + r.POST("/generate/data/list", hdl.GenerateDataList) // 数据中心-分成数据 + r.POST("/generate/data/del", hdl.GenerateDataDel) // 数据中心-分成数据-删除 + r.POST("/generate/data/detail", hdl.GenerateDataDetail) // 数据中心-分成数据-详情 + r.POST("/generate/data/doing", hdl.GenerateDataDoing) // 数据中心-分成数据-报表生成操作 + r.POST("/income/data/list", hdl.IncomeDataList) // 数据中心-收益报表 + r.POST("/income/data/listForOpen", hdl.IncomeDataListForOpen) // 数据中心-收益报表(开放使用) + r.POST("/income/data/list/output", hdl.IncomeDataListOutPut) // 数据中心-收益报表 + r.POST("/income/data/detail", hdl.IncomeDataDetail) // 数据中心-收益报表-详情 } diff --git a/app/svc/svc_data_center_generate_data.go b/app/svc/svc_data_center_generate_data.go index 7076b0e..588126e 100644 --- a/app/svc/svc_data_center_generate_data.go +++ b/app/svc/svc_data_center_generate_data.go @@ -14,6 +14,52 @@ import ( "github.com/gin-gonic/gin" ) +func DataCenterIncomeDataListForOpen(c *gin.Context, req md.DataCenterGenerateDataForOpenReq) md.DataCenterIncomeDataRes { + engine := db.Db + NewGenerateWxAdDataDb := implement.NewGenerateWxAdDataDb(engine) + mediumId := req.MediumId + MediumList, total, _ := NewGenerateWxAdDataDb.FindGenerateWxAdDataListMedium(c.GetString("mid"), "", mediumId, "", 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 { + var tmp = md.DataCenterIncomeDataData{ + AgreementSharing: utils.Float64ToStr(float64(v.AgreementSharing) / 100), + AgentRevenue: utils.Float64ToStr(float64(v.AgentRevenue) / 100), + Id: utils.IntToStr(v.Id), + ExposureCount: utils.IntToStr(v.ExposureCount), + ClickCount: utils.IntToStr(v.ClickCount), + ClickRate: v.ClickRate, + Ecpm: utils.Float64ToStr(utils.StrToFloat64(v.Ecpm) / 100), + Date: v.Date, + MediaRevenue: utils.Float64ToStr(float64(v.MediaRevenue) / 100), + SettleAmount: utils.Float64ToStr(float64(v.MediaRevenue+v.AgentRevenue+v.AgreementSharing) / 100), + } + tmpApplet := GetAppletInfo(c, v.AppId) + if tmpApplet["platform"] != "" { + tmp.Platform = tmpApplet["platform"] + } + if tmpApplet["name"] != "" { + tmp.Name = tmpApplet["name"] + } + tmpSlot := GetSlotInfo(c, v.SlotId) + if tmpSlot["state"] != "" { + tmp.State = tmpSlot["state"] + } + if tmpSlot["name"] != "" { + tmp.AdvName = tmpSlot["name"] + } + data = append(data, tmp) + } + } + res := md.DataCenterIncomeDataRes{ + List: data, + Total: total, + State: md.AdState, + Platform: md.AdPlatform, + } + return res +} + func DataCenterIncomeDataList(c *gin.Context, req md.DataCenterGenerateDataReq) md.DataCenterIncomeDataRes { engine := db.Db NewGenerateWxAdDataDb := implement.NewGenerateWxAdDataDb(engine) @@ -62,6 +108,7 @@ func DataCenterIncomeDataList(c *gin.Context, req md.DataCenterGenerateDataReq) } return res } + func DataCenterIncomeDataListOutput(c *gin.Context, req md.DataCenterGenerateDataReq) { engine := db.Db NewGenerateWxAdDataDb := implement.NewGenerateWxAdDataDb(engine) diff --git a/docs/docs.go b/docs/docs.go index 5a11336..3301299 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -458,7 +458,7 @@ const docTemplate = `{ "application/json" ], "tags": [ - "数据中心------OPEN" + "数据中心------嘉俊" ], "summary": "分成数据-列表", "parameters": [ @@ -552,7 +552,7 @@ const docTemplate = `{ "application/json" ], "tags": [ - "数据中心------嘉俊" + "数据中心-----OPEN" ], "summary": "收益报表-列表", "parameters": [ diff --git a/docs/open.json b/docs/open.json index 6165ae4..b1d36ea 100644 --- a/docs/open.json +++ b/docs/open.json @@ -16,55 +16,7 @@ "version": "1.0" }, "host": "xxxxx.adcms.zhiyingos.cn", - "paths": { - "/api/dataCenter/generate/data/list": { - "post": { - "description": "数据中心-分成数据-列表", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "数据中心------OPEN" - ], - "summary": "分成数据-列表", - "parameters": [ - { - "type": "string", - "description": "秘钥内容", - "name": "AppSecret", - "in": "header", - "required": true - }, - { - "description": "请求参数", - "name": "args", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/md.DataCenterGenerateDataReq" - } - } - ], - "responses": { - "200": { - "description": "具体看返回内容 这是data里面的数据", - "schema": { - "$ref": "#/definitions/md.DataCenterGenerateDataRes" - } - }, - "400": { - "description": "具体错误", - "schema": { - "$ref": "#/definitions/md.Response" - } - } - } - } - } - }, + "paths": {}, "definitions": { "hdl.WxOpenThirdPartyAppList": { "type": "object", diff --git a/docs/swagger.json b/docs/swagger.json index cdf6a6f..98d4d0a 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -450,7 +450,7 @@ "application/json" ], "tags": [ - "数据中心------OPEN" + "数据中心------嘉俊" ], "summary": "分成数据-列表", "parameters": [ @@ -544,7 +544,7 @@ "application/json" ], "tags": [ - "数据中心------嘉俊" + "数据中心-----OPEN" ], "summary": "收益报表-列表", "parameters": [ diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 9179a00..3dd57fa 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -3081,7 +3081,7 @@ paths: $ref: '#/definitions/md.Response' summary: 分成数据-列表 tags: - - 数据中心------OPEN + - 数据中心------嘉俊 /api/dataCenter/income/data/detail: post: consumes: @@ -3143,7 +3143,7 @@ paths: $ref: '#/definitions/md.Response' summary: 收益报表-列表 tags: - - 数据中心------嘉俊 + - 数据中心-----OPEN /api/dataCenter/original/data/del: post: consumes: