@@ -11,7 +11,7 @@ import ( | |||||
// GenerateDataList | // GenerateDataList | ||||
// @Summary 分成数据-列表 | // @Summary 分成数据-列表 | ||||
// @Tags 数据中心------OPEN | |||||
// @Tags 数据中心------嘉俊 | |||||
// @Description 数据中心-分成数据-列表 | // @Description 数据中心-分成数据-列表 | ||||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | // @param Authorization header string true "验证参数Bearer和token空格拼接" | ||||
// @Accept json | // @Accept json | ||||
@@ -54,10 +54,38 @@ func IncomeDataList(c *gin.Context) { | |||||
e.OutErr(c, err1.Code, err1.Error()) | e.OutErr(c, err1.Code, err1.Error()) | ||||
return | return | ||||
} | } | ||||
res := svc.DataCenterIncomeDataList(c, req) | res := svc.DataCenterIncomeDataList(c, req) | ||||
e.OutSuc(c, res, nil) | e.OutSuc(c, res, nil) | ||||
return | 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) { | func IncomeDataListOutPut(c *gin.Context) { | ||||
var req md.DataCenterGenerateDataReq | var req md.DataCenterGenerateDataReq | ||||
err := c.ShouldBindJSON(&req) | err := c.ShouldBindJSON(&req) | ||||
@@ -10,6 +10,14 @@ type DataCenterGenerateDataReq struct { | |||||
EndTime string `json:"end_time"` | 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 { | type DataCenterGenerateDataRes struct { | ||||
List []DataCenterGenerateDataData `json:"list" ` | List []DataCenterGenerateDataData `json:"list" ` | ||||
Total int64 `json:"total"` | Total int64 `json:"total"` | ||||
@@ -241,13 +241,14 @@ func rDataCenter(r *gin.RouterGroup) { | |||||
r.POST("/original/data/one/application/doing", hdl.OriginalDataOneApplicationDoing) // 数据中心-原始数据-单个应用数据操作 | r.POST("/original/data/one/application/doing", hdl.OriginalDataOneApplicationDoing) // 数据中心-原始数据-单个应用数据操作 | ||||
r.GET("/original/data/one/application/state", hdl.OriginalDataOneApplicationState) // 数据中心-原始数据-单个应用数据操作后的完成状态 | 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) // 数据中心-收益报表-详情 | |||||
} | } | ||||
@@ -14,6 +14,52 @@ import ( | |||||
"github.com/gin-gonic/gin" | "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 { | func DataCenterIncomeDataList(c *gin.Context, req md.DataCenterGenerateDataReq) md.DataCenterIncomeDataRes { | ||||
engine := db.Db | engine := db.Db | ||||
NewGenerateWxAdDataDb := implement.NewGenerateWxAdDataDb(engine) | NewGenerateWxAdDataDb := implement.NewGenerateWxAdDataDb(engine) | ||||
@@ -62,6 +108,7 @@ func DataCenterIncomeDataList(c *gin.Context, req md.DataCenterGenerateDataReq) | |||||
} | } | ||||
return res | return res | ||||
} | } | ||||
func DataCenterIncomeDataListOutput(c *gin.Context, req md.DataCenterGenerateDataReq) { | func DataCenterIncomeDataListOutput(c *gin.Context, req md.DataCenterGenerateDataReq) { | ||||
engine := db.Db | engine := db.Db | ||||
NewGenerateWxAdDataDb := implement.NewGenerateWxAdDataDb(engine) | NewGenerateWxAdDataDb := implement.NewGenerateWxAdDataDb(engine) | ||||
@@ -458,7 +458,7 @@ const docTemplate = `{ | |||||
"application/json" | "application/json" | ||||
], | ], | ||||
"tags": [ | "tags": [ | ||||
"数据中心------OPEN" | |||||
"数据中心------嘉俊" | |||||
], | ], | ||||
"summary": "分成数据-列表", | "summary": "分成数据-列表", | ||||
"parameters": [ | "parameters": [ | ||||
@@ -552,7 +552,7 @@ const docTemplate = `{ | |||||
"application/json" | "application/json" | ||||
], | ], | ||||
"tags": [ | "tags": [ | ||||
"数据中心------嘉俊" | |||||
"数据中心-----OPEN" | |||||
], | ], | ||||
"summary": "收益报表-列表", | "summary": "收益报表-列表", | ||||
"parameters": [ | "parameters": [ | ||||
@@ -16,55 +16,7 @@ | |||||
"version": "1.0" | "version": "1.0" | ||||
}, | }, | ||||
"host": "xxxxx.adcms.zhiyingos.cn", | "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": { | "definitions": { | ||||
"hdl.WxOpenThirdPartyAppList": { | "hdl.WxOpenThirdPartyAppList": { | ||||
"type": "object", | "type": "object", | ||||
@@ -450,7 +450,7 @@ | |||||
"application/json" | "application/json" | ||||
], | ], | ||||
"tags": [ | "tags": [ | ||||
"数据中心------OPEN" | |||||
"数据中心------嘉俊" | |||||
], | ], | ||||
"summary": "分成数据-列表", | "summary": "分成数据-列表", | ||||
"parameters": [ | "parameters": [ | ||||
@@ -544,7 +544,7 @@ | |||||
"application/json" | "application/json" | ||||
], | ], | ||||
"tags": [ | "tags": [ | ||||
"数据中心------嘉俊" | |||||
"数据中心-----OPEN" | |||||
], | ], | ||||
"summary": "收益报表-列表", | "summary": "收益报表-列表", | ||||
"parameters": [ | "parameters": [ | ||||
@@ -3081,7 +3081,7 @@ paths: | |||||
$ref: '#/definitions/md.Response' | $ref: '#/definitions/md.Response' | ||||
summary: 分成数据-列表 | summary: 分成数据-列表 | ||||
tags: | tags: | ||||
- 数据中心------OPEN | |||||
- 数据中心------嘉俊 | |||||
/api/dataCenter/income/data/detail: | /api/dataCenter/income/data/detail: | ||||
post: | post: | ||||
consumes: | consumes: | ||||
@@ -3143,7 +3143,7 @@ paths: | |||||
$ref: '#/definitions/md.Response' | $ref: '#/definitions/md.Response' | ||||
summary: 收益报表-列表 | summary: 收益报表-列表 | ||||
tags: | tags: | ||||
- 数据中心------嘉俊 | |||||
- 数据中心-----OPEN | |||||
/api/dataCenter/original/data/del: | /api/dataCenter/original/data/del: | ||||
post: | post: | ||||
consumes: | consumes: | ||||