@@ -139,7 +139,7 @@ func OriginalDataMoreApplication(c *gin.Context) { | |||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||
// @Accept json | |||
// @Produce json | |||
// @Param args body md.DataCenterOriginalDataOneApplicationDoingReq true "请求参数" | |||
// @Param args body md.DataCenterOriginalDataMoreApplicationDoingReq true "请求参数" | |||
// @Success 200 {string} "具体看返回内容 " | |||
// @Failure 400 {object} md.Response "具体错误" | |||
// @Router /api/dataCenter/original/data/more/application/doing [POST] | |||
@@ -168,7 +168,6 @@ func OriginalDataMoreApplicationDoing(c *gin.Context) { | |||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||
// @Accept json | |||
// @Produce json | |||
// @Param args body md.DataCenterOriginalDataOneApplicationDoingReq true "请求参数" | |||
// @Success 200 {string} "具体看返回内容 state=1 进行中" | |||
// @Failure 400 {object} md.Response "具体错误" | |||
// @Router /api/dataCenter/original/data/more/application/state [GET] | |||
@@ -0,0 +1,152 @@ | |||
package hdl | |||
import ( | |||
"applet/app/e" | |||
"applet/app/lib/validate" | |||
"applet/app/md" | |||
"applet/app/svc" | |||
"github.com/gin-gonic/gin" | |||
) | |||
// FinanceCenterAgentList | |||
// @Summary 代理列表 | |||
// @Tags 财务中心------嘉俊 | |||
// @Description 财务中心-代理列表 | |||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||
// @Accept json | |||
// @Produce json | |||
// @Param args body md.FinanceCenterDataReq true "请求参数" | |||
// @Success 200 {object} md.FinanceCenterDataRes "具体看返回内容 这是data里面的数据" | |||
// @Failure 400 {object} md.Response "具体错误" | |||
// @Router /api/financeCenter/agent/list [POST] | |||
func FinanceCenterAgentList(c *gin.Context) { | |||
var req md.FinanceCenterDataReq | |||
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.FinanceCenterAgentList(c, req) | |||
e.OutSuc(c, res, nil) | |||
return | |||
} | |||
// FinanceCenterAgentDetail | |||
// @Summary 代理详情 | |||
// @Tags 财务中心------嘉俊 | |||
// @Description 财务中心-代理详情 | |||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||
// @Accept json | |||
// @Produce json | |||
// @Param args body md.CommDetailReq true "请求参数" | |||
// @Success 200 {object} md.FinanceCenterDataAgentDetailRes "具体看返回内容 这是data里面的数据" | |||
// @Failure 400 {object} md.Response "具体错误" | |||
// @Router /api/financeCenter/agent/detail [POST] | |||
func FinanceCenterAgentDetail(c *gin.Context) { | |||
var req md.CommDetailReq | |||
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.FinanceCenterAgentDetail(c, req) | |||
e.OutSuc(c, res, nil) | |||
return | |||
} | |||
// FinanceCenterAgentSettleFileSave | |||
// @Summary 代理详情-结算单保存 | |||
// @Tags 财务中心------嘉俊 | |||
// @Description 财务中心-代理详情-结算单保存 | |||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||
// @Accept json | |||
// @Produce json | |||
// @Param args body md.SettleFileReq true "请求参数" | |||
// @Success 200 {string} "具体看返回内容 这是data里面的数据" | |||
// @Failure 400 {object} md.Response "具体错误" | |||
// @Router /api/financeCenter/agent/settle/file/save [POST] | |||
func FinanceCenterAgentSettleFileSave(c *gin.Context) { | |||
var req md.SettleFileReq | |||
err := c.ShouldBindJSON(&req) | |||
if err != nil { | |||
err = validate.HandleValidateErr(err) | |||
err1 := err.(e.E) | |||
e.OutErr(c, err1.Code, err1.Error()) | |||
return | |||
} | |||
svc.FinanceCenterAgentSettleFileSave(c, req) | |||
} | |||
// FinanceCenterAgentPaySave | |||
// @Summary 代理详情-确认支付 | |||
// @Tags 财务中心------嘉俊 | |||
// @Description 财务中心-代理详情-确认支付 | |||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||
// @Accept json | |||
// @Produce json | |||
// @Param args body md.CommDetailReq true "请求参数" | |||
// @Success 200 {string} "具体看返回内容 这是data里面的数据" | |||
// @Failure 400 {object} md.Response "具体错误" | |||
// @Router /api/financeCenter/agent/pay/save [POST] | |||
func FinanceCenterAgentPaySave(c *gin.Context) { | |||
var req md.CommDetailReq | |||
err := c.ShouldBindJSON(&req) | |||
if err != nil { | |||
err = validate.HandleValidateErr(err) | |||
err1 := err.(e.E) | |||
e.OutErr(c, err1.Code, err1.Error()) | |||
return | |||
} | |||
svc.FinanceCenterAgentPaySave(c, req) | |||
} | |||
// FinanceCenterAgentOtherIncomeSave | |||
// @Summary 代理详情-其他收益调整 | |||
// @Tags 财务中心------嘉俊 | |||
// @Description 财务中心-代理详情-其他收益调整 | |||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||
// @Accept json | |||
// @Produce json | |||
// @Param args body md.OtherIncomeReq true "请求参数" | |||
// @Success 200 {string} "具体看返回内容 这是data里面的数据" | |||
// @Failure 400 {object} md.Response "具体错误" | |||
// @Router /api/financeCenter/agent/other/income/save [POST] | |||
func FinanceCenterAgentOtherIncomeSave(c *gin.Context) { | |||
var req md.OtherIncomeReq | |||
err := c.ShouldBindJSON(&req) | |||
if err != nil { | |||
err = validate.HandleValidateErr(err) | |||
err1 := err.(e.E) | |||
e.OutErr(c, err1.Code, err1.Error()) | |||
return | |||
} | |||
svc.FinanceCenterAgentOtherIncomeSave(c, req) | |||
} | |||
// FinanceCenterAgentInvoiceSave | |||
// @Summary 代理详情-发票保存 | |||
// @Tags 财务中心------嘉俊 | |||
// @Description 财务中心-代理详情-发票保存 | |||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||
// @Accept json | |||
// @Produce json | |||
// @Param args body md.InvoiceReq true "请求参数" | |||
// @Success 200 {string} "具体看返回内容 这是data里面的数据" | |||
// @Failure 400 {object} md.Response "具体错误" | |||
// @Router /api/financeCenter/agent/invoice/save [POST] | |||
func FinanceCenterAgentInvoiceSave(c *gin.Context) { | |||
var req md.InvoiceReq | |||
err := c.ShouldBindJSON(&req) | |||
if err != nil { | |||
err = validate.HandleValidateErr(err) | |||
err1 := err.(e.E) | |||
e.OutErr(c, err1.Code, err1.Error()) | |||
return | |||
} | |||
svc.FinanceCenterAgentInvoiceSave(c, req) | |||
} |
@@ -41,7 +41,7 @@ func FinanceCenterMediumList(c *gin.Context) { | |||
// @Accept json | |||
// @Produce json | |||
// @Param args body md.CommDetailReq true "请求参数" | |||
// @Success 200 {object} md.FinanceCenterDataRes "具体看返回内容 这是data里面的数据" | |||
// @Success 200 {object} md.FinanceCenterDataDetailRes "具体看返回内容 这是data里面的数据" | |||
// @Failure 400 {object} md.Response "具体错误" | |||
// @Router /api/financeCenter/medium/detail [POST] | |||
func FinanceCenterMediumDetail(c *gin.Context) { | |||
@@ -0,0 +1,71 @@ | |||
package hdl | |||
import ( | |||
"applet/app/e" | |||
"applet/app/lib/validate" | |||
"applet/app/md" | |||
"applet/app/svc" | |||
"applet/app/utils" | |||
"github.com/gin-gonic/gin" | |||
) | |||
// Base | |||
// @Summary 右上角基本数据 | |||
// @Tags 首页------嘉俊 | |||
// @Description 首页-右上角基本数据 | |||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||
// @Accept json | |||
// @Produce json | |||
// @Success 200 {string} "具体看返回内容 这是data里面的数据" | |||
// @Failure 400 {object} md.Response "具体错误" | |||
// @Router /api/index/base [GET] | |||
func Base(c *gin.Context) { | |||
user := svc.GetUser(c) | |||
name := user.Username | |||
res := map[string]string{ | |||
"account_id": utils.IntToStr(user.AdmId), | |||
"name": name, | |||
"account": user.Username, | |||
} | |||
e.OutSuc(c, res, nil) | |||
return | |||
} | |||
// IndexTotal | |||
// @Summary 统计数据 | |||
// @Tags 首页------嘉俊 | |||
// @Description 首页-统计数据 | |||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||
// @Accept json | |||
// @Produce json | |||
// @Success 200 {string} "具体看返回内容 这是data里面的数据" | |||
// @Failure 400 {object} md.Response "具体错误" | |||
// @Router /api/index/total [GET] | |||
func IndexTotal(c *gin.Context) { | |||
svc.IndexTotal(c) | |||
} | |||
// IndexAppList | |||
// @Summary 数据明细 | |||
// @Tags 数据中心------嘉俊 | |||
// @Description 数据中心-数据明细 | |||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||
// @Accept json | |||
// @Produce json | |||
// @Param args body md.IndexAppListReq true "请求参数" | |||
// @Success 200 {object} md.IndexAppListRes "具体看返回内容 这是data里面的数据" | |||
// @Failure 400 {object} md.Response "具体错误" | |||
// @Router /api/index/app/list [POST] | |||
func IndexAppList(c *gin.Context) { | |||
var req md.IndexAppListReq | |||
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.IndexAppList(c, req) | |||
e.OutSuc(c, res, nil) | |||
return | |||
} |
@@ -71,7 +71,6 @@ func MediumQualificationEnterpriseAudit(c *gin.Context) { | |||
// @Produce json | |||
// @Param args body md.MediumQualificationEnterpriseReq true "请求参数" | |||
// @Success 200 {object} md.MediumQualificationBankRes "具体看返回内容 这是data里面的数据" | |||
// @Failure 400 {object} md.Response "具体错误" | |||
// @Router /api/mediumQualification/bank [POST] | |||
func MediumQualificationBank(c *gin.Context) { | |||
@@ -57,6 +57,7 @@ func RegisterForMedium(c *gin.Context) { | |||
Uuid: utils.StrToInt(masterId), | |||
MediumId: utils.StrToInt(mediumId), | |||
Kind: 1, | |||
SettlementType: 1, | |||
CompanyName: "", | |||
CompanyAbbreviation: "", | |||
UnifiedSocialCreditCode: "", | |||
@@ -166,6 +167,7 @@ func RegisterForAgent(c *gin.Context) { | |||
Uuid: utils.StrToInt(masterId), | |||
AgentId: utils.StrToInt(agentId), | |||
Kind: 1, | |||
SettlementType: 1, | |||
CompanyName: "", | |||
CompanyAbbreviation: "", | |||
UnifiedSocialCreditCode: "", | |||
@@ -34,9 +34,9 @@ func SettleCenterAgentList(c *gin.Context) { | |||
} | |||
// SettleCenterAgentSave | |||
// @Summary 代理列表 | |||
// @Summary 代理修改结算方式 | |||
// @Tags 结算中心------嘉俊 | |||
// @Description 结算中心-代理列表 | |||
// @Description 结算中心-代理修改结算方式 | |||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||
// @Accept json | |||
// @Produce json | |||
@@ -57,9 +57,9 @@ func SettleCenterAgentSave(c *gin.Context) { | |||
} | |||
// SettleCenterAgentDetail | |||
// @Summary 代理列表 | |||
// @Summary 代理详情 | |||
// @Tags 结算中心------嘉俊 | |||
// @Description 结算中心-代理列表 | |||
// @Description 结算中心-代理详情 | |||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||
// @Accept json | |||
// @Produce json | |||
@@ -34,9 +34,9 @@ func SettleCenterMediumList(c *gin.Context) { | |||
} | |||
// SettleCenterMediumSave | |||
// @Summary 媒体列表 | |||
// @Summary 媒体修改结算方式 | |||
// @Tags 结算中心------嘉俊 | |||
// @Description 结算中心-媒体列表 | |||
// @Description 结算中心-媒体修改结算方式 | |||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||
// @Accept json | |||
// @Produce json | |||
@@ -57,9 +57,9 @@ func SettleCenterMediumSave(c *gin.Context) { | |||
} | |||
// SettleCenterMediumDetail | |||
// @Summary 媒体列表 | |||
// @Summary 媒体详情 | |||
// @Tags 结算中心------嘉俊 | |||
// @Description 结算中心-媒体列表 | |||
// @Description 结算中心-媒体详情 | |||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||
// @Accept json | |||
// @Produce json | |||
@@ -33,6 +33,32 @@ type FinanceCenterDataData struct { | |||
State string `json:"state" example:"结算单状态(0:未开始 1:核算中 2:待签订 3:完成签订)"` | |||
Label string `json:"label"` | |||
} | |||
type FinanceCenterDataAgentRes struct { | |||
List []FinanceCenterDataAgentData `json:"list" ` | |||
Total int64 `json:"total"` | |||
BusinessKind []SelectData `json:"business_kind"` | |||
SettlePayState []SelectData `json:"settle_pay_state"` | |||
SettleState []SelectData `json:"settle_state"` | |||
SettleType []SelectData `json:"settle_type"` | |||
} | |||
type FinanceCenterDataAgentData struct { | |||
Id string `json:"id"` | |||
TimeStr string `json:"time_str" example:"业务时间"` | |||
Name string `json:"name" example:"媒体名称"` | |||
SettleType string `json:"settle_type" example:"结算单类型(1:日结 2:周结 3:月结 4:预付)"` | |||
AllIncome string `json:"all_income" example:"合计收益"` | |||
TopIncome string `json:"top_income" example:"上游结算"` | |||
CommissionIncome string `json:"commission_income" example:"佣金留存"` | |||
PlatformIncome string `json:"platform_income" example:"平台留存"` | |||
ChangeIncome string `json:"change_income" example:"调价留存"` | |||
Income string `json:"income" example:"渠道结算"` | |||
OtherIncome string `json:"other_income" example:"其他调整"` | |||
PayState string `json:"pay_state" example:"结算单支付状态(0:未开始 1:待审核发票 2:发票审核中 3:发票审核拒绝 4:付款中 5:已付款)"` | |||
State string `json:"state" example:"结算单状态(0:未开始 1:核算中 2:待签订 3:完成签订)"` | |||
Label string `json:"label"` | |||
} | |||
type FinanceCenterDataDetailRes struct { | |||
Data FinanceCenterDataDetail `json:"data" ` | |||
BusinessKind []SelectData `json:"business_kind"` | |||
@@ -42,7 +68,15 @@ type FinanceCenterDataDetailRes struct { | |||
InvoiceCate []SelectData `json:"invoice_cate"` | |||
InvoiceState []SelectData `json:"invoice_state"` | |||
} | |||
type FinanceCenterDataAgentDetailRes struct { | |||
Data FinanceCenterDataAgentDetail `json:"data" ` | |||
BusinessKind []SelectData `json:"business_kind"` | |||
SettlePayState []SelectData `json:"settle_pay_state"` | |||
SettleState []SelectData `json:"settle_state"` | |||
SettleType []SelectData `json:"settle_type"` | |||
InvoiceCate []SelectData `json:"invoice_cate"` | |||
InvoiceState []SelectData `json:"invoice_state"` | |||
} | |||
type FinanceCenterDataDetail struct { | |||
TimeStr string `json:"time_str" example:"业务时间"` | |||
Name string `json:"name" example:"媒体名称"` | |||
@@ -60,6 +94,23 @@ type FinanceCenterDataDetail struct { | |||
PayState string `json:"pay_state" example:"结算单支付状态(0:未开始 1:待审核发票 2:发票审核中 3:发票审核拒绝 4:付款中 5:已付款)"` | |||
State string `json:"state" example:"结算单状态(0:未开始 1:核算中 2:待签订 3:完成签订)"` | |||
} | |||
type FinanceCenterDataAgentDetail struct { | |||
TimeStr string `json:"time_str" example:"业务时间"` | |||
Name string `json:"name" example:"媒体名称"` | |||
Account string `json:"account" example:"媒体账号"` | |||
Source string `json:"source" example:"结算标示"` | |||
SettleFile string `json:"settle_file" example:"结算单"` | |||
Invoice Invoice `json:"invoice"` | |||
AllIncome string `json:"all_income" example:"合计收益"` | |||
TopIncome string `json:"top_income" example:"上游结算"` | |||
CommissionIncome string `json:"commission_income" example:"佣金留存"` | |||
PlatformIncome string `json:"platform_income" example:"平台留存"` | |||
ChangeIncome string `json:"change_income" example:"调价留存"` | |||
Income string `json:"income" example:"渠道结算"` | |||
OtherIncome string `json:"other_income" example:"其他调整"` | |||
PayState string `json:"pay_state" example:"结算单支付状态(0:未开始 1:待审核发票 2:发票审核中 3:发票审核拒绝 4:付款中 5:已付款)"` | |||
State string `json:"state" example:"结算单状态(0:未开始 1:核算中 2:待签订 3:完成签订)"` | |||
} | |||
type Invoice struct { | |||
Type string `json:"type"` | |||
Time string `json:"time"` | |||
@@ -0,0 +1,25 @@ | |||
package md | |||
type IndexAppListReq struct { | |||
StartDate string `json:"start_date" example:"2024-08-30"` | |||
EndDate string `json:"end_date" example:"2024-08-30"` | |||
Sort string `json:"sort" example:"排序"` | |||
Name string `json:"name" ` | |||
} | |||
type IndexAppListRes struct { | |||
List []IndexAppListData `json:"list" ` | |||
Sort []SelectData `json:"sort"` | |||
} | |||
type IndexAppListData struct { | |||
Name string `json:"name"` | |||
Logo string `json:"logo"` | |||
List []IndexAppListDataList `json:"list"` | |||
TableList []string `json:"table_list"` | |||
} | |||
type IndexAppListDataList struct { | |||
Name string `json:"name"` | |||
Value string `json:"value"` | |||
Type string `json:"type"` | |||
Bili string `json:"bili"` | |||
} |
@@ -73,9 +73,14 @@ func route(r *gin.RouterGroup) { | |||
rDataCenter(r.Group("/dataCenter")) //数据中心 | |||
rSettleCenter(r.Group("/settleCenter")) //结算中心 | |||
rFinanceCenter(r.Group("/financeCenter")) //财务中心 | |||
rIndex(r.Group("/index")) //首页 | |||
} | |||
func rIndex(r *gin.RouterGroup) { | |||
r.GET("/base", hdl.Base) //首页-基本信息 | |||
r.GET("/total", hdl.IndexTotal) //首页-统计数据 | |||
r.POST("/app/list", hdl.IndexAppList) //首页-应用数据 | |||
} | |||
func rRole(r *gin.RouterGroup) { | |||
r.GET("/roleList", hdl.RoleList) //角色列表 | |||
r.POST("/addRole", hdl.AddRole) //角色添加 | |||
@@ -165,17 +170,19 @@ func rDataCenter(r *gin.RouterGroup) { | |||
r.POST("/original/data/doing", hdl.OriginalDataDoing) //数据中心-原始数据-记录应用时操作 | |||
r.POST("/original/data/more/application", hdl.OriginalDataMoreApplication) //数据中心-原始数据-一键导入应用列表 | |||
r.POST("/original/data/more/application/doing", hdl.OriginalDataMoreApplicationDoing) //数据中心-原始数据-一键导入操作 | |||
r.POST("/original/data/more/application/state", hdl.OriginalDataMoreApplicationState) //数据中心-原始数据-一键导入操作后的完成状态 | |||
r.GET("/original/data/more/application/state", hdl.OriginalDataMoreApplicationState) //数据中心-原始数据-一键导入操作后的完成状态 | |||
r.GET("/original/data/one/application", hdl.OriginalDataOneApplication) //数据中心-原始数据-单个导入应用列表 | |||
r.POST("/original/data/one/application/ad/list", hdl.OriginalDataOneApplicationAdList) //数据中心-原始数据-单个导入应用-广告位列表 | |||
r.POST("/original/data/one/application/total", hdl.OriginalDataOneApplicationTotal) //数据中心-原始数据-单个应用数据统计 | |||
r.POST("/original/data/one/application/doing", hdl.OriginalDataOneApplicationDoing) //数据中心-原始数据-单个应用数据操作 | |||
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/detail", hdl.IncomeDataDetail) //数据中心-收益报表-详情 | |||
r.GET("/original/data/one/application/state", hdl.OriginalDataMoreApplicationState) //数据中心-原始数据-单个应用数据操作后的完成状态 | |||
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/detail", hdl.IncomeDataDetail) //数据中心-收益报表-详情 | |||
} | |||
func rSettleCenter(r *gin.RouterGroup) { | |||
@@ -195,4 +202,11 @@ func rFinanceCenter(r *gin.RouterGroup) { | |||
r.POST("/medium/other/income/save", hdl.FinanceCenterMediumOtherIncomeSave) //财务中心-媒体详情-其他收益调整 | |||
r.POST("/medium/pay/save", hdl.FinanceCenterMediumPaySave) //财务中心-媒体详情-确认支付 | |||
r.POST("/agent/list", hdl.FinanceCenterAgentList) //财务中心-代理列表 | |||
r.POST("/agent/detail", hdl.FinanceCenterAgentDetail) //财务中心-代理详情 | |||
r.POST("/agent/settle/file/save", hdl.FinanceCenterAgentSettleFileSave) //财务中心-代理详情-结算单上传 | |||
r.POST("/agent/invoice/save", hdl.FinanceCenterAgentInvoiceSave) //财务中心-代理详情-发票审核 | |||
r.POST("/agent/other/income/save", hdl.FinanceCenterAgentOtherIncomeSave) //财务中心-代理详情-其他收益调整 | |||
r.POST("/agent/pay/save", hdl.FinanceCenterAgentPaySave) //财务中心-代理详情-确认支付 | |||
} |
@@ -100,7 +100,7 @@ func AgentQualificationEnterpriseAudit(c *gin.Context, req md.AgentQualification | |||
if data == nil { | |||
return e.NewErr(400, "记录不存在") | |||
} | |||
if data.State == 1 { | |||
if data.State == 2 { | |||
return e.NewErr(400, "记录已审核过") | |||
} | |||
data.State = utils.StrToInt(req.State) | |||
@@ -0,0 +1,194 @@ | |||
package svc | |||
import ( | |||
"applet/app/e" | |||
"applet/app/md" | |||
"applet/app/utils" | |||
db "code.fnuoos.com/zhimeng/model.git/src" | |||
"code.fnuoos.com/zhimeng/model.git/src/super/implement" | |||
"encoding/json" | |||
"github.com/gin-gonic/gin" | |||
) | |||
func FinanceCenterAgentInvoiceSave(c *gin.Context, req md.InvoiceReq) { | |||
engine := db.Db | |||
NewAgentSettlementDb := implement.NewAgentSettlementDb(engine) | |||
data, _ := NewAgentSettlementDb.GetAgentSettlementById(utils.StrToInt(req.Id)) | |||
if data.State != 3 { | |||
e.OutErr(c, 400, e.NewErr(400, "代理未完成签订")) | |||
return | |||
} | |||
if data.PayState == 5 { | |||
e.OutErr(c, 400, e.NewErr(400, "结算单已付款,不能调整")) | |||
return | |||
} | |||
NewAgentInvoiceDb := implement.NewAgentInvoiceDb(engine) | |||
invoice, _ := NewAgentInvoiceDb.GetAgentInvoice(data.Id) | |||
if req.State == "1" { | |||
data.PayState = 4 | |||
invoice.State = 1 | |||
for k := range req.File { | |||
req.File[k].State = "1" | |||
} | |||
} | |||
if req.State == "2" { | |||
invoice.State = 2 | |||
data.PayState = 3 | |||
for k, v := range req.File { | |||
if v.State == "0" { | |||
req.File[k].State = "1" | |||
} | |||
} | |||
} | |||
invoice.File = utils.SerializeStr(req.File) | |||
engine.Where("id=?", data.Id).Cols("pay_state").Update(data) | |||
engine.Where("id=?", invoice.Id).Cols("state,file").Update(invoice) | |||
e.OutSuc(c, "success", nil) | |||
return | |||
} | |||
func FinanceCenterAgentSettleFileSave(c *gin.Context, req md.SettleFileReq) { | |||
engine := db.Db | |||
NewAgentSettlementDb := implement.NewAgentSettlementDb(engine) | |||
data, _ := NewAgentSettlementDb.GetAgentSettlementById(utils.StrToInt(req.Id)) | |||
if data.State >= 2 { | |||
e.OutErr(c, 400, e.NewErr(400, "已推送给代理,不能再调整")) | |||
return | |||
} | |||
data.State = 2 | |||
data.SettleFile = req.File | |||
engine.Where("id=?", data.Id).Cols("state,settle_file").Update(data) | |||
e.OutSuc(c, "success", nil) | |||
return | |||
} | |||
func FinanceCenterAgentPaySave(c *gin.Context, req md.CommDetailReq) { | |||
engine := db.Db | |||
NewAgentSettlementDb := implement.NewAgentSettlementDb(engine) | |||
data, _ := NewAgentSettlementDb.GetAgentSettlementById(utils.StrToInt(req.Id)) | |||
if data.PayState < 4 { | |||
e.OutErr(c, 400, e.NewErr(400, "不能再调整")) | |||
return | |||
} | |||
data.PayState = 5 | |||
engine.Where("id=?", data.Id).Cols("pay_state").Update(data) | |||
e.OutSuc(c, "success", nil) | |||
return | |||
} | |||
func FinanceCenterAgentOtherIncomeSave(c *gin.Context, req md.OtherIncomeReq) { | |||
engine := db.Db | |||
NewAgentSettlementDb := implement.NewAgentSettlementDb(engine) | |||
data, _ := NewAgentSettlementDb.GetAgentSettlementById(utils.StrToInt(req.Id)) | |||
if data.State >= 2 { | |||
e.OutErr(c, 400, e.NewErr(400, "已推送给代理,不能再调整")) | |||
return | |||
} | |||
data.OtherIncome = int(utils.StrToFloat64(req.Amount) * 100) | |||
engine.Where("id=?", data.Id).Cols("other_income").Update(data) | |||
e.OutSuc(c, "success", nil) | |||
return | |||
} | |||
func FinanceCenterAgentDetail(c *gin.Context, req md.CommDetailReq) md.FinanceCenterDataAgentDetailRes { | |||
engine := db.Db | |||
NewAgentSettlementDb := implement.NewAgentSettlementDb(engine) | |||
data, _ := NewAgentSettlementDb.GetAgentSettlementById(utils.StrToInt(req.Id)) | |||
file := make([]md.InvoiceFile, 0) | |||
invoice := md.Invoice{ | |||
Type: "0", | |||
Time: "", | |||
Count: "0", | |||
File: file, | |||
} | |||
//发票 | |||
NewAgentInvoiceDb := implement.NewAgentInvoiceDb(engine) | |||
invoiceData, _ := NewAgentInvoiceDb.GetAgentInvoice(data.Id) | |||
if invoiceData != nil { | |||
invoice.Type = utils.IntToStr(invoiceData.Type) | |||
invoice.Time = invoiceData.UpdateAt | |||
invoice.Count = utils.IntToStr(invoiceData.Count) | |||
json.Unmarshal([]byte(invoiceData.File), &file) | |||
} | |||
tmp := md.FinanceCenterDataAgentDetail{ | |||
Source: "手动导入", | |||
SettleFile: data.SettleFile, | |||
Invoice: invoice, | |||
AllIncome: utils.Float64ToStr(float64(data.OtherIncome+data.BasicIncome) / 100), | |||
TopIncome: "", | |||
CommissionIncome: "", | |||
PlatformIncome: "", | |||
ChangeIncome: "", | |||
Income: utils.Float64ToStr(float64(data.BasicIncome) / 100), | |||
OtherIncome: utils.Float64ToStr(float64(data.OtherIncome) / 100), | |||
TimeStr: data.StartDate, | |||
PayState: utils.IntToStr(data.PayState), | |||
State: utils.IntToStr(data.State), | |||
} | |||
if data.EndDate != "" && data.EndDate != "0000-00-00" { | |||
if data.EndDate != data.StartDate { | |||
tmp.TimeStr += "~" + data.EndDate | |||
} | |||
} | |||
tmpAgent := GetAgentInfo(c, data.AgentId) | |||
if tmpAgent["name"] != "" { | |||
tmp.Name = tmpAgent["name"] | |||
} | |||
if tmpAgent["account"] != "" { | |||
tmp.Account = tmpAgent["account"] | |||
} | |||
res := md.FinanceCenterDataAgentDetailRes{ | |||
Data: tmp, | |||
InvoiceCate: md.InvoiceCate, | |||
SettleType: md.AccountSettleState, | |||
BusinessKind: md.BusinessKind, | |||
SettlePayState: md.SettlePayState, | |||
SettleState: md.SettleState, | |||
InvoiceState: md.InvoiceState, | |||
} | |||
return res | |||
} | |||
func FinanceCenterAgentList(c *gin.Context, req md.FinanceCenterDataReq) md.FinanceCenterDataAgentRes { | |||
engine := db.Db | |||
NewAgentSettlementDb := implement.NewAgentSettlementDb(engine) | |||
AgentList, total, _ := NewAgentSettlementDb.FindAgentSettlementList(c.GetString("mid"), "", "", req.PayState, "", req.StartTime, req.EndTime, utils.StrToInt(req.Page), utils.StrToInt(req.Limit)) | |||
data := make([]md.FinanceCenterDataAgentData, 0) | |||
if len(AgentList) > 0 { | |||
for _, v := range AgentList { | |||
var tmp = md.FinanceCenterDataAgentData{ | |||
Id: utils.IntToStr(v.Id), | |||
Name: "", | |||
AllIncome: utils.Float64ToStr(float64(v.OtherIncome+v.BasicIncome) / 100), | |||
TopIncome: "", | |||
CommissionIncome: "", | |||
PlatformIncome: "", | |||
ChangeIncome: "", | |||
Income: utils.Float64ToStr(float64(v.BasicIncome) / 100), | |||
OtherIncome: utils.Float64ToStr(float64(v.OtherIncome) / 100), | |||
TimeStr: v.StartDate, | |||
SettleType: utils.IntToStr(v.Kind), | |||
PayState: utils.IntToStr(v.PayState), | |||
State: utils.IntToStr(v.State), | |||
Label: "预估", | |||
} | |||
tmpAgent := GetAgentInfo(c, v.AgentId) | |||
if tmpAgent["name"] != "" { | |||
tmp.Name = tmpAgent["name"] | |||
} | |||
if v.EndDate != "" && v.EndDate != "0000-00-00" { | |||
if v.EndDate != v.StartDate { | |||
tmp.TimeStr += "~" + v.EndDate | |||
} | |||
tmp.Label = "" | |||
} | |||
data = append(data, tmp) | |||
} | |||
} | |||
res := md.FinanceCenterDataAgentRes{ | |||
List: data, | |||
Total: total, | |||
SettleType: md.AccountSettleState, | |||
BusinessKind: md.BusinessKind, | |||
SettlePayState: md.SettlePayState, | |||
SettleState: md.SettleState, | |||
} | |||
return res | |||
} |
@@ -0,0 +1,174 @@ | |||
package svc | |||
import ( | |||
"applet/app/e" | |||
"applet/app/md" | |||
"applet/app/utils" | |||
db "code.fnuoos.com/zhimeng/model.git/src" | |||
"fmt" | |||
"github.com/gin-gonic/gin" | |||
"strings" | |||
"time" | |||
) | |||
func IndexTotal(c *gin.Context) { | |||
//昨天 | |||
yesterday := utils.GetTimeRange("yesterday") | |||
yesterdayTotal := commTotal(c, time.Unix(yesterday["start"], 0).Format("2006-01-02"), time.Unix(yesterday["end"]-3600, 0).Format("2006-01-02")) | |||
//前天 | |||
beforeYesterDayTotal := commTotal(c, time.Unix(yesterday["start"]-86400, 0).Format("2006-01-02"), time.Unix(yesterday["start"]-3600, 0).Format("2006-01-02")) | |||
//7天 | |||
withinSevenDays := utils.GetTimeRange("new_within_seven_days") | |||
withinSevenDaysTotal := commTotal(c, time.Unix(withinSevenDays["start"], 0).Format("2006-01-02"), time.Unix(withinSevenDays["end"]-3600, 0).Format("2006-01-02")) | |||
//7天前的 7天 | |||
beforeWithinSevenDaysTotal := commTotal(c, time.Unix(withinSevenDays["start"]-3600-7*86400, 0).Format("2006-01-02"), time.Unix(withinSevenDays["start"]-3600, 0).Format("2006-01-02")) | |||
//本月 | |||
currentMonth := utils.GetTimeRange("current_month") | |||
currentMonthTotal := commTotal(c, time.Unix(currentMonth["start"], 0).Format("2006-01-02"), time.Unix(currentMonth["end"]-3600, 0).Format("2006-01-02")) | |||
//上月 | |||
lastMonth := utils.GetTimeRange("last_month") | |||
lastMonthTotal := commTotal(c, time.Unix(lastMonth["start"], 0).Format("2006-01-02"), time.Unix(lastMonth["end"]-3600, 0).Format("2006-01-02")) | |||
//上上月 | |||
beforeLastMonth := time.Unix(lastMonth["start"]-86400, 0) | |||
beforeLastMonthStr := time.Date(beforeLastMonth.Year(), beforeLastMonth.Month(), 1, 0, 0, 0, 0, beforeLastMonth.Location()) | |||
beforeLastMonthTotal := commTotal(c, beforeLastMonthStr.Format("2006-01-02"), time.Unix(lastMonth["start"]-3600, 0).Format("2006-01-02")) | |||
res := []md.IndexAppListDataList{ | |||
{Name: "昨日收益(媒体)", Type: "yesterday", Bili: commBili(c, beforeYesterDayTotal, yesterdayTotal, "media_revenue"), Value: utils.Float64ToStr(utils.StrToFloat64(yesterdayTotal[0]["media_revenue"]) / 100)}, | |||
{Name: "七日收益(媒体)", Type: "within_seven_days", Bili: commBili(c, beforeWithinSevenDaysTotal, withinSevenDaysTotal, "media_revenue"), Value: utils.Float64ToStr(utils.StrToFloat64(withinSevenDaysTotal[0]["media_revenue"]) / 100)}, | |||
{Name: "本月收益(媒体)", Type: "current_month", Bili: commBili(c, lastMonthTotal, currentMonthTotal, "media_revenue"), Value: utils.Float64ToStr(utils.StrToFloat64(currentMonthTotal[0]["media_revenue"]) / 100)}, | |||
{Name: "上月收益(媒体)", Type: "last_month", Bili: commBili(c, beforeLastMonthTotal, lastMonthTotal, "media_revenue"), Value: utils.Float64ToStr(utils.StrToFloat64(lastMonthTotal[0]["media_revenue"]) / 100)}, | |||
{Name: "昨日收益(曝光量)", Type: "yesterday", Bili: commBili(c, beforeYesterDayTotal, yesterdayTotal, "exposure_count"), Value: yesterdayTotal[0]["exposure_count"]}, | |||
{Name: "七日收益(曝光量)", Type: "within_seven_days", Bili: commBili(c, beforeWithinSevenDaysTotal, withinSevenDaysTotal, "exposure_count"), Value: withinSevenDaysTotal[0]["exposure_count"]}, | |||
{Name: "本月收益(曝光量)", Type: "current_month", Bili: commBili(c, lastMonthTotal, currentMonthTotal, "exposure_count"), Value: currentMonthTotal[0]["exposure_count"]}, | |||
{Name: "上月收益(曝光量)", Type: "last_month", Bili: commBili(c, beforeLastMonthTotal, lastMonthTotal, "exposure_count"), Value: lastMonthTotal[0]["exposure_count"]}, | |||
} | |||
e.OutSuc(c, res, nil) | |||
return | |||
} | |||
func commBili(c *gin.Context, before, after []map[string]string, types string) string { | |||
bili := "-%" | |||
if utils.StrToFloat64(before[0][types]) > 0 { | |||
tmpDiff := utils.StrToFloat64(after[0][types]) - utils.StrToFloat64(before[0][types]) | |||
types1 := "+" | |||
if tmpDiff < 0 { | |||
types1 = "" | |||
} | |||
bili = types1 + utils.Float64ToStr(tmpDiff/utils.StrToFloat64(before[0][types])*100) + "%" | |||
} | |||
return bili | |||
} | |||
func IndexAppList(c *gin.Context, req md.IndexAppListReq) md.IndexAppListRes { | |||
appId := make([]string, 0) | |||
data := commTotalByApp(c, req, appId) | |||
for _, v := range data { | |||
appId = append(appId, v["app_id"]) | |||
} | |||
start := utils.TimeStdParseUnix(req.StartDate + " 00:00:00") | |||
day := (utils.TimeStdParseUnix(req.EndDate+" 00:00:00") - start) / 86400 | |||
req.EndDate = time.Unix(start-1, 0).Format("2006-01-02") | |||
req.StartDate = time.Unix(start-1-day*86400, 0).Format("2006-01-02") | |||
dataLast := commTotalByApp(c, req, appId) | |||
dataLastMap := make(map[string][]map[string]string) | |||
for _, v := range dataLast { | |||
dataLastMap[v["app_id"]] = make([]map[string]string, 0) | |||
dataLastMap[v["app_id"]] = append(dataLastMap[v["app_id"]], v) | |||
} | |||
list := make([]md.IndexAppListData, 0) | |||
for _, v := range data { | |||
_, ok := dataLastMap[v["app_id"]] | |||
if ok == false { | |||
dataLastMap[v["app_id"]] = []map[string]string{ | |||
{"media_revenue": "0", "ecpm": "0", "exposure_count": "0", "click_count": "0", "click_rate": "0"}, | |||
} | |||
} | |||
tmpList := []map[string]string{ | |||
v, | |||
} | |||
dataList := []md.IndexAppListDataList{ | |||
{Name: "广告预估收益", Type: "media_revenue", Bili: commBili(c, dataLastMap[v["app_id"]], tmpList, "media_revenue"), Value: utils.Float64ToStr(utils.StrToFloat64(v["media_revenue"]) / 100)}, | |||
{Name: "ECPM", Type: "ecpm", Bili: commBili(c, dataLastMap[v["app_id"]], tmpList, "ecpm"), Value: v["ecpm"]}, | |||
{Name: "曝光量", Type: "exposure_count", Bili: commBili(c, dataLastMap[v["app_id"]], tmpList, "exposure_count"), Value: v["exposure_count"]}, | |||
{Name: "点击量", Type: "click_count", Bili: commBili(c, dataLastMap[v["app_id"]], tmpList, "click_count"), Value: v["click_count"]}, | |||
{Name: "点击率", Type: "click_rate", Bili: commBili(c, dataLastMap[v["app_id"]], tmpList, "click_rate"), Value: utils.GetPrec(v["click_rate"], "2") + "%"}, | |||
} | |||
applet := GetAppletInfo(c, v["app_id"]) | |||
tmp := md.IndexAppListData{ | |||
Name: applet["name"], | |||
Logo: applet["logo"], | |||
List: dataList, | |||
TableList: []string{}, | |||
} | |||
list = append(list, tmp) | |||
} | |||
res := md.IndexAppListRes{ | |||
List: list, | |||
Sort: []md.SelectData{ | |||
{Name: "按收益最高", Value: "media_revenue desc"}, | |||
{Name: "按ECPM最高", Value: "ecpm desc"}, | |||
{Name: "按曝光量最高", Value: "exposure_count desc"}, | |||
}, | |||
} | |||
return res | |||
} | |||
func commTotal(c *gin.Context, startDate, endDate string) []map[string]string { | |||
sql := ` | |||
SELECT | |||
SUM(exposure_count) as exposure_count, | |||
SUM(click_count) as click_count, | |||
SUM(click_rate) as click_rate, | |||
SUM(ecpm) as ecpm, | |||
SUM(media_revenue) as media_revenue | |||
FROM generate_wx_ad_data | |||
where %s | |||
` | |||
where := "uuid=" + c.GetString("mid") | |||
if startDate != "" { | |||
where += " and date>='" + startDate + "'" | |||
} | |||
if endDate != "" { | |||
where += " and date<='" + endDate + "'" | |||
} | |||
sql = fmt.Sprintf(sql, where) | |||
nativeString, _ := db.QueryNativeString(db.Db, sql) | |||
if len(nativeString) == 0 { | |||
nativeString = []map[string]string{ | |||
{ | |||
"media_revenue": "0", | |||
}, | |||
} | |||
} | |||
return nativeString | |||
} | |||
func commTotalByApp(c *gin.Context, req md.IndexAppListReq, appId []string) []map[string]string { | |||
sql := ` | |||
SELECT | |||
app_id as app_id, | |||
SUM(exposure_count) as exposure_count, | |||
SUM(click_count) as click_count, | |||
SUM(click_count)/SUM(exposure_count)*100 as click_rate, | |||
SUM(ecpm) as ecpm, | |||
SUM(media_revenue) as media_revenue | |||
FROM generate_wx_ad_data | |||
where %s group by app_id order by %s,id asc limit 50 | |||
` | |||
where := "uuid=" + c.GetString("mid") | |||
if req.StartDate != "" { | |||
where += " and date>='" + req.StartDate + "'" | |||
} | |||
if req.EndDate != "" { | |||
where += " and date<='" + req.EndDate + "'" | |||
} | |||
if req.Name != "" { | |||
mediumId := GetMediumId(c, req.Name) | |||
where += " and medium_id in(" + mediumId + ")" | |||
} | |||
if len(appId) > 0 { | |||
where += " and app_id in(" + strings.Join(appId, ",") + ")" | |||
} | |||
if req.Sort == "" { | |||
req.Sort = "media_revenue desc" | |||
} | |||
sql = fmt.Sprintf(sql, where, req.Sort) | |||
nativeString, _ := db.QueryNativeString(db.Db, sql) | |||
return nativeString | |||
} |
@@ -80,7 +80,7 @@ func MediumQualificationEnterpriseAudit(c *gin.Context, req md.MediumQualificati | |||
if data == nil { | |||
return e.NewErr(400, "记录不存在") | |||
} | |||
if data.State == 1 { | |||
if data.State == 2 { | |||
return e.NewErr(400, "记录已审核过") | |||
} | |||
data.State = utils.StrToInt(req.State) | |||
@@ -91,6 +91,7 @@ func GenerateWxAdData(req md.GenerateWxAdData) (err error, generateWxAdData mode | |||
now := time.Now() | |||
generateWxAdData = model.GenerateWxAdData{ | |||
MediumId: originalWxAdData.MediumId, | |||
Uuid: originalWxAdData.Uuid, | |||
Platform: originalWxAdData.Platform, | |||
AppId: originalWxAdData.AppId, | |||
@@ -323,3 +323,55 @@ func IntToStr(i int) string { | |||
func Int64ToStr(i int64) string { | |||
return strconv.FormatInt(i, 10) | |||
} | |||
func Float64ToStrByPrec(f float64, prec int) string { | |||
return strconv.FormatFloat(f, 'f', prec, 64) | |||
} | |||
func GetPrec(sum, commPrec string) string { | |||
if sum == "" { | |||
sum = "0" | |||
} | |||
sum = StrToFormat(sum, StrToInt(commPrec)) | |||
ex := strings.Split(sum, ".") | |||
if len(ex) == 2 { | |||
if StrToFloat64(ex[1]) == 0 { | |||
sum = ex[0] | |||
} else { | |||
val := Float64ToStrByPrec(StrToFloat64(ex[1]), 0) | |||
keyMax := 0 | |||
for i := 0; i < len(val); i++ { | |||
ch := string(val[i]) | |||
fmt.Println(StrToInt(ch)) | |||
if StrToInt(ch) > 0 { | |||
keyMax = i | |||
} | |||
} | |||
valNew := val[0 : keyMax+1] | |||
sum = ex[0] + "." + strings.ReplaceAll(ex[1], val, valNew) | |||
} | |||
} | |||
return sum | |||
} | |||
func StrToFormat(s string, prec int) string { | |||
ex := strings.Split(s, ".") | |||
if len(ex) == 2 { | |||
if StrToFloat64(ex[1]) == 0 { //小数点后面为空就是不要小数点了 | |||
return ex[0] | |||
} | |||
//看取多少位 | |||
str := ex[1] | |||
str1 := str | |||
if prec < len(str) { | |||
str1 = str[0:prec] | |||
} else { | |||
for i := 0; i < prec-len(str); i++ { | |||
str1 += "0" | |||
} | |||
} | |||
if prec > 0 { | |||
return ex[0] + "." + str1 | |||
} else { | |||
return ex[0] | |||
} | |||
} | |||
return s | |||
} |
@@ -35,7 +35,7 @@ require ( | |||
require ( | |||
code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5 | |||
code.fnuoos.com/zhimeng/model.git v0.0.3-0.20240830085315-046c30582759 | |||
code.fnuoos.com/zhimeng/model.git v0.0.3-0.20240902065422-a58ca385e5a0 | |||
github.com/jinzhu/copier v0.4.0 | |||
) | |||