@@ -10,10 +10,17 @@ type Config struct { | |||||
CurlDebug bool `yaml:"curldebug"` | CurlDebug bool `yaml:"curldebug"` | ||||
SrvAddr string `yaml:"srv_addr"` | SrvAddr string `yaml:"srv_addr"` | ||||
RedisAddr string `yaml:"redis_addr"` | RedisAddr string `yaml:"redis_addr"` | ||||
MQ MQCfg `yaml:"mq"` | |||||
DB DBCfg `yaml:"db"` | DB DBCfg `yaml:"db"` | ||||
Log LogCfg `yaml:"log"` | Log LogCfg `yaml:"log"` | ||||
Local bool | Local bool | ||||
} | } | ||||
type MQCfg struct { | |||||
Host string `yaml:"host"` | |||||
Port string `yaml:"port"` | |||||
User string `yaml:"user"` | |||||
Pwd string `yaml:"pwd"` | |||||
} | |||||
// 数据库配置结构体 | // 数据库配置结构体 | ||||
type DBCfg struct { | type DBCfg struct { | ||||
@@ -14,6 +14,7 @@ var ( | |||||
CurlDebug bool | CurlDebug bool | ||||
SrvAddr string | SrvAddr string | ||||
RedisAddr string | RedisAddr string | ||||
MQ *MQCfg | |||||
DB *DBCfg | DB *DBCfg | ||||
Log *LogCfg | Log *LogCfg | ||||
Local bool | Local bool | ||||
@@ -47,4 +48,6 @@ func InitCfg() { | |||||
Log = &conf.Log | Log = &conf.Log | ||||
RedisAddr = conf.RedisAddr | RedisAddr = conf.RedisAddr | ||||
SrvAddr = conf.SrvAddr | SrvAddr = conf.SrvAddr | ||||
MQ = &conf.MQ | |||||
} | } |
@@ -0,0 +1,28 @@ | |||||
package cfg | |||||
import ( | |||||
"code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit" | |||||
"encoding/json" | |||||
"os" | |||||
"strings" | |||||
"time" | |||||
) | |||||
func InitMq() { | |||||
data, _ := json.Marshal(MQ) | |||||
filePutContents("init_rabbit_mq", string(data)) | |||||
err := rabbit.Init(MQ.Host, MQ.Port, MQ.User, MQ.Pwd) | |||||
if err != nil { | |||||
filePutContents("init_rabbit_mq", err.Error()) | |||||
return | |||||
} | |||||
} | |||||
func filePutContents(fileName string, content string) { | |||||
fd, _ := os.OpenFile("./tmp/"+fileName+".log", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0644) | |||||
fd_time := time.Now().Format("2006-01-02 15:04:05") | |||||
fd_content := strings.Join([]string{"[", fd_time, "] ", content, "\n"}, "") | |||||
buf := []byte(fd_content) | |||||
fd.Write(buf) | |||||
fd.Close() | |||||
} |
@@ -8,6 +8,20 @@ import ( | |||||
"github.com/gin-gonic/gin" | "github.com/gin-gonic/gin" | ||||
) | ) | ||||
// QualificationSelectBase | |||||
// @Summary 认证下拉框选择内容 | |||||
// @Tags 资质认证------嘉俊 | |||||
// @Description 资质认证-认证下拉框选择内容 | |||||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||||
// @Accept json | |||||
// @Produce json | |||||
// @Success 200 {string} "具体看返回内容" | |||||
// @Failure 400 {object} md.Response "具体错误" | |||||
// @Router /api/qualification/select/base [GET] | |||||
func QualificationSelectBase(c *gin.Context) { | |||||
svc.QualificationSelectBase(c) | |||||
} | |||||
// AgentQualificationEnterprise | // AgentQualificationEnterprise | ||||
// @Summary 主体资质 | // @Summary 主体资质 | ||||
// @Tags 渠道资质------嘉俊 | // @Tags 渠道资质------嘉俊 | ||||
@@ -0,0 +1,155 @@ | |||||
package hdl | |||||
import ( | |||||
"applet/app/e" | |||||
"applet/app/lib/validate" | |||||
"applet/app/md" | |||||
"applet/app/svc" | |||||
"github.com/gin-gonic/gin" | |||||
) | |||||
// GenerateDataList | |||||
// @Summary 分成数据-列表 | |||||
// @Tags 数据中心------嘉俊 | |||||
// @Description 数据中心-分成数据-列表 | |||||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||||
// @Accept json | |||||
// @Produce json | |||||
// @Param args body md.DataCenterGenerateDataReq true "请求参数" | |||||
// @Success 200 {object} md.DataCenterGenerateDataRes "具体看返回内容 这是data里面的数据" | |||||
// @Failure 400 {object} md.Response "具体错误" | |||||
// @Router /api/dataCenter/generate/data/list [POST] | |||||
func GenerateDataList(c *gin.Context) { | |||||
var req md.DataCenterGenerateDataReq | |||||
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.DataCenterGenerateDataList(c, req) | |||||
e.OutSuc(c, res, nil) | |||||
return | |||||
} | |||||
// IncomeDataList | |||||
// @Summary 收益报表-列表 | |||||
// @Tags 数据中心------嘉俊 | |||||
// @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 IncomeDataList(c *gin.Context) { | |||||
var req md.DataCenterGenerateDataReq | |||||
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.DataCenterIncomeDataList(c, req) | |||||
e.OutSuc(c, res, nil) | |||||
return | |||||
} | |||||
// IncomeDataDetail | |||||
// @Summary 收益报表-详情 | |||||
// @Tags 数据中心------嘉俊 | |||||
// @Description 数据中心-收益报表-详情 | |||||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||||
// @Accept json | |||||
// @Produce json | |||||
// @Param args body md.DataCenterGenerateDataCommReq true "请求参数" | |||||
// @Success 200 {object} md.DataCenterIncomeDataDetail "具体看返回内容 这是data里面的数据" | |||||
// @Failure 400 {object} md.Response "具体错误" | |||||
// @Router /api/dataCenter/income/data/detail [POST] | |||||
func IncomeDataDetail(c *gin.Context) { | |||||
var req md.DataCenterGenerateDataCommReq | |||||
err := c.ShouldBindJSON(&req) | |||||
if err != nil { | |||||
err = validate.HandleValidateErr(err) | |||||
err1 := err.(e.E) | |||||
e.OutErr(c, err1.Code, err1.Error()) | |||||
return | |||||
} | |||||
svc.DataCenterIncomeDataDetail(c, req) | |||||
} | |||||
// GenerateDataDel | |||||
// @Summary 分成数据-删除 | |||||
// @Tags 数据中心------嘉俊 | |||||
// @Description 数据中心-分成数据-删除 | |||||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||||
// @Accept json | |||||
// @Produce json | |||||
// @Param args body md.DataCenterGenerateDataCommReq true "请求参数" | |||||
// @Success 200 {string} "具体看返回内容 " | |||||
// @Failure 400 {object} md.Response "具体错误" | |||||
// @Router /api/dataCenter/generate/data/del [POST] | |||||
func GenerateDataDel(c *gin.Context) { | |||||
var req md.DataCenterGenerateDataCommReq | |||||
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.DataCenterGenerateDataDel(c, req) | |||||
e.OutSuc(c, res, nil) | |||||
return | |||||
} | |||||
// GenerateDataDoing | |||||
// @Summary 分成数据-应用操作 | |||||
// @Tags 数据中心------嘉俊 | |||||
// @Description 数据中心-分成数据-应用操作 | |||||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||||
// @Accept json | |||||
// @Produce json | |||||
// @Param args body md.DataCenterGenerateDataCommReq true "请求参数" | |||||
// @Success 200 {string} "具体看返回内容 " | |||||
// @Failure 400 {object} md.Response "具体错误" | |||||
// @Router /api/dataCenter/generate/data/doing [POST] | |||||
func GenerateDataDoing(c *gin.Context) { | |||||
var req md.DataCenterGenerateDataCommReq | |||||
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.DataCenterGenerateDataDoing(c, req) | |||||
e.OutSuc(c, res, nil) | |||||
return | |||||
} | |||||
// GenerateDataDetail | |||||
// @Summary 分成数据-详情 | |||||
// @Tags 数据中心------嘉俊 | |||||
// @Description 数据中心-分成数据-详情 | |||||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||||
// @Accept json | |||||
// @Produce json | |||||
// @Param args body md.DataCenterGenerateDataCommReq true "请求参数" | |||||
// @Success 200 {object} md.DataCenterGenerateDataDetailData "具体看返回内容 " | |||||
// @Failure 400 {object} md.Response "具体错误" | |||||
// @Router /api/dataCenter/generate/data/detail [POST] | |||||
func GenerateDataDetail(c *gin.Context) { | |||||
var req md.DataCenterGenerateDataCommReq | |||||
err := c.ShouldBindJSON(&req) | |||||
if err != nil { | |||||
err = validate.HandleValidateErr(err) | |||||
err1 := err.(e.E) | |||||
e.OutErr(c, err1.Code, err1.Error()) | |||||
return | |||||
} | |||||
svc.DataCenterGenerateDataDetail(c, req) | |||||
} |
@@ -0,0 +1,285 @@ | |||||
package hdl | |||||
import ( | |||||
"applet/app/e" | |||||
"applet/app/lib/validate" | |||||
"applet/app/md" | |||||
"applet/app/svc" | |||||
"applet/app/utils/cache" | |||||
"github.com/gin-gonic/gin" | |||||
) | |||||
// OriginalDataList | |||||
// @Summary 原始数据-列表 | |||||
// @Tags 数据中心------嘉俊 | |||||
// @Description 数据中心-原始数据-列表 | |||||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||||
// @Accept json | |||||
// @Produce json | |||||
// @Param args body md.DataCenterOriginalDataReq true "请求参数" | |||||
// @Success 200 {object} md.DataCenterOriginalDataRes "具体看返回内容 这是data里面的数据" | |||||
// @Failure 400 {object} md.Response "具体错误" | |||||
// @Router /api/dataCenter/original/data/list [POST] | |||||
func OriginalDataList(c *gin.Context) { | |||||
var req md.DataCenterOriginalDataReq | |||||
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.DataCenterOriginalDataList(c, req) | |||||
e.OutSuc(c, res, nil) | |||||
return | |||||
} | |||||
// OriginalDataDel | |||||
// @Summary 原始数据-删除 | |||||
// @Tags 数据中心------嘉俊 | |||||
// @Description 数据中心-原始数据-删除 | |||||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||||
// @Accept json | |||||
// @Produce json | |||||
// @Param args body md.DataCenterOriginalDataCommReq true "请求参数" | |||||
// @Success 200 {string} "具体看返回内容 " | |||||
// @Failure 400 {object} md.Response "具体错误" | |||||
// @Router /api/dataCenter/original/data/del [POST] | |||||
func OriginalDataDel(c *gin.Context) { | |||||
var req md.DataCenterOriginalDataCommReq | |||||
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.DataCenterOriginalDataDel(c, req) | |||||
e.OutSuc(c, res, nil) | |||||
return | |||||
} | |||||
// OriginalDataDoing | |||||
// @Summary 原始数据-应用操作 | |||||
// @Tags 数据中心------嘉俊 | |||||
// @Description 数据中心-原始数据-应用操作 | |||||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||||
// @Accept json | |||||
// @Produce json | |||||
// @Param args body md.DataCenterDataCenterOriginalDataDoingReq true "请求参数" | |||||
// @Success 200 {string} "具体看返回内容 " | |||||
// @Failure 400 {object} md.Response "具体错误" | |||||
// @Router /api/dataCenter/original/data/doing [POST] | |||||
func OriginalDataDoing(c *gin.Context) { | |||||
var req md.DataCenterDataCenterOriginalDataDoingReq | |||||
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.DataCenterOriginalDataDoing(c, req) | |||||
e.OutSuc(c, res, nil) | |||||
return | |||||
} | |||||
// OriginalDataTotal | |||||
// @Summary 原始数据-记录应用时统计 | |||||
// @Tags 数据中心------嘉俊 | |||||
// @Description 数据中心-原始数据-记录应用时统计 | |||||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||||
// @Accept json | |||||
// @Produce json | |||||
// @Param args body md.DataCenterOriginalDataCommReq true "请求参数" | |||||
// @Success 200 {string} "具体看返回内容 " | |||||
// @Failure 400 {object} md.Response "具体错误" | |||||
// @Router /api/dataCenter/original/data/total [POST] | |||||
func OriginalDataTotal(c *gin.Context) { | |||||
var req md.DataCenterOriginalDataCommReq | |||||
err := c.ShouldBindJSON(&req) | |||||
if err != nil { | |||||
err = validate.HandleValidateErr(err) | |||||
err1 := err.(e.E) | |||||
e.OutErr(c, err1.Code, err1.Error()) | |||||
return | |||||
} | |||||
svc.DataCenterOriginalDataTotal(c, req) | |||||
} | |||||
// OriginalDataMoreApplication | |||||
// @Summary 原始数据-一键导入应用列表 | |||||
// @Tags 数据中心------嘉俊 | |||||
// @Description 数据中心-原始数据-一键导入应用列表 | |||||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||||
// @Accept json | |||||
// @Produce json | |||||
// @Param args body md.DataCenterOriginalDataMoreApplicationReq true "请求参数" | |||||
// @Success 200 {object} md.DataCenterOriginalDataMoreApplicationRes "具体看返回内容 这是data里面的数据" | |||||
// @Failure 400 {object} md.Response "具体错误" | |||||
// @Router /api/dataCenter/original/data/more/application [POST] | |||||
func OriginalDataMoreApplication(c *gin.Context) { | |||||
var req md.DataCenterOriginalDataMoreApplicationReq | |||||
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.OriginalDataMoreApplication(c, req) | |||||
e.OutSuc(c, res, nil) | |||||
return | |||||
} | |||||
// OriginalDataMoreApplicationDoing | |||||
// @Summary 原始数据-一键导入操作 | |||||
// @Tags 数据中心------嘉俊 | |||||
// @Description 数据中心-原始数据-一键导入操作 | |||||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||||
// @Accept json | |||||
// @Produce json | |||||
// @Param args body md.DataCenterOriginalDataOneApplicationDoingReq true "请求参数" | |||||
// @Success 200 {string} "具体看返回内容 " | |||||
// @Failure 400 {object} md.Response "具体错误" | |||||
// @Router /api/dataCenter/original/data/more/application/doing [POST] | |||||
func OriginalDataMoreApplicationDoing(c *gin.Context) { | |||||
var req md.DataCenterOriginalDataMoreApplicationDoingReq | |||||
err := c.ShouldBindJSON(&req) | |||||
if err != nil { | |||||
err = validate.HandleValidateErr(err) | |||||
err1 := err.(e.E) | |||||
e.OutErr(c, err1.Code, err1.Error()) | |||||
return | |||||
} | |||||
err = svc.OriginalDataMoreApplicationDoing(c, req) | |||||
if err != nil { | |||||
e.OutErr(c, 400, e.NewErr(400, err.Error())) | |||||
return | |||||
} | |||||
e.OutSuc(c, "success", nil) | |||||
return | |||||
} | |||||
// OriginalDataMoreApplicationState | |||||
// @Summary 原始数据-一键导入操作状态 | |||||
// @Tags 数据中心------嘉俊 | |||||
// @Description 数据中心-原始数据-一键导入操作状态 | |||||
// @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] | |||||
func OriginalDataMoreApplicationState(c *gin.Context) { | |||||
res := map[string]string{ | |||||
"state": "0", | |||||
} | |||||
state, _ := cache.GetString(c.GetString("mid") + ":original.wx.ad.data") | |||||
if state == "1" { | |||||
res["state"] = "1" | |||||
} | |||||
e.OutSuc(c, res, nil) | |||||
return | |||||
} | |||||
// OriginalDataOneApplication | |||||
// @Summary 原始数据-单个导入应用列表 | |||||
// @Tags 数据中心------嘉俊 | |||||
// @Description 数据中心-原始数据-单个导入应用列表 | |||||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||||
// @Accept json | |||||
// @Produce json | |||||
// @Success 200 {object} md.DataCenterOriginalDataOneApplicationRes "具体看返回内容 这是data里面的数据" | |||||
// @Failure 400 {object} md.Response "具体错误" | |||||
// @Router /api/dataCenter/original/data/one/application [GET] | |||||
func OriginalDataOneApplication(c *gin.Context) { | |||||
svc.OriginalDataOneApplication(c) | |||||
} | |||||
// OriginalDataOneApplicationAdList | |||||
// @Summary 原始数据-单个导入应用-广告位列表 | |||||
// @Tags 数据中心------嘉俊 | |||||
// @Description 数据中心-原始数据-单个导入应用-广告位列表 | |||||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||||
// @Accept json | |||||
// @Produce json | |||||
// @Param args body md.DataCenterOriginalDataOneApplicationAdListReq true "请求参数" | |||||
// @Success 200 {object} md.DataCenterOriginalDataOneApplicationAdListRes "具体看返回内容 这是data里面的数据" | |||||
// @Failure 400 {object} md.Response "具体错误" | |||||
// @Router /api/dataCenter/original/data/one/application/ad/list [POST] | |||||
func OriginalDataOneApplicationAdList(c *gin.Context) { | |||||
var req md.DataCenterOriginalDataOneApplicationAdListReq | |||||
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.OriginalDataOneApplicationAdList(c, req) | |||||
e.OutSuc(c, res, nil) | |||||
return | |||||
} | |||||
// OriginalDataOneApplicationTotal | |||||
// @Summary 原始数据-单个应用数据统计 | |||||
// @Tags 数据中心------嘉俊 | |||||
// @Description 数据中心-原始数据-单个应用数据统计 | |||||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||||
// @Accept json | |||||
// @Produce json | |||||
// @Param args body md.DataCenterOriginalDataOneApplicationDoingReq true "请求参数" | |||||
// @Success 200 {object} md.DataCenterOriginalDataOneApplicationDoingRes "具体看返回内容 " | |||||
// @Failure 400 {object} md.Response "具体错误" | |||||
// @Router /api/dataCenter/original/data/one/application/total [POST] | |||||
func OriginalDataOneApplicationTotal(c *gin.Context) { | |||||
var req md.DataCenterOriginalDataOneApplicationDoingReq | |||||
err := c.ShouldBindJSON(&req) | |||||
if err != nil { | |||||
err = validate.HandleValidateErr(err) | |||||
err1 := err.(e.E) | |||||
e.OutErr(c, err1.Code, err1.Error()) | |||||
return | |||||
} | |||||
svc.OriginalDataOneApplicationTotal(c, req) | |||||
} | |||||
// OriginalDataOneApplicationDoing | |||||
// @Summary 原始数据-单个应用数据操作 | |||||
// @Tags 数据中心------嘉俊 | |||||
// @Description 数据中心-原始数据-单个应用数据操作 | |||||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||||
// @Accept json | |||||
// @Produce json | |||||
// @Param args body md.DataCenterOriginalDataOneApplicationDoingReq true "请求参数" | |||||
// @Success 200 {string} "具体看返回内容 " | |||||
// @Failure 400 {object} md.Response "具体错误" | |||||
// @Router /api/dataCenter/original/data/one/application/doing [POST] | |||||
func OriginalDataOneApplicationDoing(c *gin.Context) { | |||||
var req md.DataCenterOriginalDataOneApplicationDoingReq | |||||
err := c.ShouldBindJSON(&req) | |||||
if err != nil { | |||||
err = validate.HandleValidateErr(err) | |||||
err1 := err.(e.E) | |||||
e.OutErr(c, err1.Code, err1.Error()) | |||||
return | |||||
} | |||||
args := md.DataCenterOriginalDataMoreApplicationDoingReq{ | |||||
Ids: []md.DataCenterOriginalDataOneApplicationDoingReqData{ | |||||
{ | |||||
AppId: req.AppId, | |||||
AdId: req.AdId, | |||||
}, | |||||
}, | |||||
Date: req.Date, | |||||
} | |||||
err = svc.OriginalDataMoreApplicationDoing(c, args) | |||||
if err != nil { | |||||
e.OutErr(c, 400, e.NewErr(400, err.Error())) | |||||
return | |||||
} | |||||
e.OutSuc(c, "success", nil) | |||||
return | |||||
} |
@@ -3,8 +3,10 @@ package hdl | |||||
import ( | import ( | ||||
"applet/app/e" | "applet/app/e" | ||||
"applet/app/lib/wechat" | "applet/app/lib/wechat" | ||||
"applet/app/md" | |||||
"applet/app/svc" | "applet/app/svc" | ||||
"applet/app/utils" | "applet/app/utils" | ||||
"code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit" | |||||
db "code.fnuoos.com/zhimeng/model.git/src" | db "code.fnuoos.com/zhimeng/model.git/src" | ||||
"code.fnuoos.com/zhimeng/model.git/src/super/implement" | "code.fnuoos.com/zhimeng/model.git/src/super/implement" | ||||
"fmt" | "fmt" | ||||
@@ -16,10 +18,10 @@ func Demo(c *gin.Context) { | |||||
mediumId := utils.GenerateUniqueRandomNumbers(8) | mediumId := utils.GenerateUniqueRandomNumbers(8) | ||||
fmt.Println(mediumId) | fmt.Println(mediumId) | ||||
} | } | ||||
appId := c.DefaultQuery("app_id", "") | appId := c.DefaultQuery("app_id", "") | ||||
masterId := svc.GetMasterId(c) | masterId := svc.GetMasterId(c) | ||||
adUnitId := c.DefaultQuery("adunit_id", "") | adUnitId := c.DefaultQuery("adunit_id", "") | ||||
//1、查找对应 user_wx_applet_list 记录 | //1、查找对应 user_wx_applet_list 记录 | ||||
userWxAppletListDb := implement.NewUserWxAppletListDb(db.Db) | userWxAppletListDb := implement.NewUserWxAppletListDb(db.Db) | ||||
UserWxAppletList, err := userWxAppletListDb.GetUserWxAppletList(masterId) | UserWxAppletList, err := userWxAppletListDb.GetUserWxAppletList(masterId) | ||||
@@ -41,6 +43,25 @@ func Demo(c *gin.Context) { | |||||
e.OutErr(c, e.ERR_NOT_FAN, "未查询到对应三方应用记录") | e.OutErr(c, e.ERR_NOT_FAN, "未查询到对应三方应用记录") | ||||
return | return | ||||
} | } | ||||
ch, err := rabbit.Cfg.Pool.GetChannel() | |||||
if err != nil { | |||||
return | |||||
} | |||||
defer ch.Release() | |||||
var arg = md.ZhiosAdOriginalDataApplication{ | |||||
Mid: "123456", | |||||
AppId: "123", | |||||
AdId: "123", | |||||
Date: "123", | |||||
ComponentAppsecret: wxOpenThirdPartyAppList.AppSecret, | |||||
ComponentAppid: wxOpenThirdPartyAppList.Appid, | |||||
} | |||||
err = ch.PublishV2(md.AdOriginalData, arg, md.AdOriginalDataApplication) | |||||
if err != nil { | |||||
ch.PublishV2(md.AdOriginalData, arg, md.AdOriginalDataApplication) | |||||
} | |||||
return | |||||
wxApiService, err := wechat.NewWxApiService(masterId, wxOpenThirdPartyAppList.Appid, wxOpenThirdPartyAppList.AppSecret) | wxApiService, err := wechat.NewWxApiService(masterId, wxOpenThirdPartyAppList.Appid, wxOpenThirdPartyAppList.AppSecret) | ||||
if err != nil { | if err != nil { | ||||
e.OutErr(c, e.ERR, err.Error()) | e.OutErr(c, e.ERR, err.Error()) | ||||
@@ -0,0 +1,90 @@ | |||||
package hdl | |||||
import ( | |||||
"applet/app/e" | |||||
"applet/app/lib/validate" | |||||
"applet/app/md" | |||||
"applet/app/svc" | |||||
"github.com/gin-gonic/gin" | |||||
) | |||||
// DivisionStrategyList | |||||
// @Summary 列表 | |||||
// @Tags 分成策略------嘉俊 | |||||
// @Description 分成策略-列表 | |||||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||||
// @Accept json | |||||
// @Produce json | |||||
// @Param args body md.DivisionStrategyReq true "请求参数" | |||||
// @Success 200 {object} md.DivisionStrategyRes "具体看返回内容 这是data里面的数据" | |||||
// @Failure 400 {object} md.Response "具体错误" | |||||
// @Router /api/divisionStrategy/list [POST] | |||||
func DivisionStrategyList(c *gin.Context) { | |||||
var req md.DivisionStrategyReq | |||||
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.DivisionStrategyList(c, req) | |||||
e.OutSuc(c, res, nil) | |||||
return | |||||
} | |||||
// DivisionStrategyDetail | |||||
// @Summary 详情 | |||||
// @Tags 分成策略------嘉俊 | |||||
// @Description 分成策略-详情 | |||||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||||
// @Accept json | |||||
// @Produce json | |||||
// @Param args body md.DivisionStrategyDetailReq true "请求参数" | |||||
// @Success 200 {object} md.DivisionStrategyDetailRes "具体看返回内容 这是data里面的数据" | |||||
// @Failure 400 {object} md.Response "具体错误" | |||||
// @Router /api/divisionStrategy/detail [POST] | |||||
func DivisionStrategyDetail(c *gin.Context) { | |||||
var req md.DivisionStrategyDetailReq | |||||
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.DivisionStrategyDetail(c, req) | |||||
e.OutSuc(c, res, nil) | |||||
return | |||||
} | |||||
// DivisionStrategySave | |||||
// @Summary 保存 | |||||
// @Tags 分成策略------嘉俊 | |||||
// @Description 分成策略-保存 | |||||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||||
// @Accept json | |||||
// @Produce json | |||||
// @Param args body md.DivisionStrategyDetailRes true "请求参数" | |||||
// @Success 200 {string} "具体看返回内容 " | |||||
// @Failure 400 {object} md.Response "具体错误" | |||||
// @Router /api/divisionStrategy/save [POST] | |||||
func DivisionStrategySave(c *gin.Context) { | |||||
var req md.DivisionStrategyDetailRes | |||||
err := c.ShouldBindJSON(&req) | |||||
if err != nil { | |||||
err = validate.HandleValidateErr(err) | |||||
err1 := err.(e.E) | |||||
e.OutErr(c, err1.Code, err1.Error()) | |||||
return | |||||
} | |||||
err = svc.DivisionStrategySave(c, req) | |||||
if err != nil { | |||||
err = validate.HandleValidateErr(err) | |||||
err1 := err.(e.E) | |||||
e.OutErr(c, err1.Code, err1.Error()) | |||||
return | |||||
} | |||||
e.OutSuc(c, "success", nil) | |||||
return | |||||
} |
@@ -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" | |||||
) | |||||
// FinanceCenterMediumList | |||||
// @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/medium/list [POST] | |||||
func FinanceCenterMediumList(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.FinanceCenterMediumList(c, req) | |||||
e.OutSuc(c, res, nil) | |||||
return | |||||
} | |||||
// FinanceCenterMediumDetail | |||||
// @Summary 媒体详情 | |||||
// @Tags 财务中心------嘉俊 | |||||
// @Description 财务中心-媒体详情 | |||||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||||
// @Accept json | |||||
// @Produce json | |||||
// @Param args body md.CommDetailReq true "请求参数" | |||||
// @Success 200 {object} md.FinanceCenterDataRes "具体看返回内容 这是data里面的数据" | |||||
// @Failure 400 {object} md.Response "具体错误" | |||||
// @Router /api/financeCenter/medium/detail [POST] | |||||
func FinanceCenterMediumDetail(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.FinanceCenterMediumDetail(c, req) | |||||
e.OutSuc(c, res, nil) | |||||
return | |||||
} | |||||
// FinanceCenterMediumSettleFileSave | |||||
// @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/medium/settle/file/save [POST] | |||||
func FinanceCenterMediumSettleFileSave(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.FinanceCenterMediumSettleFileSave(c, req) | |||||
} | |||||
// FinanceCenterMediumPaySave | |||||
// @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/medium/pay/save [POST] | |||||
func FinanceCenterMediumPaySave(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.FinanceCenterMediumPaySave(c, req) | |||||
} | |||||
// FinanceCenterMediumOtherIncomeSave | |||||
// @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/medium/other/income/save [POST] | |||||
func FinanceCenterMediumOtherIncomeSave(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.FinanceCenterMediumOtherIncomeSave(c, req) | |||||
} | |||||
// FinanceCenterMediumInvoiceSave | |||||
// @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/medium/invoice/save [POST] | |||||
func FinanceCenterMediumInvoiceSave(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.FinanceCenterMediumInvoiceSave(c, req) | |||||
} |
@@ -0,0 +1,80 @@ | |||||
package hdl | |||||
import ( | |||||
"applet/app/e" | |||||
"applet/app/lib/validate" | |||||
"applet/app/md" | |||||
"applet/app/svc" | |||||
"github.com/gin-gonic/gin" | |||||
) | |||||
// SettleCenterAgentList | |||||
// @Summary 代理列表 | |||||
// @Tags 结算中心------嘉俊 | |||||
// @Description 结算中心-代理列表 | |||||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||||
// @Accept json | |||||
// @Produce json | |||||
// @Param args body md.SettleCenterDataReq true "请求参数" | |||||
// @Success 200 {object} md.SettleCenterDataRes "具体看返回内容 这是data里面的数据" | |||||
// @Failure 400 {object} md.Response "具体错误" | |||||
// @Router /api/settleCenter/agent/list [POST] | |||||
func SettleCenterAgentList(c *gin.Context) { | |||||
var req md.SettleCenterDataReq | |||||
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.SettleCenterAgentList(c, req) | |||||
e.OutSuc(c, res, nil) | |||||
return | |||||
} | |||||
// SettleCenterAgentSave | |||||
// @Summary 代理列表 | |||||
// @Tags 结算中心------嘉俊 | |||||
// @Description 结算中心-代理列表 | |||||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||||
// @Accept json | |||||
// @Produce json | |||||
// @Param args body md.SettleCenterDataSaveReq true "请求参数" | |||||
// @Success 200 {string} "具体看返回内容 这是data里面的数据" | |||||
// @Failure 400 {object} md.Response "具体错误" | |||||
// @Router /api/settleCenter/agent/save [POST] | |||||
func SettleCenterAgentSave(c *gin.Context) { | |||||
var req md.SettleCenterDataSaveReq | |||||
err := c.ShouldBindJSON(&req) | |||||
if err != nil { | |||||
err = validate.HandleValidateErr(err) | |||||
err1 := err.(e.E) | |||||
e.OutErr(c, err1.Code, err1.Error()) | |||||
return | |||||
} | |||||
svc.SettleCenterAgentSave(c, req) | |||||
} | |||||
// SettleCenterAgentDetail | |||||
// @Summary 代理列表 | |||||
// @Tags 结算中心------嘉俊 | |||||
// @Description 结算中心-代理列表 | |||||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||||
// @Accept json | |||||
// @Produce json | |||||
// @Param args body md.SettleCenterDataDetailReq true "请求参数" | |||||
// @Success 200 {string} "具体看返回内容 这是data里面的数据" | |||||
// @Failure 400 {object} md.Response "具体错误" | |||||
// @Router /api/settleCenter/agent/detail [POST] | |||||
func SettleCenterAgentDetail(c *gin.Context) { | |||||
var req md.SettleCenterDataDetailReq | |||||
err := c.ShouldBindJSON(&req) | |||||
if err != nil { | |||||
err = validate.HandleValidateErr(err) | |||||
err1 := err.(e.E) | |||||
e.OutErr(c, err1.Code, err1.Error()) | |||||
return | |||||
} | |||||
svc.SettleCenterAgentDetail(c, req) | |||||
} |
@@ -0,0 +1,80 @@ | |||||
package hdl | |||||
import ( | |||||
"applet/app/e" | |||||
"applet/app/lib/validate" | |||||
"applet/app/md" | |||||
"applet/app/svc" | |||||
"github.com/gin-gonic/gin" | |||||
) | |||||
// SettleCenterMediumList | |||||
// @Summary 媒体列表 | |||||
// @Tags 结算中心------嘉俊 | |||||
// @Description 结算中心-媒体列表 | |||||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||||
// @Accept json | |||||
// @Produce json | |||||
// @Param args body md.SettleCenterDataReq true "请求参数" | |||||
// @Success 200 {object} md.SettleCenterDataRes "具体看返回内容 这是data里面的数据" | |||||
// @Failure 400 {object} md.Response "具体错误" | |||||
// @Router /api/settleCenter/medium/list [POST] | |||||
func SettleCenterMediumList(c *gin.Context) { | |||||
var req md.SettleCenterDataReq | |||||
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.SettleCenterMediumList(c, req) | |||||
e.OutSuc(c, res, nil) | |||||
return | |||||
} | |||||
// SettleCenterMediumSave | |||||
// @Summary 媒体列表 | |||||
// @Tags 结算中心------嘉俊 | |||||
// @Description 结算中心-媒体列表 | |||||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||||
// @Accept json | |||||
// @Produce json | |||||
// @Param args body md.SettleCenterDataSaveReq true "请求参数" | |||||
// @Success 200 {string} "具体看返回内容 这是data里面的数据" | |||||
// @Failure 400 {object} md.Response "具体错误" | |||||
// @Router /api/settleCenter/medium/save [POST] | |||||
func SettleCenterMediumSave(c *gin.Context) { | |||||
var req md.SettleCenterDataSaveReq | |||||
err := c.ShouldBindJSON(&req) | |||||
if err != nil { | |||||
err = validate.HandleValidateErr(err) | |||||
err1 := err.(e.E) | |||||
e.OutErr(c, err1.Code, err1.Error()) | |||||
return | |||||
} | |||||
svc.SettleCenterMediumSave(c, req) | |||||
} | |||||
// SettleCenterMediumDetail | |||||
// @Summary 媒体列表 | |||||
// @Tags 结算中心------嘉俊 | |||||
// @Description 结算中心-媒体列表 | |||||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||||
// @Accept json | |||||
// @Produce json | |||||
// @Param args body md.SettleCenterDataDetailReq true "请求参数" | |||||
// @Success 200 {string} "具体看返回内容 这是data里面的数据" | |||||
// @Failure 400 {object} md.Response "具体错误" | |||||
// @Router /api/settleCenter/medium/detail [POST] | |||||
func SettleCenterMediumDetail(c *gin.Context) { | |||||
var req md.SettleCenterDataDetailReq | |||||
err := c.ShouldBindJSON(&req) | |||||
if err != nil { | |||||
err = validate.HandleValidateErr(err) | |||||
err1 := err.(e.E) | |||||
e.OutErr(c, err1.Code, err1.Error()) | |||||
return | |||||
} | |||||
svc.SettleCenterMediumDetail(c, req) | |||||
} |
@@ -4,3 +4,6 @@ type SelectData struct { | |||||
Name string `json:"name" example:"名称"` | Name string `json:"name" example:"名称"` | ||||
Value string `json:"value" example:"值"` | Value string `json:"value" example:"值"` | ||||
} | } | ||||
type CommDetailReq struct { | |||||
Id string `json:"id" example:"列表id"` | |||||
} |
@@ -25,6 +25,7 @@ type AppletApplicationAdSpaceListReq struct { | |||||
Page string `json:"page" ` | Page string `json:"page" ` | ||||
Name string `json:"name"` | Name string `json:"name"` | ||||
CooperateState string `json:"cooperate_state" example:"合作状态"` | CooperateState string `json:"cooperate_state" example:"合作状态"` | ||||
AdType string `json:"ad_type" example:""` | |||||
Platform string `json:"platform"` | Platform string `json:"platform"` | ||||
} | } | ||||
type AppletApplicationAdSpaceListRes struct { | type AppletApplicationAdSpaceListRes struct { | ||||
@@ -1,5 +1,16 @@ | |||||
package md | package md | ||||
var Country = []map[string]string{ | |||||
{ | |||||
"value": "1", "name": "中国/国内", | |||||
}, | |||||
} | |||||
var CurrencyConf = []map[string]string{ | |||||
{ | |||||
"value": "0", "name": "人民币", | |||||
}, | |||||
} | |||||
type AgentQualificationEnterpriseReq struct { | type AgentQualificationEnterpriseReq struct { | ||||
Limit string `json:"limit"` | Limit string `json:"limit"` | ||||
Page string `json:"page" ` | Page string `json:"page" ` | ||||
@@ -0,0 +1,111 @@ | |||||
package md | |||||
type DataCenterGenerateDataReq struct { | |||||
Limit string `json:"limit"` | |||||
Page string `json:"page" ` | |||||
Name string `json:"name"` | |||||
State string `json:"state"` | |||||
Platform string `json:"platform"` | |||||
StartTime string `json:"start_time"` | |||||
EndTime string `json:"end_time"` | |||||
} | |||||
type DataCenterGenerateDataRes struct { | |||||
List []DataCenterGenerateDataData `json:"list" ` | |||||
Total int64 `json:"total"` | |||||
State []SelectData `json:"state"` | |||||
Platform []SelectData `json:"platform"` | |||||
} | |||||
type DataCenterGenerateDataData struct { | |||||
Id string `json:"id" example:"id"` | |||||
Date string `json:"date" example:"日期"` | |||||
Name string `json:"name" example:"名称"` | |||||
Platform string `json:"platform" example:"平台名称"` | |||||
AdvName string `json:"adv_name" example:"广告位"` | |||||
State string `json:"state" example:"状态id"` | |||||
OldExposureCount string `json:"old_exposure_count" example:"原-曝光量"` | |||||
OldClickCount string `json:"old_click_count" example:"原-点击量"` | |||||
OldClickRate string `json:"old_click_rate" example:"原-点击率"` | |||||
OldEcpm string `json:"old_ecpm" example:"'原-ecpm(元)"` | |||||
ExposureCount string `json:"exposure_count" example:"现-曝光量"` | |||||
ClickCount string `json:"click_count" example:"现-点击量"` | |||||
ClickRate string `json:"click_rate" example:"现-点击率"` | |||||
Ecpm string `json:"ecpm" example:"'现-ecpm(元)"` | |||||
PlatformRetention string `json:"platform_retention" example:"平台留存(元)"` | |||||
CommissionRetention string `json:"commission_retention" example:"佣金留存(元)"` | |||||
PriceAdjustmentRetention string `json:"price_adjustment_retention" example:"调价留存(元)"` | |||||
MediaRevenue string `json:"media_revenue" example:"媒体收益(元)"` | |||||
AgentRevenue string `json:"agent_revenue" example:"代理收益(元)"` | |||||
ExtraRevenue string `json:"extra_revenue" example:"额外收益(元)"` | |||||
AgreementSharing string `json:"agreement_sharing" example:"协议分成(元)"` | |||||
AgreementSharingTotal string `json:"agreement_sharing_total" example:"协议总分成(元)"` | |||||
IsGenerateReport string `json:"is_generate_report" example:"是否已生成报表(0:未 1:已)"` | |||||
} | |||||
type DataCenterIncomeDataRes struct { | |||||
List []DataCenterIncomeDataData `json:"list" ` | |||||
Total int64 `json:"total"` | |||||
State []SelectData `json:"state"` | |||||
Platform []SelectData `json:"platform"` | |||||
} | |||||
type DataCenterIncomeDataData struct { | |||||
Id string `json:"id" example:"id"` | |||||
Date string `json:"date" example:"日期"` | |||||
Name string `json:"name" example:"名称"` | |||||
Platform string `json:"platform" example:"平台名称"` | |||||
AdvName string `json:"adv_name" example:"广告位"` | |||||
State string `json:"state" example:"状态id"` | |||||
ExposureCount string `json:"exposure_count" example:"现-曝光量"` | |||||
ClickCount string `json:"click_count" example:"现-点击量"` | |||||
ClickRate string `json:"click_rate" example:"现-点击率"` | |||||
Ecpm string `json:"ecpm" example:"'现-ecpm(元)"` | |||||
MediaRevenue string `json:"media_revenue" example:"媒体收益(元)"` | |||||
AgreementSharing string `json:"agreement_sharing" example:"平台收益(元)"` | |||||
AgentRevenue string `json:"agent_revenue" example:"代理收益(元)"` | |||||
SettleAmount string `json:"settle_amount" example:"结算收益(元)"` | |||||
} | |||||
type DataCenterIncomeDataDetail struct { | |||||
Platform string `json:"platform" example:"填充来源"` | |||||
MediaRevenue string `json:"media_revenue" example:"媒体收益(元)"` | |||||
MediaRevenueRate string `json:"media_revenue_rate" example:"媒体收益百分比"` | |||||
AgreementSharingRate string `json:"agreement_sharing_rate" example:"平台收益百分比"` | |||||
AgreementSharing string `json:"agreement_sharing" example:"平台收益(元)"` | |||||
AgentRevenue string `json:"agent_revenue" example:"代理收益(元)"` | |||||
AgentRevenueRate string `json:"agent_revenue_rate" example:"代理收益百分比"` | |||||
DataSource string `json:"data_source" example:"数据来源"` | |||||
MediumName string `json:"medium_name" example:"媒体名称"` | |||||
CreateAt string `json:"create_at"` | |||||
UpdateAt string `json:"update_at"` | |||||
AgentReward []DataCenterGenerateDataDetailAgentRewardSecond `json:"agent_reward"` | |||||
} | |||||
type DataCenterGenerateDataCommReq struct { | |||||
Id string `json:"id" example:"列表id"` | |||||
} | |||||
type DataCenterGenerateDataDetailData struct { | |||||
PlatformRetentionRate string `json:"platform_retention_rate" example:"平台留存百分比"` | |||||
CommissionRetentionRate string `json:"commission_retention_rate" example:"佣金留存百分比"` | |||||
MediaRevenueRate string `json:"media_revenue_rate" example:"媒体收益百分比"` | |||||
AgentRevenueRate string `json:"agent_revenue_rate" example:"代理收益百分比"` | |||||
ExtraRevenueRate string `json:"extra_revenue_rate" example:"额外收益百分比"` | |||||
AgreementSharingRate string `json:"agreement_sharing_rate" example:"协议分成百分比"` | |||||
CreateAt string `json:"create_at" ` | |||||
UpdateAt string `json:"update_at" ` | |||||
AgentReward []DataCenterGenerateDataDetailAgentReward `json:"agent_reward"` | |||||
} | |||||
type DataCenterGenerateDataDetailAgentReward struct { | |||||
Name string `json:"name"` | |||||
Account string `json:"account"` | |||||
AgentRevenue string `json:"agent_revenue" example:"代理收益(元)"` | |||||
AgentRevenueRate string `json:"agent_revenue_rate" example:"代理收益百分比"` | |||||
ExtraRevenue string `json:"extra_revenue" example:"额外收益(元)"` | |||||
ExtraRevenueRate string `json:"extra_revenue_rate" example:"'额外收益百分比"` | |||||
} | |||||
type DataCenterGenerateDataDetailAgentRewardSecond struct { | |||||
Name string `json:"name"` | |||||
Account string `json:"account"` | |||||
AgentRevenue string `json:"agent_revenue" example:"代理收益(元)"` | |||||
AgentRevenueRate string `json:"agent_revenue_rate" example:"代理收益百分比"` | |||||
} |
@@ -0,0 +1,133 @@ | |||||
package md | |||||
var AdState = []SelectData{ | |||||
{Name: "审核通过", Value: "1"}, | |||||
{Name: "待审核", Value: "0"}, | |||||
{Name: "审核拒绝", Value: "2"}, | |||||
{Name: "封禁中", Value: "3"}, | |||||
} | |||||
var AdPlatform = []SelectData{ | |||||
{Name: "微信小程序", Value: "wx_applet"}, | |||||
} | |||||
type DataCenterOriginalDataReq struct { | |||||
Limit string `json:"limit"` | |||||
Page string `json:"page" ` | |||||
Name string `json:"name"` | |||||
State string `json:"state"` | |||||
Platform string `json:"platform"` | |||||
StartTime string `json:"start_time"` | |||||
EndTime string `json:"end_time"` | |||||
} | |||||
type DataCenterOriginalDataRes struct { | |||||
List []DataCenterOriginalDataData `json:"list" ` | |||||
Total int64 `json:"total"` | |||||
State []SelectData `json:"state"` | |||||
Platform []SelectData `json:"platform"` | |||||
} | |||||
type DataCenterOriginalDataData struct { | |||||
Id string `json:"id" example:"id"` | |||||
Date string `json:"date" example:"日期"` | |||||
Name string `json:"name" example:"名称"` | |||||
Platform string `json:"platform" example:"平台名称"` | |||||
AdvName string `json:"adv_name" example:"广告位"` | |||||
State string `json:"state" example:"状态id"` | |||||
ReqSuccCount string `json:"req_succ_count" example:"拉取量"` | |||||
ExposureCount string `json:"exposure_count" example:"曝光量"` | |||||
ExposureRate string `json:"exposure_rate" example:"曝光率"` | |||||
ClickCount string `json:"click_count" example:"点击量"` | |||||
ClickRate string `json:"click_rate" example:"点击率"` | |||||
PublisherIncome string `json:"publisher_income" example:"总收益(元)"` | |||||
Ecpm string `json:"ecpm" example:"'ecpm(元)"` | |||||
IsApply string `json:"is_apply" example:"是否已应用"` | |||||
} | |||||
type DataCenterOriginalDataCommReq struct { | |||||
Id string `json:"id" example:"列表id"` | |||||
} | |||||
type DataCenterDataCenterOriginalDataDoingReq struct { | |||||
Id string `json:"id" example:"列表id"` | |||||
NowExposureCount string `json:"now_exposure_count" example:"现-曝光量"` | |||||
NowEcpm string `json:"now_ecpm" example:"现-广告千次曝光收益(元)"` | |||||
} | |||||
type DataCenterOriginalDataMoreApplicationReq struct { | |||||
Limit string `json:"limit"` | |||||
Page string `json:"page" ` | |||||
Name string `json:"name"` | |||||
} | |||||
type DataCenterOriginalDataMoreApplicationRes struct { | |||||
List []DataCenterOriginalDataMoreApplicationData `json:"list" ` | |||||
Total int64 `json:"total"` | |||||
State []SelectData `json:"state"` | |||||
} | |||||
type DataCenterOriginalDataMoreApplicationData struct { | |||||
Id string `json:"id" example:"id"` | |||||
AppId string `json:"app_id" example:"小程序id"` | |||||
AdId string `json:"ad_id" example:"广告位id"` | |||||
Logo string `json:"logo"` | |||||
Name string `json:"name" example:"名称"` | |||||
AdvName string `json:"adv_name" example:"广告位"` | |||||
State string `json:"state" example:"状态id"` | |||||
} | |||||
type DataCenterOriginalDataOneApplicationRes struct { | |||||
List []DataCenterOriginalDataOneApplicationData `json:"list" ` | |||||
} | |||||
type DataCenterOriginalDataOneApplicationData struct { | |||||
Id string `json:"id" example:"id"` | |||||
AppId string `json:"app_id" example:"小程序id"` | |||||
Logo string `json:"logo"` | |||||
Name string `json:"name" example:"名称"` | |||||
} | |||||
type DataCenterOriginalDataOneApplicationAdListReq struct { | |||||
AppId string `json:"app_id"` | |||||
} | |||||
type DataCenterOriginalDataOneApplicationAdListRes struct { | |||||
List []DataCenterOriginalDataOneApplicationAdListData `json:"list" ` | |||||
State []SelectData `json:"state"` | |||||
} | |||||
type DataCenterOriginalDataOneApplicationAdListData struct { | |||||
Id string `json:"id" example:"id"` | |||||
Name string `json:"name" example:"名称"` | |||||
AdId string `json:"ad_id" example:"广告位id"` | |||||
State string `json:"state" example:"状态id"` | |||||
} | |||||
type DataCenterOriginalDataMoreApplicationDoingReq struct { | |||||
Ids []DataCenterOriginalDataOneApplicationDoingReqData `json:"ids"` | |||||
Date string `json:"date" example:"2024-08-28"` | |||||
} | |||||
type DataCenterOriginalDataOneApplicationDoingReqData struct { | |||||
AppId string `json:"app_id"` | |||||
AdId string `json:"ad_id"` | |||||
} | |||||
type DataCenterOriginalDataOneApplicationDoingReq struct { | |||||
AppId string `json:"app_id"` | |||||
AdId string `json:"ad_id"` | |||||
Date string `json:"date" example:"2024-08-28"` | |||||
} | |||||
type DataCenterOriginalDataOneApplicationDoingRes struct { | |||||
AdId string `json:"ad_id"` | |||||
AdSlot string `json:"ad_slot" example:"广告位类型名称"` | |||||
ExposureCount string `json:"exposure_count" example:"曝光量"` | |||||
ReqSuccCount string `json:"req_succ_count" example:"拉取量"` | |||||
PublisherIncome string `json:"publisher_income" example:"总收益(元)"` | |||||
ClickCount string `json:"click_count" example:"点击量"` | |||||
Ecpm string `json:"ecpm" example:"ecpm(元)"` | |||||
ExposureRate string `json:"exposure_rate" example:"曝光率"` | |||||
ClickRate string `json:"click_rate" example:"点击率"` | |||||
} | |||||
type MediumDivisionStrategy struct { | |||||
PlatformRetentionRate string `json:"platform_retention_rate" example:"平台留存百分比"` | |||||
CommissionRetentionRate string `json:"commission_retention_rate" example:"佣金留存百分比"` | |||||
MediaRevenueRate string `json:"media_revenue_rate" example:"媒体收益百分比"` | |||||
AgentRevenueRate string `json:"agent_revenue_rate" example:"代理收益百分比"` | |||||
ExtraRevenueRate string `json:"extra_revenue_rate" example:"额外收益百分比"` | |||||
AgreementSharingRate string `json:"agreement_sharing_rate" example:"协议分成百分比"` | |||||
ExposureCount string `json:"exposure_count" example:"曝光量"` | |||||
OldEcpm string `json:"old_ecpm" example:"原-ecpm(元)"` | |||||
Ecpm string `json:"ecpm" example:"现-ecpm(元)"` | |||||
} |
@@ -0,0 +1,47 @@ | |||||
package md | |||||
type DivisionStrategyReq struct { | |||||
Limit string `json:"limit"` | |||||
Page string `json:"page" ` | |||||
Name string `json:"name"` | |||||
} | |||||
type DivisionStrategyRes struct { | |||||
List []DivisionStrategyData `json:"list" ` | |||||
Total int64 `json:"total"` | |||||
} | |||||
type DivisionStrategyData struct { | |||||
Id string `json:"id" example:"id"` | |||||
MediumId string `json:"medium_id" example:"媒体id"` | |||||
Account string `json:"account" example:"账号"` | |||||
Name string `json:"name" example:"名称"` | |||||
PlatformRetentionRate string `json:"platform_retention_rate" example:"平台留存百分比"` | |||||
CommissionRetentionRate string `json:"commission_retention_rate" example:"佣金留存百分比"` | |||||
MediaRevenueRate string `json:"media_revenue_rate" example:"媒体收益百分比"` | |||||
AgentRevenueRate string `json:"agent_revenue_rate" example:"代理收益百分比"` | |||||
ExtraRevenueRate string `json:"extra_revenue_rate" example:"额外收益百分比"` | |||||
AgreementSharingRate string `json:"agreement_sharing_rate" example:"协议分成百分比"` | |||||
} | |||||
type DivisionStrategyDetailReq struct { | |||||
MediumId string `json:"medium_id"` | |||||
} | |||||
type DivisionStrategyDetailRes struct { | |||||
MediumId string `json:"medium_id" example:"媒体id"` | |||||
Account string `json:"account" example:"账号"` | |||||
Name string `json:"name" example:"名称"` | |||||
PlatformRetentionRate string `json:"platform_retention_rate" example:"平台留存百分比"` | |||||
CommissionRetentionRate string `json:"commission_retention_rate" example:"佣金留存百分比"` | |||||
MediaRevenueRate string `json:"media_revenue_rate" example:"媒体收益百分比"` | |||||
AgentRevenueRate string `json:"agent_revenue_rate" example:"代理收益百分比"` | |||||
ExtraRevenueRate string `json:"extra_revenue_rate" example:"额外收益百分比"` | |||||
AgreementSharingRate string `json:"agreement_sharing_rate" example:"协议分成百分比"` | |||||
AgentList []DivisionStrategyDetailByAgent `json:"agent_list"` | |||||
} | |||||
type DivisionStrategyDetailByAgent struct { | |||||
AgentId string `json:"agent_id" example:"代理id"` | |||||
Account string `json:"account" example:"账号"` | |||||
Name string `json:"name" example:"名称"` | |||||
AgentRevenueRate string `json:"agent_revenue_rate" example:"佣金比例"` | |||||
ExtraRevenueRate string `json:"extra_revenue_rate" example:"额外奖励"` | |||||
} |
@@ -0,0 +1,85 @@ | |||||
package md | |||||
type FinanceCenterDataReq struct { | |||||
Limit string `json:"limit"` | |||||
Page string `json:"page" ` | |||||
PayState string `json:"pay_state" example:"读 settle_pay_state返回的"` | |||||
StartTime string `json:"start_time" example:"2024-08-29"` | |||||
EndTime string `json:"end_time" ` | |||||
} | |||||
type FinanceCenterDataRes struct { | |||||
List []FinanceCenterDataData `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 FinanceCenterDataData 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:"调价留存"` | |||||
MediumIncome string `json:"medium_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"` | |||||
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:"媒体名称"` | |||||
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:"调价留存"` | |||||
MediumIncome string `json:"medium_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"` | |||||
Count string `json:"count"` | |||||
File []InvoiceFile `json:"file"` | |||||
} | |||||
type InvoiceFile struct { | |||||
Url string `json:"url"` | |||||
State string `json:"state" example:"0待确认 1审核通过 2审核失败"` | |||||
} | |||||
type SettleFileReq struct { | |||||
Id string `json:"id" example:"列表id"` | |||||
File string `json:"file" example:"七牛云链接 带http"` | |||||
} | |||||
type InvoiceReq struct { | |||||
Id string `json:"id" example:"列表id"` | |||||
State string `json:"state" example:"1审核通过 2审核失败"` | |||||
File []InvoiceFile `json:"file" ` | |||||
} | |||||
type OtherIncomeReq struct { | |||||
Id string `json:"id" example:"列表id"` | |||||
Amount string `json:"amount" example:"其他收益"` | |||||
} |
@@ -0,0 +1,17 @@ | |||||
package md | |||||
const AdOriginalData = "zhios.app.ad.original.data.exchange" | |||||
const ( | |||||
AdOriginalDataApplication = "ad_original_data_application" //应用数据同步 | |||||
) | |||||
type ZhiosAdOriginalDataApplication struct { | |||||
AppId string `json:"app_id"` | |||||
AdId string `json:"ad_id"` | |||||
Date string `json:"date"` | |||||
IsEnd string `json:"is_end"` //用来判断哪一个是最后一个 | |||||
Mid string `json:"mid"` | |||||
ComponentAppid string `json:"component_appid"` | |||||
ComponentAppsecret string `json:"component_appsecret"` | |||||
} |
@@ -0,0 +1,88 @@ | |||||
package md | |||||
var AccountSettleState = []SelectData{ | |||||
{Name: "日结", Value: "1"}, | |||||
{Name: "周结", Value: "2"}, | |||||
{Name: "月结", Value: "3"}, | |||||
{Name: "预付", Value: "4"}, | |||||
} | |||||
var BusinessKind = []SelectData{ | |||||
{Name: "广告合作", Value: "1"}, | |||||
} | |||||
var InvoiceCate = []SelectData{ | |||||
{Name: "电子发票", Value: "0"}, | |||||
{Name: "纸质发票", Value: "1"}, | |||||
} | |||||
var SettlePayState = []SelectData{ | |||||
{Name: "未开始", Value: "0"}, | |||||
{Name: "待审核发票", Value: "1"}, | |||||
{Name: "发票审核中", Value: "2"}, | |||||
{Name: "发票审核拒绝", Value: "3"}, | |||||
{Name: "付款中", Value: "4"}, | |||||
{Name: "已付款", Value: "5"}, | |||||
} | |||||
var SettleState = []SelectData{ | |||||
{Name: "未开始", Value: "0"}, | |||||
{Name: "核算中", Value: "1"}, | |||||
{Name: "待签订", Value: "2"}, | |||||
{Name: "完成签订", Value: "3"}, | |||||
} | |||||
var InvoiceState = []SelectData{ | |||||
{Name: "待审核", Value: "0"}, | |||||
{Name: "审核通过", Value: "1"}, | |||||
{Name: "审核拒绝", Value: "2"}, | |||||
} | |||||
type SettleCenterDataReq struct { | |||||
Limit string `json:"limit"` | |||||
Page string `json:"page" ` | |||||
Name string `json:"name"` | |||||
Account string `json:"account"` | |||||
State string `json:"state"` | |||||
} | |||||
type SettleCenterDataRes struct { | |||||
List []SettleCenterDataData `json:"list" ` | |||||
Total int64 `json:"total"` | |||||
State []SelectData `json:"state"` | |||||
} | |||||
type SettleCenterDataData struct { | |||||
Id string `json:"id"` | |||||
Name string `json:"name"` | |||||
Account string `json:"account"` | |||||
SettleType string `json:"settle_type"` | |||||
UpdateAt string `json:"update_at"` | |||||
} | |||||
type SettleCenterDataSaveReq struct { | |||||
Id string `json:"id"` | |||||
SettleType string `json:"settle_type"` | |||||
} | |||||
type SettleCenterDataDetailReq struct { | |||||
Limit string `json:"limit"` | |||||
Id string `json:"id"` | |||||
Page string `json:"page" ` | |||||
StartTime string `json:"start_time" example:"2024-08-29"` | |||||
EndTime string `json:"end_time" ` | |||||
} | |||||
type SettleCenterDataDetailRes struct { | |||||
List []SettleCenterDataDetailData `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 SettleCenterDataDetailData struct { | |||||
TimeStr string `json:"time_str"example:"业务时间"` | |||||
BusinessKind string `json:"business_kind" example:"业务类型(1:广告合作)"` | |||||
SettleType string `json:"settle_type" example:"结算单类型(1:日结 2:周结 3:月结 4:预付)"` | |||||
AllIncome string `json:"all_income" example:"总计"` | |||||
BasicIncome string `json:"basic_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:完成签订)"` | |||||
} |
@@ -64,10 +64,16 @@ func route(r *gin.RouterGroup) { | |||||
r.Use(mw.Auth) // 以下接口需要JWT验证 | r.Use(mw.Auth) // 以下接口需要JWT验证 | ||||
rRole(r.Group("/role")) //权限管理 | rRole(r.Group("/role")) //权限管理 | ||||
rQualification(r.Group("/qualification")) //资质认证公共数据 | |||||
rAgentQualification(r.Group("/agentQualification")) //渠道-资质 | rAgentQualification(r.Group("/agentQualification")) //渠道-资质 | ||||
rMediumQualification(r.Group("/mediumQualification")) //媒体-资质 | rMediumQualification(r.Group("/mediumQualification")) //媒体-资质 | ||||
rSetCenter(r.Group("/setCenter")) //设置中心 | rSetCenter(r.Group("/setCenter")) //设置中心 | ||||
rMedium(r.Group("/mediumCenter")) //媒体中心 | rMedium(r.Group("/mediumCenter")) //媒体中心 | ||||
rDivisionStrategy(r.Group("/divisionStrategy")) //分成策略 | |||||
rDataCenter(r.Group("/dataCenter")) //数据中心 | |||||
rSettleCenter(r.Group("/settleCenter")) //结算中心 | |||||
rFinanceCenter(r.Group("/financeCenter")) //财务中心 | |||||
} | } | ||||
func rRole(r *gin.RouterGroup) { | func rRole(r *gin.RouterGroup) { | ||||
@@ -86,6 +92,9 @@ func rRole(r *gin.RouterGroup) { | |||||
r.GET("/adminInfo", hdl.AdminInfo) //获取管理员信息 | r.GET("/adminInfo", hdl.AdminInfo) //获取管理员信息 | ||||
r.POST("/bindAdminRole", hdl.BindAdminRole) //绑定角色 | r.POST("/bindAdminRole", hdl.BindAdminRole) //绑定角色 | ||||
} | } | ||||
func rQualification(r *gin.RouterGroup) { | |||||
r.GET("/select/base", hdl.QualificationSelectBase) //资质认证-认证选择内容 | |||||
} | |||||
func rAgentQualification(r *gin.RouterGroup) { | func rAgentQualification(r *gin.RouterGroup) { | ||||
r.POST("/enterprise", hdl.AgentQualificationEnterprise) //企业主体资质 | r.POST("/enterprise", hdl.AgentQualificationEnterprise) //企业主体资质 | ||||
r.POST("/enterprise/audit", hdl.AgentQualificationEnterpriseAudit) //企业主体资质审核 | r.POST("/enterprise/audit", hdl.AgentQualificationEnterpriseAudit) //企业主体资质审核 | ||||
@@ -144,3 +153,46 @@ func rMedium(r *gin.RouterGroup) { | |||||
r.POST("/agent/list", hdl.AgentList) //代理列表 | r.POST("/agent/list", hdl.AgentList) //代理列表 | ||||
r.POST("/agent/bind/medium/list", hdl.AgentBindMediumList) //代理绑定媒体列表 | r.POST("/agent/bind/medium/list", hdl.AgentBindMediumList) //代理绑定媒体列表 | ||||
} | } | ||||
func rDivisionStrategy(r *gin.RouterGroup) { | |||||
r.POST("/list", hdl.DivisionStrategyList) //分成策略-列表 | |||||
r.POST("/detail", hdl.DivisionStrategyDetail) //分成策略-详情 | |||||
r.POST("/save", hdl.DivisionStrategySave) //分成策略-保存 | |||||
} | |||||
func rDataCenter(r *gin.RouterGroup) { | |||||
r.POST("/original/data/list", hdl.OriginalDataList) //数据中心-原始数据 | |||||
r.POST("/original/data/del", hdl.OriginalDataDel) //数据中心-原始数据-删除 | |||||
r.POST("/original/data/total", hdl.OriginalDataTotal) //数据中心-原始数据-记录应用时统计 | |||||
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/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) //数据中心-收益报表-详情 | |||||
} | |||||
func rSettleCenter(r *gin.RouterGroup) { | |||||
r.POST("/medium/list", hdl.SettleCenterMediumList) //结算中心-媒体列表 | |||||
r.POST("/medium/save", hdl.SettleCenterMediumSave) //结算中心-媒体修复结算方式 | |||||
r.POST("/medium/detail", hdl.SettleCenterMediumDetail) //结算中心-媒体结算详情 | |||||
r.POST("/agent/list", hdl.SettleCenterAgentList) //结算中心-代理列表 | |||||
r.POST("/agent/save", hdl.SettleCenterAgentSave) //结算中心-代理修复结算方式 | |||||
r.POST("/agent/detail", hdl.SettleCenterAgentDetail) //结算中心-代理结算详情 | |||||
} | |||||
func rFinanceCenter(r *gin.RouterGroup) { | |||||
r.POST("/medium/list", hdl.FinanceCenterMediumList) //财务中心-媒体列表 | |||||
r.POST("/medium/detail", hdl.FinanceCenterMediumDetail) //财务中心-媒体详情 | |||||
r.POST("/medium/settle/file/save", hdl.FinanceCenterMediumSettleFileSave) //财务中心-媒体详情-结算单上传 | |||||
r.POST("/medium/invoice/save", hdl.FinanceCenterMediumInvoiceSave) //财务中心-媒体详情-发票审核 | |||||
r.POST("/medium/other/income/save", hdl.FinanceCenterMediumOtherIncomeSave) //财务中心-媒体详情-其他收益调整 | |||||
r.POST("/medium/pay/save", hdl.FinanceCenterMediumPaySave) //财务中心-媒体详情-确认支付 | |||||
} |
@@ -12,6 +12,26 @@ import ( | |||||
"github.com/jinzhu/copier" | "github.com/jinzhu/copier" | ||||
) | ) | ||||
func QualificationSelectBase(c *gin.Context) { | |||||
countryDb := implement.NewCountryDb(db.Db) | |||||
country := countryDb.FindAll() | |||||
IdcardTypeListDb := implement.NewIdcardTypeListDb(db.Db) | |||||
IdcardTypeList := IdcardTypeListDb.FindAll() | |||||
res := map[string]interface{}{ | |||||
"register_area": country, | |||||
"idcard_type": IdcardTypeList, | |||||
"country": md.Country, | |||||
"user_type": []map[string]interface{}{ | |||||
{ | |||||
"value": "1", "name": "企业", | |||||
}, | |||||
}, | |||||
"currency_conf": md.CurrencyConf, | |||||
} | |||||
e.OutSuc(c, res, nil) | |||||
return | |||||
} | |||||
func AgentQualificationEnterprise(c *gin.Context, minState int, req md.AgentQualificationEnterpriseReq) md.AgentQualificationEnterpriseRes { | func AgentQualificationEnterprise(c *gin.Context, minState int, req md.AgentQualificationEnterpriseReq) md.AgentQualificationEnterpriseRes { | ||||
engine := db.Db | engine := db.Db | ||||
@@ -70,9 +70,7 @@ func AppletApplicationAdSpaceList(c *gin.Context) { | |||||
} | } | ||||
engine := MasterDb(c) | engine := MasterDb(c) | ||||
NewAppletApplicationDb := implement.NewAppletApplicationAdSpaceListDb(engine) | NewAppletApplicationDb := implement.NewAppletApplicationAdSpaceListDb(engine) | ||||
//TODO::临时处理 | |||||
//appletApplicationList, total, _ := NewAppletApplicationDb.FindAppletApplicationAdSpaceList(req.Name, req.Platform, req.CooperateState, utils.StrToInt(req.MediumId), utils.StrToInt(req.Page), utils.StrToInt(req.Limit)) | |||||
appletApplicationList, total, _ := NewAppletApplicationDb.FindAppletApplicationAdSpaceList(req.Name, req.Platform, "", req.CooperateState, utils.StrToInt(req.MediumId), utils.StrToInt(req.Page), utils.StrToInt(req.Limit)) | |||||
appletApplicationList, total, _ := NewAppletApplicationDb.FindAppletApplicationAdSpaceList(req.Name, req.Platform, req.AdType, req.CooperateState, utils.StrToInt(req.MediumId), utils.StrToInt(req.Page), utils.StrToInt(req.Limit)) | |||||
data := make([]md.AppletApplicationAdSpaceListData, 0) | data := make([]md.AppletApplicationAdSpaceListData, 0) | ||||
if len(appletApplicationList) > 0 { | if len(appletApplicationList) > 0 { | ||||
for _, v := range appletApplicationList { | for _, v := range appletApplicationList { | ||||
@@ -0,0 +1,263 @@ | |||||
package svc | |||||
import ( | |||||
"applet/app/e" | |||||
"applet/app/md" | |||||
"applet/app/utils" | |||||
"applet/app/utils/cache" | |||||
db "code.fnuoos.com/zhimeng/model.git/src" | |||||
implement2 "code.fnuoos.com/zhimeng/model.git/src/implement" | |||||
"code.fnuoos.com/zhimeng/model.git/src/super/implement" | |||||
"code.fnuoos.com/zhimeng/model.git/src/super/model" | |||||
"errors" | |||||
"fmt" | |||||
"github.com/gin-gonic/gin" | |||||
) | |||||
func DataCenterIncomeDataList(c *gin.Context, req md.DataCenterGenerateDataReq) md.DataCenterIncomeDataRes { | |||||
engine := db.Db | |||||
NewGenerateWxAdDataDb := implement.NewGenerateWxAdDataDb(engine) | |||||
appId := GetAppletId(c, req.Name, req.Platform) | |||||
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)) | |||||
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 DataCenterIncomeDataDetail(c *gin.Context, req md.DataCenterGenerateDataCommReq) { | |||||
NewGenerateWxAdDataDb := implement.NewGenerateWxAdDataDb(db.Db) | |||||
data, _ := NewGenerateWxAdDataDb.GetGenerateWxAdData(utils.StrToInt(req.Id)) | |||||
if data == nil { | |||||
e.OutErr(c, 400, e.NewErr(400, "记录不存在")) | |||||
return | |||||
} | |||||
agentReward := make([]md.DataCenterGenerateDataDetailAgentRewardSecond, 0) | |||||
NewGenerateWxAdDataWithAgentFlowDb := implement.NewGenerateWxAdDataWithAgentFlowDb(db.Db) | |||||
agent, _ := NewGenerateWxAdDataWithAgentFlowDb.FindGenerateWxAdDataWithAgentFlowByStrategyId(data.Id) | |||||
if agent != nil { | |||||
for _, v := range *agent { | |||||
tmp := md.DataCenterGenerateDataDetailAgentRewardSecond{ | |||||
Name: "", | |||||
Account: "", | |||||
AgentRevenue: utils.Float64ToStr(float64(v.AgentRevenue) / 100), | |||||
AgentRevenueRate: utils.IntToStr(data.AgentRevenueRate), | |||||
} | |||||
tmpApplet := GetAgentInfo(c, v.AgentId) | |||||
if tmpApplet["name"] != "" { | |||||
tmp.Name = tmpApplet["name"] | |||||
} | |||||
if tmpApplet["account"] != "" { | |||||
tmp.Account = tmpApplet["account"] | |||||
} | |||||
agentReward = append(agentReward, tmp) | |||||
} | |||||
} | |||||
res := md.DataCenterIncomeDataDetail{ | |||||
MediaRevenue: utils.Float64ToStr(float64(data.MediaRevenue) / 100), | |||||
AgreementSharing: utils.Float64ToStr(float64(data.AgreementSharing) / 100), | |||||
AgentRevenue: utils.Float64ToStr(float64(data.AgentRevenue) / 100), | |||||
DataSource: "手动同步", | |||||
CreateAt: data.CreateAt, | |||||
UpdateAt: data.UpdateAt, | |||||
MediaRevenueRate: utils.IntToStr(data.MediaRevenueRate), | |||||
AgentRevenueRate: utils.IntToStr(data.AgentRevenueRate), | |||||
AgreementSharingRate: utils.IntToStr(data.AgreementSharingRate), | |||||
AgentReward: agentReward, | |||||
} | |||||
tmpApplet := GetAppletInfo(c, data.AppId) | |||||
if tmpApplet["platform"] != "" { | |||||
res.Platform = tmpApplet["platform"] | |||||
} | |||||
NewAppletApplicationDb := implement2.NewAppletApplicationDb(MasterDb(c)) | |||||
app, _ := NewAppletApplicationDb.GetAppletApplicationListByAppid(data.AppId) | |||||
tmp := GetMediumInfo(c, app.MediumId) | |||||
if tmp["name"] != "" { | |||||
res.MediumName = tmp["name"] | |||||
if tmp["account"] != "" { | |||||
res.MediumName += "(" + tmp["account"] + ")" | |||||
} | |||||
} | |||||
e.OutSuc(c, res, nil) | |||||
return | |||||
} | |||||
func DataCenterGenerateDataList(c *gin.Context, req md.DataCenterGenerateDataReq) md.DataCenterGenerateDataRes { | |||||
engine := db.Db | |||||
NewGenerateWxAdDataDb := implement.NewGenerateWxAdDataDb(engine) | |||||
appId := GetAppletId(c, req.Name, req.Platform) | |||||
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)) | |||||
data := make([]md.DataCenterGenerateDataData, 0) | |||||
if len(MediumList) > 0 { | |||||
NewOriginalWxAdDataDb := implement.NewOriginalWxAdDataDb(engine) | |||||
for _, v := range MediumList { | |||||
wxData, _ := NewOriginalWxAdDataDb.GetOriginalWxAdData(v.Id) | |||||
var tmp = md.DataCenterGenerateDataData{ | |||||
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), | |||||
IsGenerateReport: utils.IntToStr(v.IsGenerateReport), | |||||
Date: v.Date, | |||||
PlatformRetention: utils.Float64ToStr(float64(v.PlatformRetention) / 100), | |||||
CommissionRetention: utils.Float64ToStr(float64(v.CommissionRetention) / 100), | |||||
PriceAdjustmentRetention: utils.Float64ToStr(float64(v.PriceAdjustmentRetention) / 100), | |||||
MediaRevenue: utils.Float64ToStr(float64(v.MediaRevenue) / 100), | |||||
AgentRevenue: utils.Float64ToStr(float64(v.AgentRevenue) / 100), | |||||
ExtraRevenue: utils.Float64ToStr(float64(v.ExtraRevenue) / 100), | |||||
AgreementSharing: utils.Float64ToStr(float64(v.AgreementSharing) / 100), | |||||
AgreementSharingTotal: utils.Float64ToStr(float64(v.AgreementSharingTotal) / 100), | |||||
} | |||||
if wxData != nil { | |||||
tmp.OldClickRate = wxData.ClickRate | |||||
tmp.OldClickCount = utils.IntToStr(wxData.ClickCount) | |||||
tmp.OldEcpm = utils.Float64ToStr(utils.StrToFloat64(wxData.Ecpm) / 100) | |||||
tmp.OldExposureCount = utils.IntToStr(wxData.ExposureCount) | |||||
} | |||||
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.DataCenterGenerateDataRes{ | |||||
List: data, | |||||
Total: total, | |||||
State: md.AdState, | |||||
Platform: md.AdPlatform, | |||||
} | |||||
return res | |||||
} | |||||
func DataCenterGenerateDataDel(c *gin.Context, req md.DataCenterGenerateDataCommReq) error { | |||||
NewGenerateWxAdDataDb := implement.NewGenerateWxAdDataDb(db.Db) | |||||
data, _ := NewGenerateWxAdDataDb.GetGenerateWxAdData(utils.StrToInt(req.Id)) | |||||
if data == nil { | |||||
return errors.New("记录不存在") | |||||
} | |||||
if data.IsGenerateReport == 1 { | |||||
return errors.New("记录已应用,不能删除") | |||||
} | |||||
_, err := db.Db.Where("id=?", req.Id).Delete(&model.GenerateWxAdData{}) | |||||
if err != nil { | |||||
return err | |||||
} | |||||
return nil | |||||
} | |||||
func DataCenterGenerateDataDetail(c *gin.Context, req md.DataCenterGenerateDataCommReq) { | |||||
NewGenerateWxAdDataDb := implement.NewGenerateWxAdDataDb(db.Db) | |||||
data, _ := NewGenerateWxAdDataDb.GetGenerateWxAdData(utils.StrToInt(req.Id)) | |||||
if data == nil { | |||||
e.OutErr(c, 400, e.NewErr(400, "记录不存在")) | |||||
return | |||||
} | |||||
agentReward := make([]md.DataCenterGenerateDataDetailAgentReward, 0) | |||||
NewGenerateWxAdDataWithAgentFlowDb := implement.NewGenerateWxAdDataWithAgentFlowDb(db.Db) | |||||
agent, _ := NewGenerateWxAdDataWithAgentFlowDb.FindGenerateWxAdDataWithAgentFlowByStrategyId(data.Id) | |||||
if agent != nil { | |||||
for _, v := range *agent { | |||||
tmp := md.DataCenterGenerateDataDetailAgentReward{ | |||||
Name: "", | |||||
Account: "", | |||||
AgentRevenue: utils.Float64ToStr(float64(v.AgentRevenue) / 100), | |||||
AgentRevenueRate: utils.IntToStr(data.AgentRevenueRate), | |||||
ExtraRevenue: utils.Float64ToStr(float64(v.ExtraRevenue) / 100), | |||||
ExtraRevenueRate: utils.IntToStr(data.ExtraRevenueRate), | |||||
} | |||||
tmpApplet := GetAgentInfo(c, v.AgentId) | |||||
if tmpApplet["name"] != "" { | |||||
tmp.Name = tmpApplet["name"] | |||||
} | |||||
if tmpApplet["account"] != "" { | |||||
tmp.Account = tmpApplet["account"] | |||||
} | |||||
agentReward = append(agentReward, tmp) | |||||
} | |||||
} | |||||
res := md.DataCenterGenerateDataDetailData{ | |||||
PlatformRetentionRate: utils.IntToStr(data.PlatformRetentionRate), | |||||
CommissionRetentionRate: utils.IntToStr(data.CommissionRetentionRate), | |||||
MediaRevenueRate: utils.IntToStr(data.MediaRevenueRate), | |||||
AgentRevenueRate: utils.IntToStr(data.AgentRevenueRate), | |||||
ExtraRevenueRate: utils.IntToStr(data.ExtraRevenueRate), | |||||
AgreementSharingRate: utils.IntToStr(data.AgreementSharingRate), | |||||
AgentReward: agentReward, | |||||
} | |||||
e.OutSuc(c, res, nil) | |||||
return | |||||
} | |||||
func DataCenterGenerateDataDoing(c *gin.Context, req md.DataCenterGenerateDataCommReq) error { | |||||
NewGenerateWxAdDataDb := implement.NewGenerateWxAdDataDb(db.Db) | |||||
data, _ := NewGenerateWxAdDataDb.GetGenerateWxAdData(utils.StrToInt(req.Id)) | |||||
if data == nil { | |||||
return e.NewErr(400, "记录不存在") | |||||
} | |||||
if data.IsGenerateReport == 1 { | |||||
return e.NewErr(400, "该记录已完成操作") | |||||
} | |||||
// 加锁 防止并发提取 | |||||
mutexKey := fmt.Sprintf("%s:DataCenterGenerateDataDoing:%s", c.GetString("mid"), req.Id) | |||||
withdrawAvailable, err := cache.Do("SET", mutexKey, 1, "EX", 5, "NX") | |||||
if err != nil { | |||||
return err | |||||
} | |||||
if withdrawAvailable != "OK" { | |||||
return e.NewErr(400000, "请求过于频繁,请稍后再试") | |||||
} | |||||
args := md.SettlementWxAdData{ | |||||
GenerateDataId: utils.StrToInt(req.Id), | |||||
} | |||||
err = SettlementWxAdData(args) | |||||
if err != nil { | |||||
return err | |||||
} | |||||
return nil | |||||
} |
@@ -0,0 +1,403 @@ | |||||
package svc | |||||
import ( | |||||
"applet/app/e" | |||||
"applet/app/lib/wechat" | |||||
"applet/app/md" | |||||
"applet/app/utils" | |||||
"applet/app/utils/cache" | |||||
"code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit" | |||||
db "code.fnuoos.com/zhimeng/model.git/src" | |||||
implement2 "code.fnuoos.com/zhimeng/model.git/src/implement" | |||||
model2 "code.fnuoos.com/zhimeng/model.git/src/model" | |||||
"code.fnuoos.com/zhimeng/model.git/src/super/implement" | |||||
"code.fnuoos.com/zhimeng/model.git/src/super/model" | |||||
"errors" | |||||
"fmt" | |||||
"github.com/gin-gonic/gin" | |||||
"strings" | |||||
) | |||||
func DataCenterOriginalDataList(c *gin.Context, req md.DataCenterOriginalDataReq) md.DataCenterOriginalDataRes { | |||||
engine := db.Db | |||||
NewOriginalWxAdDataDb := implement.NewOriginalWxAdDataDb(engine) | |||||
appId := GetAppletId(c, req.Name, req.Platform) | |||||
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)) | |||||
data := make([]md.DataCenterOriginalDataData, 0) | |||||
if len(MediumList) > 0 { | |||||
for _, v := range MediumList { | |||||
var tmp = md.DataCenterOriginalDataData{ | |||||
Id: utils.IntToStr(v.Id), | |||||
ReqSuccCount: utils.IntToStr(v.ReqSuccCount), | |||||
ExposureCount: utils.IntToStr(v.ExposureCount), | |||||
ExposureRate: v.ExposureRate, | |||||
ClickCount: utils.IntToStr(v.ClickCount), | |||||
ClickRate: v.ClickRate, | |||||
Date: v.Date, | |||||
PublisherIncome: utils.Float64ToStr(float64(v.PublisherIncome) / 100), | |||||
Ecpm: utils.Float64ToStr(utils.StrToFloat64(v.Ecpm) / 100), | |||||
IsApply: utils.IntToStr(v.IsApply), | |||||
} | |||||
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.DataCenterOriginalDataRes{ | |||||
List: data, | |||||
Total: total, | |||||
State: md.AdState, | |||||
Platform: md.AdPlatform, | |||||
} | |||||
return res | |||||
} | |||||
func DataCenterOriginalDataDel(c *gin.Context, req md.DataCenterOriginalDataCommReq) error { | |||||
NewOriginalWxAdDataDb := implement.NewOriginalWxAdDataDb(db.Db) | |||||
data, _ := NewOriginalWxAdDataDb.GetOriginalWxAdData(utils.StrToInt(req.Id)) | |||||
if data == nil { | |||||
return errors.New("记录不存在") | |||||
} | |||||
if data.IsApply == 1 { | |||||
return errors.New("记录已应用,不能删除") | |||||
} | |||||
_, err := db.Db.Where("id=?", req.Id).Delete(&model.OriginalWxAdData{}) | |||||
if err != nil { | |||||
return err | |||||
} | |||||
return nil | |||||
} | |||||
func OriginalDataMoreApplication(c *gin.Context, req md.DataCenterOriginalDataMoreApplicationReq) md.DataCenterOriginalDataMoreApplicationRes { | |||||
engine := MasterDb(c) | |||||
NewAppletApplicationAdSpaceListDb := implement2.NewAppletApplicationAdSpaceListDb(engine) | |||||
MediumList, total, _ := NewAppletApplicationAdSpaceListDb.FindAppletApplicationAdSpaceList(req.Name, "", "", "", 0, utils.StrToInt(req.Page), utils.StrToInt(req.Limit)) | |||||
data := make([]md.DataCenterOriginalDataMoreApplicationData, 0) | |||||
if len(MediumList) > 0 { | |||||
for _, v := range MediumList { | |||||
var tmp = md.DataCenterOriginalDataMoreApplicationData{ | |||||
Id: utils.IntToStr(v.AppletApplicationAdSpaceList.Id), | |||||
AppId: v.AppletApplicationAdSpaceList.AppId, | |||||
AdId: v.AppletApplicationAdSpaceList.AdId, | |||||
Logo: v.AppletApplication.Logo, | |||||
Name: v.AppletApplication.Name, | |||||
State: utils.IntToStr(v.AppletApplicationAdSpaceList.State), | |||||
AdvName: v.AppletApplicationAdSpaceList.Name, | |||||
} | |||||
data = append(data, tmp) | |||||
} | |||||
} | |||||
res := md.DataCenterOriginalDataMoreApplicationRes{ | |||||
List: data, | |||||
Total: total, | |||||
State: md.AdState, | |||||
} | |||||
return res | |||||
} | |||||
func OriginalDataOneApplication(c *gin.Context) { | |||||
list := make([]md.DataCenterOriginalDataOneApplicationData, 0) | |||||
NewAppletApplicationDb := implement2.NewAppletApplicationDb(MasterDb(c)) | |||||
applicationList, _ := NewAppletApplicationDb.FindAllAppletApplicationList() | |||||
for _, v := range applicationList { | |||||
tmp := md.DataCenterOriginalDataOneApplicationData{ | |||||
Id: utils.IntToStr(v.Id), | |||||
AppId: v.AppId, | |||||
Logo: v.Logo, | |||||
Name: v.Name, | |||||
} | |||||
list = append(list, tmp) | |||||
} | |||||
var res = md.DataCenterOriginalDataOneApplicationRes{ | |||||
List: list, | |||||
} | |||||
e.OutSuc(c, res, nil) | |||||
return | |||||
} | |||||
func OriginalDataOneApplicationAdList(c *gin.Context, req md.DataCenterOriginalDataOneApplicationAdListReq) md.DataCenterOriginalDataOneApplicationAdListRes { | |||||
list := make([]md.DataCenterOriginalDataOneApplicationAdListData, 0) | |||||
NewAppletApplicationDb := implement2.NewAppletApplicationAdSpaceListDb(MasterDb(c)) | |||||
applicationList, _ := NewAppletApplicationDb.FindAllAppletApplicationAdSpaceListList(req.AppId) | |||||
for _, v := range applicationList { | |||||
tmp := md.DataCenterOriginalDataOneApplicationAdListData{ | |||||
Id: utils.IntToStr(v.Id), | |||||
AdId: v.AdId, | |||||
Name: v.Name, | |||||
State: utils.IntToStr(v.State), | |||||
} | |||||
list = append(list, tmp) | |||||
} | |||||
var res = md.DataCenterOriginalDataOneApplicationAdListRes{ | |||||
List: list, | |||||
State: md.AdState, | |||||
} | |||||
return res | |||||
} | |||||
func DataCenterOriginalDataTotal(c *gin.Context, req md.DataCenterOriginalDataCommReq) { | |||||
NewOriginalWxAdDataDb := implement.NewOriginalWxAdDataDb(db.Db) | |||||
data, _ := NewOriginalWxAdDataDb.GetOriginalWxAdData(utils.StrToInt(req.Id)) | |||||
if data == nil { | |||||
e.OutErr(c, 400, e.NewErr(400, "记录不存在")) | |||||
return | |||||
} | |||||
//应用 | |||||
NewAppletApplicationDb := implement2.NewAppletApplicationDb(MasterDb(c)) | |||||
appid, _ := NewAppletApplicationDb.GetAppletApplicationListByAppid(data.AppId) | |||||
if appid == nil { | |||||
e.OutErr(c, 400, e.NewErr(400, "应用不存在")) | |||||
return | |||||
} | |||||
//分成策略 | |||||
NewMediumDivisionStrategyDb := implement.NewMediumDivisionStrategyDb(MasterDb(c)) | |||||
strategy, _ := NewMediumDivisionStrategyDb.GetOriginalWxAdDataByMediumId(appid.MediumId) | |||||
if strategy == nil { | |||||
e.OutErr(c, 400, e.NewErr(400, "分成策略不存在")) | |||||
return | |||||
} | |||||
ecpmReq := md.ClacEcpmReq{ | |||||
OriginalExposureCount: data.ExposureCount, | |||||
OriginalEcpm: data.Ecpm, | |||||
GenerateDataId: data.Id, | |||||
} | |||||
_, ecpm := ClacEcpm(ecpmReq) | |||||
res := md.MediumDivisionStrategy{ | |||||
PlatformRetentionRate: utils.IntToStr(strategy.PlatformRetentionRate), | |||||
CommissionRetentionRate: utils.IntToStr(strategy.CommissionRetentionRate), | |||||
MediaRevenueRate: utils.IntToStr(strategy.MediaRevenueRate), | |||||
AgentRevenueRate: utils.IntToStr(strategy.AgentRevenueRate), | |||||
ExtraRevenueRate: utils.IntToStr(strategy.ExtraRevenueRate), | |||||
AgreementSharingRate: utils.IntToStr(strategy.AgreementSharingRate), | |||||
ExposureCount: utils.IntToStr(data.ExposureCount), | |||||
Ecpm: utils.Float64ToStr(utils.StrToFloat64(ecpm) / 100), | |||||
OldEcpm: utils.Float64ToStr(utils.StrToFloat64(data.Ecpm) / 100), | |||||
} | |||||
e.OutSuc(c, res, nil) | |||||
return | |||||
} | |||||
func DataCenterOriginalDataDoing(c *gin.Context, req md.DataCenterDataCenterOriginalDataDoingReq) error { | |||||
NewOriginalWxAdDataDb := implement.NewOriginalWxAdDataDb(db.Db) | |||||
data, _ := NewOriginalWxAdDataDb.GetOriginalWxAdData(utils.StrToInt(req.Id)) | |||||
if data == nil { | |||||
return e.NewErr(400, "记录不存在") | |||||
} | |||||
if data.IsApply == 1 { | |||||
return e.NewErr(400, "该记录已完成操作") | |||||
} | |||||
// 加锁 防止并发提取 | |||||
mutexKey := fmt.Sprintf("%s:DataCenterOriginalDataDoing:%s", c.GetString("mid"), req.Id) | |||||
withdrawAvailable, err := cache.Do("SET", mutexKey, 1, "EX", 5, "NX") | |||||
if err != nil { | |||||
return err | |||||
} | |||||
if withdrawAvailable != "OK" { | |||||
return e.NewErr(400000, "请求过于频繁,请稍后再试") | |||||
} | |||||
args := md.GenerateWxAdData{ | |||||
OriginalDataId: utils.StrToInt(req.Id), | |||||
OriginalExposureCount: data.ExposureCount, | |||||
OriginalEcpm: data.Ecpm, | |||||
NowExposureCount: utils.StrToInt(req.NowExposureCount), | |||||
NowEcpm: utils.Float64ToStr(utils.StrToFloat64(req.NowEcpm) * 100), | |||||
} | |||||
err, _ = GenerateWxAdData(args) | |||||
if err != nil { | |||||
return err | |||||
} | |||||
return nil | |||||
} | |||||
func OriginalDataMoreApplicationDoing(c *gin.Context, req md.DataCenterOriginalDataMoreApplicationDoingReq) error { | |||||
state, _ := cache.GetString(c.GetString("mid") + ":original.wx.ad.data") | |||||
if state == "1" { | |||||
return e.NewErr(400000, "数据采集中~") | |||||
} | |||||
// 加锁 防止并发提取 | |||||
mutexKey := fmt.Sprintf("%s:DataCenterOriginalDataDoingOriginalDataMoreApplicationDoing", c.GetString("mid")) | |||||
withdrawAvailable, err := cache.Do("SET", mutexKey, 1, "EX", 5, "NX") | |||||
if err != nil { | |||||
return err | |||||
} | |||||
if withdrawAvailable != "OK" { | |||||
return e.NewErr(400000, "请求过于频繁,请稍后再试") | |||||
} | |||||
ch, err := rabbit.Cfg.Pool.GetChannel() | |||||
if err != nil { | |||||
return err | |||||
} | |||||
defer ch.Release() | |||||
ids := make([]md.DataCenterOriginalDataOneApplicationDoingReqData, 0) | |||||
for _, v := range req.Ids { | |||||
count, _ := db.Db.Where("uuid=? and date=? and app_id=? and slot_id=?", c.GetString("mid"), req.Date, v.AppId, v.AdId).Count(&model.OriginalWxAdData{}) | |||||
if count > 0 { | |||||
continue | |||||
} | |||||
ids = append(ids, v) | |||||
} | |||||
masterId := GetMasterId(c) | |||||
userWxAppletListDb := implement.NewUserWxAppletListDb(db.Db) | |||||
UserWxAppletList, err := userWxAppletListDb.GetUserWxAppletList(masterId) | |||||
if err != nil { | |||||
return e.NewErr(400000, err.Error()) | |||||
} | |||||
if UserWxAppletList == nil { | |||||
return e.NewErr(400000, "未查询到对应记录") | |||||
} | |||||
wxOpenThirdPartyAppListDb := implement.NewWxOpenThirdPartyAppListDb(db.Db) | |||||
wxOpenThirdPartyAppList, err := wxOpenThirdPartyAppListDb.GetWxOpenThirdPartyAppList(utils.StrToInt(masterId)) | |||||
if err != nil { | |||||
return e.NewErr(400000, err.Error()) | |||||
} | |||||
if wxOpenThirdPartyAppList == nil { | |||||
return e.NewErr(400000, "未查询到对应三方应用记录") | |||||
} | |||||
for k, v := range ids { | |||||
var arg = md.ZhiosAdOriginalDataApplication{ | |||||
Mid: c.GetString("mid"), | |||||
AppId: v.AppId, | |||||
AdId: v.AdId, | |||||
Date: req.Date, | |||||
ComponentAppid: wxOpenThirdPartyAppList.Appid, | |||||
ComponentAppsecret: wxOpenThirdPartyAppList.AppSecret, | |||||
} | |||||
if k+1 == len(req.Ids) { | |||||
arg.IsEnd = "1" | |||||
} | |||||
err := ch.PublishV2(md.AdOriginalData, utils.SerializeStr(arg), md.AdOriginalDataApplication) | |||||
if err != nil { | |||||
ch.PublishV2(md.AdOriginalData, utils.SerializeStr(arg), md.AdOriginalDataApplication) | |||||
} | |||||
} | |||||
if len(ids) == 0 { | |||||
return e.NewErr(400000, "选择的广告位已存在,请删除后再生成") | |||||
} | |||||
cache.SetEx(c.GetString("mid")+":original.wx.ad.data", "1", 3600) | |||||
return nil | |||||
} | |||||
func OriginalDataOneApplicationTotal(c *gin.Context, req md.DataCenterOriginalDataOneApplicationDoingReq) { | |||||
//1、查找对应 user_wx_applet_list 记录 | |||||
userWxAppletListDb := implement.NewUserWxAppletListDb(db.Db) | |||||
masterId := c.GetString("mid") | |||||
UserWxAppletList, err := userWxAppletListDb.GetUserWxAppletList(masterId) | |||||
if err != nil { | |||||
e.OutErr(c, e.ERR_DB_ORM, err.Error()) | |||||
return | |||||
} | |||||
if UserWxAppletList == nil { | |||||
e.OutErr(c, e.ERR_NO_DATA, "未查询到对应记录") | |||||
return | |||||
} | |||||
wxOpenThirdPartyAppListDb := implement.NewWxOpenThirdPartyAppListDb(db.Db) | |||||
wxOpenThirdPartyAppList, err := wxOpenThirdPartyAppListDb.GetWxOpenThirdPartyAppList(utils.StrToInt(masterId)) | |||||
if err != nil { | |||||
e.OutErr(c, e.ERR, err.Error()) | |||||
return | |||||
} | |||||
if wxOpenThirdPartyAppList == nil { | |||||
e.OutErr(c, e.ERR_NOT_FAN, "未查询到对应三方应用记录") | |||||
return | |||||
} | |||||
wxApiService, err := wechat.NewWxApiService(masterId, wxOpenThirdPartyAppList.Appid, wxOpenThirdPartyAppList.AppSecret) | |||||
if err != nil { | |||||
e.OutErr(c, e.ERR, err.Error()) | |||||
return | |||||
} | |||||
err, args := wxApiService.GetAdposDetail(req.AppId, 1, 1, req.Date, req.Date, req.AdId) | |||||
if err != nil { | |||||
e.OutErr(c, e.ERR, err.Error()) | |||||
return | |||||
} | |||||
var res = md.DataCenterOriginalDataOneApplicationDoingRes{} | |||||
for _, v := range args.List { | |||||
res = md.DataCenterOriginalDataOneApplicationDoingRes{ | |||||
AdId: v.AdUnitId, | |||||
AdSlot: v.StatItem.AdSlot, | |||||
ExposureCount: utils.Int64ToStr(v.StatItem.ExposureCount), | |||||
ReqSuccCount: utils.Int64ToStr(v.StatItem.ReqSuccCount), | |||||
PublisherIncome: utils.Float64ToStr(float64(v.StatItem.PublisherIncome) / 100), | |||||
ClickCount: utils.Int64ToStr(v.StatItem.ClickCount), | |||||
Ecpm: utils.Float64ToStr(v.StatItem.Ecpm / 100), | |||||
ExposureRate: utils.Float64ToStr(v.StatItem.ExposureRate), | |||||
ClickRate: utils.Float64ToStr(v.StatItem.ClickRate), | |||||
} | |||||
} | |||||
e.OutSuc(c, res, nil) | |||||
return | |||||
} | |||||
// 应用 | |||||
func GetAppletId(c *gin.Context, name, platform string) string { | |||||
mediumId := "" | |||||
sess := MasterDb(c).Where("1=1") | |||||
if name != "" || platform != "" { | |||||
ids := []string{"-1"} | |||||
var tmp []model2.AppletApplication | |||||
if name != "" { | |||||
sess.And("name like ? ", "%"+name+"%") | |||||
} | |||||
if platform != "" { | |||||
sess.And("platform = ? ", platform) | |||||
} | |||||
sess.Find(&tmp) | |||||
for _, v := range tmp { | |||||
ids = append(ids, utils.IntToStr(v.MediumId)) | |||||
} | |||||
mediumId = strings.Join(ids, ",") | |||||
} | |||||
return mediumId | |||||
} | |||||
// 广告位 | |||||
func GetSlotId(c *gin.Context, state string) string { | |||||
mediumId := "" | |||||
if state != "" { | |||||
ids := []string{"-1"} | |||||
var tmp []model2.AppletApplicationAdSpaceList | |||||
MasterDb(c).Where("state=?", state).Find(&tmp) | |||||
for _, v := range tmp { | |||||
ids = append(ids, utils.IntToStr(v.MediumId)) | |||||
} | |||||
mediumId = strings.Join(ids, ",") | |||||
} | |||||
return mediumId | |||||
} | |||||
// 应用 | |||||
func GetAppletInfo(c *gin.Context, id string) map[string]string { | |||||
var res = map[string]string{ | |||||
"platform": "", | |||||
"name": "", | |||||
} | |||||
NewAppletApplicationDb := implement2.NewAppletApplicationDb(MasterDb(c)) | |||||
data, _ := NewAppletApplicationDb.GetAppletApplicationListByAppid(id) | |||||
if data != nil { | |||||
res["platform"] = data.Platform | |||||
res["name"] = data.Name | |||||
} | |||||
return res | |||||
} | |||||
// 广告位 | |||||
func GetSlotInfo(c *gin.Context, id string) map[string]string { | |||||
var res = map[string]string{ | |||||
"state": "", | |||||
"name": "", | |||||
} | |||||
NewAppletApplicationAdSpaceListDb := implement2.NewAppletApplicationAdSpaceListDb(MasterDb(c)) | |||||
data, _ := NewAppletApplicationAdSpaceListDb.GetAppletApplicationAdSpaceListByAdId(id) | |||||
if data != nil { | |||||
res["name"] = data.Name | |||||
res["state"] = utils.IntToStr(data.State) | |||||
} | |||||
return res | |||||
} |
@@ -0,0 +1,148 @@ | |||||
package svc | |||||
import ( | |||||
"applet/app/md" | |||||
"applet/app/utils" | |||||
db "code.fnuoos.com/zhimeng/model.git/src" | |||||
"code.fnuoos.com/zhimeng/model.git/src/super/implement" | |||||
"code.fnuoos.com/zhimeng/model.git/src/super/model" | |||||
"github.com/gin-gonic/gin" | |||||
"time" | |||||
) | |||||
func DivisionStrategyList(c *gin.Context, req md.DivisionStrategyReq) md.DivisionStrategyRes { | |||||
engine := db.Db | |||||
NewMediumDivisionStrategyDb := implement.NewMediumDivisionStrategyDb(engine) | |||||
mediumId := GetMediumId(c, req.Name) | |||||
MediumList, total, _ := NewMediumDivisionStrategyDb.FindMediumDivisionStrategyList(c.GetString("mid"), mediumId, utils.StrToInt(req.Page), utils.StrToInt(req.Limit)) | |||||
data := make([]md.DivisionStrategyData, 0) | |||||
if len(MediumList) > 0 { | |||||
for _, v := range MediumList { | |||||
var tmp = md.DivisionStrategyData{ | |||||
Id: utils.IntToStr(v.Id), | |||||
MediumId: utils.IntToStr(v.Id), | |||||
Account: "", | |||||
Name: "", | |||||
PlatformRetentionRate: utils.IntToStr(v.PlatformRetentionRate), | |||||
CommissionRetentionRate: utils.IntToStr(v.CommissionRetentionRate), | |||||
MediaRevenueRate: utils.IntToStr(v.MediaRevenueRate), | |||||
AgentRevenueRate: utils.IntToStr(v.AgentRevenueRate), | |||||
ExtraRevenueRate: utils.IntToStr(v.ExtraRevenueRate), | |||||
AgreementSharingRate: utils.IntToStr(v.AgreementSharingRate), | |||||
} | |||||
tmpMedium := GetMediumInfo(c, v.MediumId) | |||||
if tmpMedium["account"] != "" { | |||||
tmp.Account = tmpMedium["account"] | |||||
} | |||||
if tmpMedium["name"] != "" { | |||||
tmp.Name = tmpMedium["name"] | |||||
} | |||||
data = append(data, tmp) | |||||
} | |||||
} | |||||
res := md.DivisionStrategyRes{ | |||||
List: data, | |||||
Total: total, | |||||
} | |||||
return res | |||||
} | |||||
func DivisionStrategyDetail(c *gin.Context, req md.DivisionStrategyDetailReq) md.DivisionStrategyDetailRes { | |||||
eg := db.Db | |||||
NewMediumDivisionStrategyDb := implement.NewMediumDivisionStrategyDb(eg) | |||||
mediumData, _ := NewMediumDivisionStrategyDb.GetOriginalWxAdDataByMediumId(utils.StrToInt(req.MediumId)) | |||||
tmpMedium := GetMediumInfo(c, mediumData.MediumId) | |||||
agentList := make([]md.DivisionStrategyDetailByAgent, 0) | |||||
res := md.DivisionStrategyDetailRes{ | |||||
MediumId: req.MediumId, | |||||
Account: "", | |||||
Name: "", | |||||
PlatformRetentionRate: utils.IntToStr(mediumData.PlatformRetentionRate), | |||||
CommissionRetentionRate: utils.IntToStr(mediumData.CommissionRetentionRate), | |||||
MediaRevenueRate: utils.IntToStr(mediumData.MediaRevenueRate), | |||||
AgentRevenueRate: utils.IntToStr(mediumData.AgentRevenueRate), | |||||
ExtraRevenueRate: utils.IntToStr(mediumData.ExtraRevenueRate), | |||||
AgreementSharingRate: utils.IntToStr(mediumData.AgreementSharingRate), | |||||
AgentList: agentList, | |||||
} | |||||
if tmpMedium["account"] != "" { | |||||
res.Account = tmpMedium["account"] | |||||
} | |||||
if tmpMedium["name"] != "" { | |||||
res.Name = tmpMedium["name"] | |||||
} | |||||
NewAgentWithMediumDb := implement.NewAgentWithMediumDb(eg) | |||||
agent, _ := NewAgentWithMediumDb.FindAgentWithMediumListByMediumIdAll(mediumData.MediumId) | |||||
if agent != nil { | |||||
NewMediumDivisionStrategyWithAgentFlowDb := implement.NewMediumDivisionStrategyWithAgentFlowDb(eg) | |||||
strategy, _ := NewMediumDivisionStrategyWithAgentFlowDb.FindMediumDivisionStrategyWithAgentFlowByStrategyId(mediumData.Id) | |||||
strategyMap := make(map[int]model.MediumDivisionStrategyWithAgentFlow) | |||||
if strategy != nil { | |||||
for _, v := range *strategy { | |||||
strategyMap[v.AgentId] = v | |||||
} | |||||
} | |||||
for _, v := range agent { | |||||
tmp := md.DivisionStrategyDetailByAgent{ | |||||
AgentId: utils.IntToStr(v.AgentId), | |||||
AgentRevenueRate: utils.IntToStr(strategyMap[v.AgentId].AgentRevenueRate), | |||||
ExtraRevenueRate: utils.IntToStr(strategyMap[v.AgentId].ExtraRevenueRate), | |||||
} | |||||
tmpAgent := GetAgentInfo(c, v.AgentId) | |||||
if tmpAgent["account"] != "" { | |||||
tmp.Account = tmpAgent["account"] | |||||
} | |||||
if tmpAgent["name"] != "" { | |||||
tmp.Name = tmpAgent["name"] | |||||
} | |||||
agentList = append(agentList, tmp) | |||||
} | |||||
} | |||||
res.AgentList = agentList | |||||
return res | |||||
} | |||||
func DivisionStrategySave(c *gin.Context, req md.DivisionStrategyDetailRes) error { | |||||
eg := db.Db | |||||
sess := eg.NewSession() | |||||
defer sess.Close() | |||||
sess.Begin() | |||||
NewMediumDivisionStrategyDb := implement.NewMediumDivisionStrategyDb(eg) | |||||
mediumData, _ := NewMediumDivisionStrategyDb.GetOriginalWxAdDataByMediumIdSess(sess, utils.StrToInt(req.MediumId)) | |||||
mediumData.PlatformRetentionRate = utils.StrToInt(req.PlatformRetentionRate) | |||||
mediumData.CommissionRetentionRate = utils.StrToInt(req.CommissionRetentionRate) | |||||
mediumData.MediaRevenueRate = utils.StrToInt(req.MediaRevenueRate) | |||||
mediumData.AgentRevenueRate = utils.StrToInt(req.AgentRevenueRate) | |||||
mediumData.ExtraRevenueRate = utils.StrToInt(req.ExtraRevenueRate) | |||||
mediumData.AgreementSharingRate = utils.StrToInt(req.AgreementSharingRate) | |||||
_, err := sess.Where("id=?", mediumData.Id).Update(mediumData) | |||||
if err != nil { | |||||
sess.Rollback() | |||||
return err | |||||
} | |||||
NewMediumDivisionStrategyWithAgentFlowDb := implement.NewMediumDivisionStrategyWithAgentFlowDb(eg) | |||||
for _, v := range req.AgentList { | |||||
flow, _ := NewMediumDivisionStrategyWithAgentFlowDb.GetMediumDivisionStrategyWithAgentFlowSess(sess, mediumData.Id, utils.StrToInt(v.AgentId)) | |||||
if flow == nil { | |||||
flow = &model.MediumDivisionStrategyWithAgentFlow{ | |||||
StrategyId: mediumData.Id, | |||||
AgentId: utils.StrToInt(v.AgentId), | |||||
CreateAt: time.Now().Format("2006-01-02 15:04:05"), | |||||
UpdateAt: time.Now().Format("2006-01-02 15:04:05"), | |||||
} | |||||
_, err = sess.Insert(flow) | |||||
if err != nil { | |||||
sess.Rollback() | |||||
return err | |||||
} | |||||
} | |||||
flow.ExtraRevenueRate = utils.StrToInt(v.ExtraRevenueRate) | |||||
flow.AgentRevenueRate = utils.StrToInt(v.AgentRevenueRate) | |||||
flow.UpdateAt = time.Now().Format("2006-01-02 15:04:05") | |||||
_, err = sess.Where("id=?", flow.Id).Update(flow) | |||||
if err != nil { | |||||
sess.Rollback() | |||||
return err | |||||
} | |||||
} | |||||
sess.Commit() | |||||
return nil | |||||
} |
@@ -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 FinanceCenterMediumInvoiceSave(c *gin.Context, req md.InvoiceReq) { | |||||
engine := db.Db | |||||
NewMediumSettlementDb := implement.NewMediumSettlementDb(engine) | |||||
data, _ := NewMediumSettlementDb.GetMediumSettlementById(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 | |||||
} | |||||
NewMediumInvoiceDb := implement.NewMediumInvoiceDb(engine) | |||||
invoice, _ := NewMediumInvoiceDb.GetMediumInvoice(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 FinanceCenterMediumSettleFileSave(c *gin.Context, req md.SettleFileReq) { | |||||
engine := db.Db | |||||
NewMediumSettlementDb := implement.NewMediumSettlementDb(engine) | |||||
data, _ := NewMediumSettlementDb.GetMediumSettlementById(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 FinanceCenterMediumPaySave(c *gin.Context, req md.CommDetailReq) { | |||||
engine := db.Db | |||||
NewMediumSettlementDb := implement.NewMediumSettlementDb(engine) | |||||
data, _ := NewMediumSettlementDb.GetMediumSettlementById(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 FinanceCenterMediumOtherIncomeSave(c *gin.Context, req md.OtherIncomeReq) { | |||||
engine := db.Db | |||||
NewMediumSettlementDb := implement.NewMediumSettlementDb(engine) | |||||
data, _ := NewMediumSettlementDb.GetMediumSettlementById(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 FinanceCenterMediumDetail(c *gin.Context, req md.CommDetailReq) md.FinanceCenterDataDetailRes { | |||||
engine := db.Db | |||||
NewMediumSettlementDb := implement.NewMediumSettlementDb(engine) | |||||
data, _ := NewMediumSettlementDb.GetMediumSettlementById(utils.StrToInt(req.Id)) | |||||
file := make([]md.InvoiceFile, 0) | |||||
invoice := md.Invoice{ | |||||
Type: "0", | |||||
Time: "", | |||||
Count: "0", | |||||
File: file, | |||||
} | |||||
//发票 | |||||
NewMediumInvoiceDb := implement.NewMediumInvoiceDb(engine) | |||||
invoiceData, _ := NewMediumInvoiceDb.GetMediumInvoice(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.FinanceCenterDataDetail{ | |||||
Source: "手动导入", | |||||
SettleFile: data.SettleFile, | |||||
Invoice: invoice, | |||||
AllIncome: utils.Float64ToStr(float64(data.OtherIncome+data.BasicIncome) / 100), | |||||
TopIncome: "", | |||||
CommissionIncome: "", | |||||
PlatformIncome: "", | |||||
ChangeIncome: "", | |||||
MediumIncome: 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 | |||||
} | |||||
} | |||||
tmpMedium := GetMediumInfo(c, data.MediumId) | |||||
if tmpMedium["name"] != "" { | |||||
tmp.Name = tmpMedium["name"] | |||||
} | |||||
if tmpMedium["account"] != "" { | |||||
tmp.Account = tmpMedium["account"] | |||||
} | |||||
res := md.FinanceCenterDataDetailRes{ | |||||
Data: tmp, | |||||
InvoiceCate: md.InvoiceCate, | |||||
SettleType: md.AccountSettleState, | |||||
BusinessKind: md.BusinessKind, | |||||
SettlePayState: md.SettlePayState, | |||||
SettleState: md.SettleState, | |||||
InvoiceState: md.InvoiceState, | |||||
} | |||||
return res | |||||
} | |||||
func FinanceCenterMediumList(c *gin.Context, req md.FinanceCenterDataReq) md.FinanceCenterDataRes { | |||||
engine := db.Db | |||||
NewMediumSettlementDb := implement.NewMediumSettlementDb(engine) | |||||
MediumList, total, _ := NewMediumSettlementDb.FindMediumSettlementList(c.GetString("mid"), "", "", req.PayState, "", req.StartTime, req.EndTime, utils.StrToInt(req.Page), utils.StrToInt(req.Limit)) | |||||
data := make([]md.FinanceCenterDataData, 0) | |||||
if len(MediumList) > 0 { | |||||
for _, v := range MediumList { | |||||
var tmp = md.FinanceCenterDataData{ | |||||
Id: utils.IntToStr(v.Id), | |||||
Name: "", | |||||
AllIncome: utils.Float64ToStr(float64(v.OtherIncome+v.BasicIncome) / 100), | |||||
TopIncome: "", | |||||
CommissionIncome: "", | |||||
PlatformIncome: "", | |||||
ChangeIncome: "", | |||||
MediumIncome: 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: "预估", | |||||
} | |||||
tmpMedium := GetMediumInfo(c, v.MediumId) | |||||
if tmpMedium["name"] != "" { | |||||
tmp.Name = tmpMedium["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.FinanceCenterDataRes{ | |||||
List: data, | |||||
Total: total, | |||||
SettleType: md.AccountSettleState, | |||||
BusinessKind: md.BusinessKind, | |||||
SettlePayState: md.SettlePayState, | |||||
SettleState: md.SettleState, | |||||
} | |||||
return res | |||||
} |
@@ -7,6 +7,7 @@ import ( | |||||
"applet/app/utils" | "applet/app/utils" | ||||
db "code.fnuoos.com/zhimeng/model.git/src" | db "code.fnuoos.com/zhimeng/model.git/src" | ||||
implement2 "code.fnuoos.com/zhimeng/model.git/src/implement" | implement2 "code.fnuoos.com/zhimeng/model.git/src/implement" | ||||
model2 "code.fnuoos.com/zhimeng/model.git/src/model" | |||||
"code.fnuoos.com/zhimeng/model.git/src/super/implement" | "code.fnuoos.com/zhimeng/model.git/src/super/implement" | ||||
"code.fnuoos.com/zhimeng/model.git/src/super/model" | "code.fnuoos.com/zhimeng/model.git/src/super/model" | ||||
"github.com/gin-gonic/gin" | "github.com/gin-gonic/gin" | ||||
@@ -155,3 +156,140 @@ func MediumBindAgentDel(c *gin.Context) { | |||||
e.OutSuc(c, "success", nil) | e.OutSuc(c, "success", nil) | ||||
return | return | ||||
} | } | ||||
func GetMediumId(c *gin.Context, name string) string { | |||||
mediumId := "" | |||||
if name != "" { | |||||
ids := []string{"-1"} | |||||
var tmp []model2.Medium | |||||
MasterDb(c).Where("memo like ? or username like ?", "%"+name+"%", "%"+name+"%").Find(&tmp) | |||||
for _, v := range tmp { | |||||
ids = append(ids, utils.IntToStr(v.MediumId)) | |||||
} | |||||
var tmp1 []model.MediumList | |||||
MasterDb(c).Where("company_name like ? or company_abbreviation like ?", "%"+name+"%", "%"+name+"%").Find(&tmp1) | |||||
for _, v := range tmp1 { | |||||
ids = append(ids, utils.IntToStr(v.MediumId)) | |||||
} | |||||
mediumId = strings.Join(ids, ",") | |||||
} | |||||
return mediumId | |||||
} | |||||
func GetMediumByAccountId(c *gin.Context, name, account string) string { | |||||
mediumId := "" | |||||
if name != "" || account != "" { | |||||
ids := []string{"-1"} | |||||
var tmp []model2.Medium | |||||
sess := MasterDb(c).Where("1=1") | |||||
if name != "" { | |||||
sess.And("memo like ?", "%"+name+"%") | |||||
var tmp1 []model.MediumList | |||||
MasterDb(c).Where("company_name like ? or company_abbreviation like ?", "%"+name+"%", "%"+name+"%").Find(&tmp1) | |||||
for _, v := range tmp1 { | |||||
ids = append(ids, utils.IntToStr(v.MediumId)) | |||||
} | |||||
} | |||||
if account != "" { | |||||
sess.And(" username like ?", "%"+name+"%", "%"+name+"%") | |||||
} | |||||
sess.Find(&tmp) | |||||
for _, v := range tmp { | |||||
ids = append(ids, utils.IntToStr(v.MediumId)) | |||||
} | |||||
mediumId = strings.Join(ids, ",") | |||||
} | |||||
return mediumId | |||||
} | |||||
func GetMediumInfo(c *gin.Context, mediumId int) map[string]string { | |||||
var res = map[string]string{ | |||||
"account": "", | |||||
"name": "", | |||||
} | |||||
NewMediumDb := implement2.NewMediumDb(MasterDb(c)) | |||||
NewMediumListDb := implement.NewMediumListDb(MasterDb(c)) | |||||
medium := NewMediumDb.GetSuperAdmin(mediumId) | |||||
if medium != nil { | |||||
res["account"] = medium.Username | |||||
res["name"] = medium.Memo | |||||
} | |||||
NewMediumList, _ := NewMediumListDb.GetMediumList(mediumId) | |||||
if NewMediumList != nil { | |||||
if NewMediumList.CompanyName != "" { | |||||
res["name"] = NewMediumList.CompanyName | |||||
} | |||||
if NewMediumList.CompanyAbbreviation != "" { | |||||
res["name"] = NewMediumList.CompanyAbbreviation | |||||
} | |||||
} | |||||
return res | |||||
} | |||||
func GetAgentId(c *gin.Context, name string) string { | |||||
mediumId := "" | |||||
if name != "" { | |||||
ids := []string{"-1"} | |||||
var tmp []model2.Agent | |||||
MasterDb(c).Where("memo like ? or username like ?", "%"+name+"%", "%"+name+"%").Find(&tmp) | |||||
for _, v := range tmp { | |||||
ids = append(ids, utils.IntToStr(v.AgentId)) | |||||
} | |||||
var tmp1 []model.AgentList | |||||
MasterDb(c).Where("company_name like ? or company_abbreviation like ?", "%"+name+"%", "%"+name+"%").Find(&tmp1) | |||||
for _, v := range tmp1 { | |||||
ids = append(ids, utils.IntToStr(v.AgentId)) | |||||
} | |||||
mediumId = strings.Join(ids, ",") | |||||
} | |||||
return mediumId | |||||
} | |||||
func GetAgentByAccountId(c *gin.Context, name, account string) string { | |||||
mediumId := "" | |||||
if name != "" || account != "" { | |||||
ids := []string{"-1"} | |||||
var tmp []model2.Agent | |||||
sess := MasterDb(c).Where("1=1") | |||||
if name != "" { | |||||
sess.And("memo like ?", "%"+name+"%") | |||||
var tmp1 []model.AgentList | |||||
MasterDb(c).Where("company_name like ? or company_abbreviation like ?", "%"+name+"%", "%"+name+"%").Find(&tmp1) | |||||
for _, v := range tmp1 { | |||||
ids = append(ids, utils.IntToStr(v.AgentId)) | |||||
} | |||||
} | |||||
if account != "" { | |||||
sess.And(" username like ?", "%"+name+"%", "%"+name+"%") | |||||
} | |||||
sess.Find(&tmp) | |||||
for _, v := range tmp { | |||||
ids = append(ids, utils.IntToStr(v.AgentId)) | |||||
} | |||||
mediumId = strings.Join(ids, ",") | |||||
} | |||||
return mediumId | |||||
} | |||||
func GetAgentInfo(c *gin.Context, mediumId int) map[string]string { | |||||
var res = map[string]string{ | |||||
"account": "", | |||||
"name": "", | |||||
} | |||||
NewAgentDb := implement2.NewAgentDb(MasterDb(c)) | |||||
NewAgentListDb := implement.NewAgentListDb(MasterDb(c)) | |||||
medium := NewAgentDb.GetSuperAdmin(mediumId) | |||||
if medium != nil { | |||||
res["account"] = medium.Username | |||||
res["name"] = medium.Memo | |||||
} | |||||
NewAgentList, _ := NewAgentListDb.GetAgentList(mediumId) | |||||
if NewAgentList != nil { | |||||
if NewAgentList.CompanyName != "" { | |||||
res["name"] = NewAgentList.CompanyName | |||||
} | |||||
if NewAgentList.CompanyAbbreviation != "" { | |||||
res["name"] = NewAgentList.CompanyAbbreviation | |||||
} | |||||
} | |||||
return res | |||||
} |
@@ -0,0 +1,86 @@ | |||||
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" | |||||
"github.com/gin-gonic/gin" | |||||
) | |||||
func SettleCenterAgentList(c *gin.Context, req md.SettleCenterDataReq) md.SettleCenterDataRes { | |||||
engine := db.Db | |||||
NewOriginalWxAdDataDb := implement.NewAgentListDb(engine) | |||||
appId := GetAgentByAccountId(c, req.Name, req.Account) | |||||
AgentList, total, _ := NewOriginalWxAdDataDb.FindAgentListBySettleType(c.GetString("mid"), appId, req.State, utils.StrToInt(req.Page), utils.StrToInt(req.Limit)) | |||||
data := make([]md.SettleCenterDataData, 0) | |||||
if len(AgentList) > 0 { | |||||
for _, v := range AgentList { | |||||
var tmp = md.SettleCenterDataData{ | |||||
Id: utils.IntToStr(v.AgentId), | |||||
SettleType: utils.IntToStr(v.SettlementType), | |||||
UpdateAt: v.UpdateAt, | |||||
} | |||||
tmpApplet := GetAgentInfo(c, v.AgentId) | |||||
if tmpApplet["account"] != "" { | |||||
tmp.Account = tmpApplet["account"] | |||||
} | |||||
if tmpApplet["name"] != "" { | |||||
tmp.Name = tmpApplet["name"] | |||||
} | |||||
data = append(data, tmp) | |||||
} | |||||
} | |||||
res := md.SettleCenterDataRes{ | |||||
List: data, | |||||
Total: total, | |||||
State: md.AccountSettleState, | |||||
} | |||||
return res | |||||
} | |||||
func SettleCenterAgentSave(c *gin.Context, req md.SettleCenterDataSaveReq) { | |||||
NewAgentListDb := implement.NewAgentListDb(db.Db) | |||||
data, _ := NewAgentListDb.GetAgentList(utils.StrToInt(req.Id)) | |||||
if data == nil { | |||||
e.OutErr(c, 400, e.NewErr(400, "记录不存在")) | |||||
return | |||||
} | |||||
data.SettlementType = utils.StrToInt(req.SettleType) | |||||
db.Db.Where("id=?", data.Id).Cols("settlement_type").Update(data) | |||||
e.OutSuc(c, "success", nil) | |||||
return | |||||
} | |||||
func SettleCenterAgentDetail(c *gin.Context, req md.SettleCenterDataDetailReq) md.SettleCenterDataDetailRes { | |||||
engine := db.Db | |||||
NewAgentSettlementDb := implement.NewAgentSettlementDb(engine) | |||||
AgentList, total, _ := NewAgentSettlementDb.FindAgentSettlementList(c.GetString("mid"), req.Id, "", "", "", req.StartTime, req.EndTime, utils.StrToInt(req.Page), utils.StrToInt(req.Limit)) | |||||
data := make([]md.SettleCenterDataDetailData, 0) | |||||
if len(AgentList) > 0 { | |||||
for _, v := range AgentList { | |||||
var tmp = md.SettleCenterDataDetailData{ | |||||
TimeStr: v.StartDate, | |||||
BusinessKind: utils.IntToStr(v.BusinessKind), | |||||
SettleType: utils.IntToStr(v.Kind), | |||||
AllIncome: utils.Float64ToStr(float64(v.OtherIncome+v.BasicIncome) / 100), | |||||
BasicIncome: utils.Float64ToStr(float64(v.BasicIncome) / 100), | |||||
OtherIncome: utils.Float64ToStr(float64(v.OtherIncome) / 100), | |||||
PayState: utils.IntToStr(v.PayState), | |||||
State: utils.IntToStr(v.State), | |||||
} | |||||
if v.EndDate != "" && v.EndDate != "0000-00-00" { | |||||
tmp.TimeStr += "~" + v.EndDate | |||||
} | |||||
data = append(data, tmp) | |||||
} | |||||
} | |||||
res := md.SettleCenterDataDetailRes{ | |||||
List: data, | |||||
Total: total, | |||||
SettleType: md.AccountSettleState, | |||||
BusinessKind: md.BusinessKind, | |||||
SettlePayState: md.SettlePayState, | |||||
SettleState: md.SettleState, | |||||
} | |||||
return res | |||||
} |
@@ -0,0 +1,86 @@ | |||||
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" | |||||
"github.com/gin-gonic/gin" | |||||
) | |||||
func SettleCenterMediumList(c *gin.Context, req md.SettleCenterDataReq) md.SettleCenterDataRes { | |||||
engine := db.Db | |||||
NewOriginalWxAdDataDb := implement.NewMediumListDb(engine) | |||||
appId := GetMediumByAccountId(c, req.Name, req.Account) | |||||
MediumList, total, _ := NewOriginalWxAdDataDb.FindMediumListBySettleType(c.GetString("mid"), appId, req.State, utils.StrToInt(req.Page), utils.StrToInt(req.Limit)) | |||||
data := make([]md.SettleCenterDataData, 0) | |||||
if len(MediumList) > 0 { | |||||
for _, v := range MediumList { | |||||
var tmp = md.SettleCenterDataData{ | |||||
Id: utils.IntToStr(v.MediumId), | |||||
SettleType: utils.IntToStr(v.SettlementType), | |||||
UpdateAt: v.UpdateAt, | |||||
} | |||||
tmpApplet := GetMediumInfo(c, v.MediumId) | |||||
if tmpApplet["account"] != "" { | |||||
tmp.Account = tmpApplet["account"] | |||||
} | |||||
if tmpApplet["name"] != "" { | |||||
tmp.Name = tmpApplet["name"] | |||||
} | |||||
data = append(data, tmp) | |||||
} | |||||
} | |||||
res := md.SettleCenterDataRes{ | |||||
List: data, | |||||
Total: total, | |||||
State: md.AccountSettleState, | |||||
} | |||||
return res | |||||
} | |||||
func SettleCenterMediumSave(c *gin.Context, req md.SettleCenterDataSaveReq) { | |||||
NewMediumListDb := implement.NewMediumListDb(db.Db) | |||||
data, _ := NewMediumListDb.GetMediumList(utils.StrToInt(req.Id)) | |||||
if data == nil { | |||||
e.OutErr(c, 400, e.NewErr(400, "记录不存在")) | |||||
return | |||||
} | |||||
data.SettlementType = utils.StrToInt(req.SettleType) | |||||
db.Db.Where("id=?", data.Id).Cols("settlement_type").Update(data) | |||||
e.OutSuc(c, "success", nil) | |||||
return | |||||
} | |||||
func SettleCenterMediumDetail(c *gin.Context, req md.SettleCenterDataDetailReq) md.SettleCenterDataDetailRes { | |||||
engine := db.Db | |||||
NewMediumSettlementDb := implement.NewMediumSettlementDb(engine) | |||||
MediumList, total, _ := NewMediumSettlementDb.FindMediumSettlementList(c.GetString("mid"), req.Id, "", "", "", req.StartTime, req.EndTime, utils.StrToInt(req.Page), utils.StrToInt(req.Limit)) | |||||
data := make([]md.SettleCenterDataDetailData, 0) | |||||
if len(MediumList) > 0 { | |||||
for _, v := range MediumList { | |||||
var tmp = md.SettleCenterDataDetailData{ | |||||
TimeStr: v.StartDate, | |||||
BusinessKind: utils.IntToStr(v.BusinessKind), | |||||
SettleType: utils.IntToStr(v.Kind), | |||||
AllIncome: utils.Float64ToStr(float64(v.OtherIncome+v.BasicIncome) / 100), | |||||
BasicIncome: utils.Float64ToStr(float64(v.BasicIncome) / 100), | |||||
OtherIncome: utils.Float64ToStr(float64(v.OtherIncome) / 100), | |||||
PayState: utils.IntToStr(v.PayState), | |||||
State: utils.IntToStr(v.State), | |||||
} | |||||
if v.EndDate != "" && v.EndDate != "0000-00-00" { | |||||
tmp.TimeStr += "~" + v.EndDate | |||||
} | |||||
data = append(data, tmp) | |||||
} | |||||
} | |||||
res := md.SettleCenterDataDetailRes{ | |||||
List: data, | |||||
Total: total, | |||||
SettleType: md.AccountSettleState, | |||||
BusinessKind: md.BusinessKind, | |||||
SettlePayState: md.SettlePayState, | |||||
SettleState: md.SettleState, | |||||
} | |||||
return res | |||||
} |
@@ -92,6 +92,7 @@ func GenerateWxAdData(req md.GenerateWxAdData) (err error, generateWxAdData mode | |||||
now := time.Now() | now := time.Now() | ||||
generateWxAdData = model.GenerateWxAdData{ | generateWxAdData = model.GenerateWxAdData{ | ||||
Uuid: originalWxAdData.Uuid, | Uuid: originalWxAdData.Uuid, | ||||
Platform: originalWxAdData.Platform, | |||||
AppId: originalWxAdData.AppId, | AppId: originalWxAdData.AppId, | ||||
OriginalDataId: originalWxAdData.Id, | OriginalDataId: originalWxAdData.Id, | ||||
SlotId: originalWxAdData.SlotId, | SlotId: originalWxAdData.SlotId, | ||||
@@ -5,7 +5,6 @@ go 1.18 | |||||
//replace code.fnuoos.com/zhimeng/model.git => E:/company/ad/models | //replace code.fnuoos.com/zhimeng/model.git => E:/company/ad/models | ||||
require ( | require ( | ||||
code.fnuoos.com/zhimeng/model.git v0.0.3-0.20240828084358-f52add033ca9 | |||||
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 | github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 | ||||
github.com/boombuler/barcode v1.0.1 | github.com/boombuler/barcode v1.0.1 | ||||
github.com/dchest/uniuri v0.0.0-20200228104902-7aecb25e1fe5 | github.com/dchest/uniuri v0.0.0-20200228104902-7aecb25e1fe5 | ||||
@@ -34,7 +33,11 @@ require ( | |||||
xorm.io/xorm v1.3.1 | xorm.io/xorm v1.3.1 | ||||
) | ) | ||||
require github.com/jinzhu/copier v0.4.0 | |||||
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 | |||||
github.com/jinzhu/copier v0.4.0 | |||||
) | |||||
require ( | require ( | ||||
filippo.io/edwards25519 v1.1.0 // indirect | filippo.io/edwards25519 v1.1.0 // indirect | ||||
@@ -67,6 +70,7 @@ require ( | |||||
github.com/onsi/gomega v1.10.5 // indirect | github.com/onsi/gomega v1.10.5 // indirect | ||||
github.com/pelletier/go-toml/v2 v2.0.6 // indirect | github.com/pelletier/go-toml/v2 v2.0.6 // indirect | ||||
github.com/pkg/errors v0.9.1 // indirect | github.com/pkg/errors v0.9.1 // indirect | ||||
github.com/streadway/amqp v1.0.0 // indirect | |||||
github.com/syndtr/goleveldb v1.0.0 // indirect | github.com/syndtr/goleveldb v1.0.0 // indirect | ||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect | github.com/twitchyliquid64/golang-asm v0.15.1 // indirect | ||||
github.com/ugorji/go/codec v1.2.9 // indirect | github.com/ugorji/go/codec v1.2.9 // indirect | ||||
@@ -19,6 +19,7 @@ import ( | |||||
// 系统初始化 | // 系统初始化 | ||||
func init() { | func init() { | ||||
cfg.InitCfg() //配置初始化 | cfg.InitCfg() //配置初始化 | ||||
cfg.InitMq() //配置初始化 | |||||
cfg.InitLog() //日志初始化 | cfg.InitLog() //日志初始化 | ||||
cfg.InitCache() //缓存初始化 | cfg.InitCache() //缓存初始化 | ||||
if cfg.Debug { //判断是否是debug | if cfg.Debug { //判断是否是debug | ||||