From 06c372519ce485739585b1ac30f4c69993dca68a Mon Sep 17 00:00:00 2001 From: dengbiao Date: Sat, 28 Sep 2024 16:15:47 +0800 Subject: [PATCH] 1 --- app/enum/enum_ams_category.go | 52 +++ app/hdl/hdl_demo.go | 31 +- app/hdl/hdl_set_center.go | 340 ++++++++++++++- app/lib/wechat/md/wechat_api_md.go | 41 ++ app/lib/wechat/wechat_api.go | 116 +++++- app/md/md_set_center.go | 42 +- app/router/router.go | 232 ++++++----- docs/docs.go | 639 +++++++++++++++++++++++++++++ docs/swagger.json | 639 +++++++++++++++++++++++++++++ docs/swagger.yaml | 430 +++++++++++++++++++ etc/cfg.yml | 17 +- 11 files changed, 2449 insertions(+), 130 deletions(-) create mode 100644 app/enum/enum_ams_category.go diff --git a/app/enum/enum_ams_category.go b/app/enum/enum_ams_category.go new file mode 100644 index 0000000..d39b8fb --- /dev/null +++ b/app/enum/enum_ams_category.go @@ -0,0 +1,52 @@ +package enum + +type AmsCategory string + +const ( + AmsCategoryForChess = "CHESS" + AmsCategoryForAdultSupplies = "ADULT_SUPPLIES" + AmsCategoryForMEDICALHEALTH = "MEDICAL_HEALTH" + AmsCategoryForINSURANCE = "INSURANCE" + AmsCategoryForSECURITES = "SECURITES" + AmsCategoryForLOAN = "LOAN" + AmsCategoryForLIVINGSERVICESBEAUTY = "LIVING_SERVICES_BEAUTY" + AmsCategoryForLIVINGSERVICESENTERTAINMENT = "LIVING_SERVICES_ENTERTAINMENT" + AmsCategoryForLIVINGSERVICESOTHERS = "LIVING_SERVICES_OTHERS" + AmsCategoryForFOODINDUSTRY = "FOOD_INDUSTRY" + AmsCategoryForRETAILANDGENERALMERCHANDISE = "RETAIL_AND_GENERAL_MERCHANDISE" + AmsCategoryForFOODANDDRINK = "FOOD_AND_DRINK" + AmsCategoryForTECHNICALSERVICE = "TECHNICAL_SERVICE" +) + +func (gt AmsCategory) String() string { + switch gt { + case AmsCategoryForChess: + return "棋牌游戏" + case AmsCategoryForAdultSupplies: + return "成人用品" + case AmsCategoryForMEDICALHEALTH: + return "医疗健康" + case AmsCategoryForINSURANCE: + return "保险" + case AmsCategoryForSECURITES: + return "证券" + case AmsCategoryForLOAN: + return "贷款" + case AmsCategoryForLIVINGSERVICESBEAUTY: + return "生活服务(丽人)" + case AmsCategoryForLIVINGSERVICESENTERTAINMENT: + return "生活服务(休闲娱乐)" + case AmsCategoryForLIVINGSERVICESOTHERS: + return "生活服务(其他)" + case AmsCategoryForFOODINDUSTRY: + return "餐饮" + case AmsCategoryForRETAILANDGENERALMERCHANDISE: + return "零售和百货" + case AmsCategoryForFOODANDDRINK: + return "食品饮料" + case AmsCategoryForTECHNICALSERVICE: + return "通讯与IT服务" + default: + return "未知" + } +} diff --git a/app/hdl/hdl_demo.go b/app/hdl/hdl_demo.go index bef6cc3..6315e25 100644 --- a/app/hdl/hdl_demo.go +++ b/app/hdl/hdl_demo.go @@ -22,7 +22,7 @@ func Demo(c *gin.Context) { appId := c.DefaultQuery("app_id", "") masterId := svc.GetMasterId(c) adUnitId := c.DefaultQuery("adunit_id", "") - //1、查找对应 user_wx_applet_list 记录 + // 1、查找对应 user_wx_applet_list 记录 userWxAppletListDb := implement.NewUserWxAppletListDb(db.Db) UserWxAppletList, err := userWxAppletListDb.GetUserWxAppletList(masterId) if err != nil { @@ -77,3 +77,32 @@ func Demo(c *gin.Context) { }, nil) return } + +func GetAuthToken(c *gin.Context) { + masterId := c.DefaultQuery("master_id", "") + 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 + } + auth, err := wxApiService.GetAuth("wxe3e570bee013db1e") + if err != nil { + e.OutErr(c, e.ERR, err.Error()) + return + } + e.OutSuc(c, map[string]interface{}{ + "data": auth, + }, nil) + return +} diff --git a/app/hdl/hdl_set_center.go b/app/hdl/hdl_set_center.go index 54adcb0..ac48147 100644 --- a/app/hdl/hdl_set_center.go +++ b/app/hdl/hdl_set_center.go @@ -7,13 +7,16 @@ import ( "applet/app/enum" "applet/app/lib/validate" "applet/app/lib/wechat" + md2 "applet/app/lib/wechat/md" "applet/app/md" "applet/app/svc" "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" + "encoding/json" "github.com/gin-gonic/gin" + "strings" "time" ) @@ -105,7 +108,7 @@ func WxOpenSet(c *gin.Context) { return } masterId := svc.GetMasterId(c) - //1、查找对应 wx_open_third_party_app_list 记录 + // 1、查找对应 wx_open_third_party_app_list 记录 wxOpenThirdPartyAppListDb := implement.NewWxOpenThirdPartyAppListDb(db.Db) UserWxAppletList, err := wxOpenThirdPartyAppListDb.GetWxOpenThirdPartyAppList(utils.StrToInt(masterId)) if err != nil { @@ -157,7 +160,7 @@ func WxOpenSet(c *gin.Context) { // @Router /api/setCenter/basic/wxOpenGet [GET] func WxOpenGet(c *gin.Context) { masterId := svc.GetMasterId(c) - //1、查找对应 wx_open_third_party_app_list 记录 + // 1、查找对应 wx_open_third_party_app_list 记录 wxOpenThirdPartyAppListDb := implement.NewWxOpenThirdPartyAppListDb(db.Db) UserWxAppletList, err := wxOpenThirdPartyAppListDb.GetWxOpenThirdPartyAppList(utils.StrToInt(masterId)) if err != nil { @@ -224,7 +227,7 @@ type WxOpenThirdPartyAppList struct { // @Router /api/setCenter/applet/list [GET] func AppletList(c *gin.Context) { masterId := svc.GetMasterId(c) - //1、查找对应 user_wx_applet_list 记录 + // 1、查找对应 user_wx_applet_list 记录 userWxAppletListDb := implement.NewUserWxAppletListDb(db.Db) UserWxAppletList, err := userWxAppletListDb.GetUserWxAppletList(masterId) if err != nil { @@ -256,7 +259,7 @@ func AppletAdd(c *gin.Context) { return } masterId := svc.GetMasterId(c) - //1、查找对应 user_wx_applet_list 记录 + // 1、查找对应 user_wx_applet_list 记录 userWxAppletListDb := implement.NewUserWxAppletListDb(db.Db) UserWxAppletList, err := userWxAppletListDb.GetUserWxAppletList(masterId) if err != nil { @@ -308,7 +311,7 @@ func AppletUpdate(c *gin.Context) { return } masterId := svc.GetMasterId(c) - //1、查找对应 user_wx_applet_list 记录 + // 1、查找对应 user_wx_applet_list 记录 userWxAppletListDb := implement.NewUserWxAppletListDb(db.Db) UserWxAppletList, err := userWxAppletListDb.GetUserWxAppletList(masterId) if err != nil { @@ -345,7 +348,7 @@ func AppletDelete(c *gin.Context) { id := c.Param("id") masterId := svc.GetMasterId(c) - //1、查找对应 user_wx_applet_list 记录 + // 1、查找对应 user_wx_applet_list 记录 userWxAppletListDb := implement.NewUserWxAppletListDb(db.Db) UserWxAppletList, err := userWxAppletListDb.GetUserWxAppletList(masterId) if err != nil { @@ -380,7 +383,7 @@ func AppletAuthorize(c *gin.Context) { masterId := svc.GetMasterId(c) url := "http://super.advertisement.dengbiao.top/api/wxOpen/getPreAuthCode?master_id=" + masterId if cfg.Prd { - url = "http://super.advertisement.dengbiao.top/api/wxOpen/getPreAuthCode?master_id=" + masterId + url = "http://ad.zhios.cn/api/wxOpen/getPreAuthCode?master_id=" + masterId } e.OutSuc(c, map[string]string{ "url": url, @@ -401,7 +404,7 @@ func AppletAuthorize(c *gin.Context) { func AppletUnauthorized(c *gin.Context) { appId := c.DefaultQuery("app_id", "") masterId := svc.GetMasterId(c) - //1、查找对应 user_wx_applet_list 记录 + // 1、查找对应 user_wx_applet_list 记录 userWxAppletListDb := implement.NewUserWxAppletListDb(db.Db) UserWxAppletList, err := userWxAppletListDb.GetUserWxAppletList(masterId) if err != nil { @@ -593,3 +596,324 @@ func GetLogo(c *gin.Context) { }, nil) return } + +// AppletGetBlackList +// @Summary 获取屏蔽的广告主 +// @Tags 设置中心-小程序设置-屏蔽规则 +// @Description 小程序设置-屏蔽规则-获取屏蔽的广告主 +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Accept json +// @Produce json +// @Param args body md.AppletGetBlackListReq true "请求参数" +// @Success 200 {object} md2.AgencyGetBlackListResp +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/setCenter/basic/applet/shieldRules/getBlackList [POST] +func AppletGetBlackList(c *gin.Context) { + var req md.AppletGetBlackListReq + err := c.ShouldBindJSON(&req) + if err != nil { + err = validate.HandleValidateErr(err) + err1 := err.(e.E) + e.OutErr(c, err1.Code, err1.Error()) + return + } + + masterId := svc.GetMasterId(c) + + 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 + } + var resp md2.AgencyGetBlackListResp + err, resp = wxApiService.GetBlackList(req.Appid) + if err != nil { + e.OutErr(c, e.ERR, err.Error()) + return + } + e.OutSuc(c, resp, nil) + return +} + +// AppletAddBlackList +// @Summary 添加屏蔽的广告主 +// @Tags 设置中心-小程序设置-屏蔽规则 +// @Description 小程序设置-屏蔽规则-添加屏蔽的广告主 +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Accept json +// @Produce json +// @Param args body md.AppletAddBlackListReq true "请求参数" +// @Success 200 {string} "success" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/setCenter/basic/applet/shieldRules/addBlackList [POST] +func AppletAddBlackList(c *gin.Context) { + var req md.AppletAddBlackListReq + err := c.ShouldBindJSON(&req) + if err != nil { + err = validate.HandleValidateErr(err) + err1 := err.(e.E) + e.OutErr(c, err1.Code, err1.Error()) + return + } + + masterId := svc.GetMasterId(c) + + 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 + } + listStr, _ := json.Marshal([]interface{}{ + map[string]interface{}{ + "type": req.Kind, + "id": req.Id, + }, + }) + err = wxApiService.SetBlackList(req.Appid, 1, string(listStr)) + if err != nil { + e.OutErr(c, e.ERR, err.Error()) + return + } + e.OutSuc(c, "success", nil) + return +} + +// AppletDelBlackList +// @Summary 删除屏蔽的广告主 +// @Tags 设置中心-小程序设置-屏蔽规则 +// @Description 小程序设置-屏蔽规则-删除屏蔽的广告主 +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Accept json +// @Produce json +// @Param args body md.AppletDelBlackListReq true "请求参数" +// @Success 200 {string} "success" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/setCenter/basic/applet/shieldRules/delBlackList [POST] +func AppletDelBlackList(c *gin.Context) { + var req md.AppletDelBlackListReq + err := c.ShouldBindJSON(&req) + if err != nil { + err = validate.HandleValidateErr(err) + err1 := err.(e.E) + e.OutErr(c, err1.Code, err1.Error()) + return + } + + masterId := svc.GetMasterId(c) + + 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 + } + listStr, _ := json.Marshal([]interface{}{ + map[string]interface{}{ + "type": req.Kind, + "id": req.Id, + }, + }) + err = wxApiService.SetBlackList(req.Appid, 2, string(listStr)) + if err != nil { + e.OutErr(c, e.ERR, err.Error()) + return + } + e.OutSuc(c, "success", nil) + return +} + +// AppletGetAmsCategoryBlackList +// @Summary 获取行业屏蔽信息 +// @Tags 设置中心-小程序设置-屏蔽规则 +// @Description 小程序设置-屏蔽规则-获取行业屏蔽信息 +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Accept json +// @Produce json +// @Param args body md.AppletGetAmsCategoryBlackListReq true "请求参数" +// @Success 200 {object} md.AppletGetAmsCategoryBlackListResp +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/setCenter/basic/applet/shieldRules/getAmsCategoryBlackList [POST] +func AppletGetAmsCategoryBlackList(c *gin.Context) { + var req md.AppletGetAmsCategoryBlackListReq + err := c.ShouldBindJSON(&req) + if err != nil { + err = validate.HandleValidateErr(err) + err1 := err.(e.E) + e.OutErr(c, err1.Code, err1.Error()) + return + } + + masterId := svc.GetMasterId(c) + + 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 + } + var data md2.GetAmsCategoryBlackListResp + err, data = wxApiService.GetAmsCategoryBlackList(req.Appid) + if err != nil { + e.OutErr(c, e.ERR, err.Error()) + return + } + + var resp md.AppletGetAmsCategoryBlackListResp + amsCategoryArr := strings.Split(data.AmsCategory, "|") + for _, v := range amsCategoryArr { + resp.CheckedAmsCategory = append(resp.CheckedAmsCategory, struct { + Value string `json:"value" example:"行业标识符"` + Name string `json:"name" example:"行业名称"` + }{ + Value: v, + Name: enum.AmsCategory.String(enum.AmsCategory(v)), + }) + } + resp.AllAmsCategory = []struct { + Value string `json:"value" example:"行业标识符"` + Name string `json:"name" example:"行业名称"` + }{ + { + Value: enum.AmsCategoryForChess, + Name: enum.AmsCategory.String(enum.AmsCategoryForChess), + }, + { + Value: enum.AmsCategoryForAdultSupplies, + Name: enum.AmsCategory.String(enum.AmsCategoryForAdultSupplies), + }, + { + Value: enum.AmsCategoryForMEDICALHEALTH, + Name: enum.AmsCategory.String(enum.AmsCategoryForMEDICALHEALTH), + }, + { + Value: enum.AmsCategoryForINSURANCE, + Name: enum.AmsCategory.String(enum.AmsCategoryForINSURANCE), + }, + { + Value: enum.AmsCategoryForSECURITES, + Name: enum.AmsCategory.String(enum.AmsCategoryForSECURITES), + }, + { + Value: enum.AmsCategoryForLOAN, + Name: enum.AmsCategory.String(enum.AmsCategoryForLOAN), + }, + { + Value: enum.AmsCategoryForLIVINGSERVICESBEAUTY, + Name: enum.AmsCategory.String(enum.AmsCategoryForLIVINGSERVICESBEAUTY), + }, + { + Value: enum.AmsCategoryForLIVINGSERVICESENTERTAINMENT, + Name: enum.AmsCategory.String(enum.AmsCategoryForLIVINGSERVICESENTERTAINMENT), + }, + { + Value: enum.AmsCategoryForLIVINGSERVICESOTHERS, + Name: enum.AmsCategory.String(enum.AmsCategoryForLIVINGSERVICESOTHERS), + }, + { + Value: enum.AmsCategoryForFOODINDUSTRY, + Name: enum.AmsCategory.String(enum.AmsCategoryForFOODINDUSTRY), + }, + { + Value: enum.AmsCategoryForRETAILANDGENERALMERCHANDISE, + Name: enum.AmsCategory.String(enum.AmsCategoryForRETAILANDGENERALMERCHANDISE), + }, + { + Value: enum.AmsCategoryForFOODANDDRINK, + Name: enum.AmsCategory.String(enum.AmsCategoryForFOODANDDRINK), + }, + { + Value: enum.AmsCategoryForTECHNICALSERVICE, + Name: enum.AmsCategory.String(enum.AmsCategoryForTECHNICALSERVICE), + }, + } + + e.OutSuc(c, resp, nil) + return +} + +// AppletSetAmsCategoryBlackList +// @Summary 设置行业屏蔽信息 +// @Tags 设置中心-小程序设置-屏蔽规则 +// @Description 小程序设置-屏蔽规则-设置行业屏蔽信息 +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Accept json +// @Produce json +// @Param args body md.AppletSetAmsCategoryBlackListReq true "请求参数" +// @Success 200 {string} "success" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/setCenter/basic/applet/shieldRules/setAmsCategoryBlackList [POST] +func AppletSetAmsCategoryBlackList(c *gin.Context) { + var req md.AppletSetAmsCategoryBlackListReq + err := c.ShouldBindJSON(&req) + if err != nil { + err = validate.HandleValidateErr(err) + err1 := err.(e.E) + e.OutErr(c, err1.Code, err1.Error()) + return + } + + masterId := svc.GetMasterId(c) + + 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 + } + + amsCategory := strings.Join(req.CheckedAmsCategory, "|") + err = wxApiService.SetAmsCategoryBlackList(req.Appid, amsCategory) + if err != nil { + e.OutErr(c, e.ERR, err.Error()) + return + } + e.OutSuc(c, "success", nil) + return +} diff --git a/app/lib/wechat/md/wechat_api_md.go b/app/lib/wechat/md/wechat_api_md.go index d4b7411..d9cf50a 100644 --- a/app/lib/wechat/md/wechat_api_md.go +++ b/app/lib/wechat/md/wechat_api_md.go @@ -83,3 +83,44 @@ type GetAdposDetail struct { } `json:"list"` TotalNum int `json:"total_num" example:"请求返回总数"` } + +type AgencySetBlackListResp struct { + Ret int `json:"ret"` // 错误码 + ErrMsg string `json:"err_msg" example:"错误信息"` +} + +type AgencyGetBlackListResp struct { + Ret int `json:"ret"` // 错误码 + ErrMsg string `json:"err_msg" example:"错误信息"` + BlacklistBiz []struct { + Id string `json:"id" example:"屏蔽公众号微信号"` + Name string `json:"name" example:"屏蔽公众号名称"` + Url string `json:"url" example:"屏蔽公众号头像URL"` + } `json:"blacklist_biz"` // 屏蔽公众号列表 + BlacklistWeapp []struct { + Id string `json:"id" example:"屏蔽小程序/小游戏原始ID"` + Name string `json:"name" example:"屏蔽小程序/小游戏名称"` + Url string `json:"url" example:"屏蔽小程序/小游戏头像URL"` + } `json:"blacklist_weapp"` // 屏蔽小程序/小游戏列表 + BlacklistIos []struct { + Id string `json:"id" example:"屏蔽IOS应用的APPID"` + Name string `json:"name" example:"屏蔽IOS应用名称"` + Url string `json:"url" example:"屏蔽IOS应用标识图片"` + } `json:"blacklist_ios"` // 屏蔽IOS应用列表 + BlacklistAndroid []struct { + Id string `json:"id" example:"屏蔽安卓应用的应用宝包名"` + Name string `json:"name" example:"屏蔽安卓应用的名称"` + Url string `json:"url" example:"屏蔽安卓应用标识图片"` + } `json:"blacklist_android"` // 屏蔽安卓应用列表 +} + +type SetAmsCategoryBlackListResp struct { + Ret int `json:"ret" example:"错误码"` + ErrMsg string `json:"err_msg" example:"错误信息"` +} + +type GetAmsCategoryBlackListResp struct { + Ret int `json:"ret" example:"错误码"` + ErrMsg string `json:"err_msg" example:"错误信息"` + AmsCategory string `json:"ams_category" example:"屏蔽的行业类别"` +} diff --git a/app/lib/wechat/wechat_api.go b/app/lib/wechat/wechat_api.go index 6e79ebf..a704640 100644 --- a/app/lib/wechat/wechat_api.go +++ b/app/lib/wechat/wechat_api.go @@ -27,12 +27,15 @@ func NewWxApiService(masterId, componentAppid, componentAppsecret string) (wxApi wxApiService.ComponentAppsecret = componentAppsecret wxApiService.Host = "http://super.advertisement.dengbiao.top" if cfg.Prd { - wxApiService.Host = "http://www.baidu.com" + wxApiService.Host = "http://ad.zhios.cn" } cacheKey := fmt.Sprintf(md.MasterComponentVerifyTicket, wxApiService.MasterId) cacheComponentVerifyTicket, _ := cache.GetString(cacheKey) if cacheComponentVerifyTicket == "" { - return wxApiService, errors.New("微信验证票据ticket未获取到") + if !cfg.Local { + return wxApiService, errors.New("微信验证票据ticket未获取到") + } + cacheComponentVerifyTicket = "ticket@@@5zpNCmCMQuTwW6SK65tKlbGvbdahQfkFvxL7KZwh8iO_bywglIDFqB_lemyXZ2zC5LK0sFVJ4ZWlbGtiwUpIzA" } wxApiService.ComponentVerifyTicket = cacheComponentVerifyTicket return @@ -94,7 +97,7 @@ func (wxApiService *WxApiService) GetAuth(appId string) (cacheApiAuthorizerToken return } - //获取/刷新接口调用令牌 + // 获取/刷新接口调用令牌 componentAccessToken, err := wxApiService.GetComponentAccessToken() if err != nil { return @@ -352,3 +355,110 @@ func (wxApiService *WxApiService) GetAdposDetail(appId string, page, pageSize in } return } + +/* +SetBlackList 设置屏蔽的广告主 (op number 是 1:设置屏蔽 2:删除屏蔽) +*/ +func (wxApiService *WxApiService) SetBlackList(appId string, op int, list string) (err error) { // set方法 + apiAuthorizerToken, err := wxApiService.GetAuth(appId) + if err != nil { + return + } + url := "https://api.weixin.qq.com/wxa/operationams?action=agency_set_black_list&access_token=" + apiAuthorizerToken + params := map[string]interface{}{ + "op": op, + "list": list, + } + fmt.Println(utils.SerializeStr(params)) + postBody, err := utils.CurlPost(url, utils.SerializeStr(params), nil) + if err != nil { + return + } + + var resp md.AgencySetBlackListResp + err = json.Unmarshal(postBody, &resp) + if err != nil { + return + } + if resp.Ret != 0 { + err = errors.New(resp.ErrMsg) + } + return +} + +/* +GetBlackList 获取屏蔽的广告主 +*/ +func (wxApiService *WxApiService) GetBlackList(appId string) (err error, resp md.AgencyGetBlackListResp) { // set方法 + apiAuthorizerToken, err := wxApiService.GetAuth(appId) + if err != nil { + return + } + url := "https://api.weixin.qq.com/wxa/operationams?action=agency_get_black_list&access_token=" + apiAuthorizerToken + postBody, err := utils.CurlPost(url, "", nil) + if err != nil { + return + } + + err = json.Unmarshal(postBody, &resp) + if err != nil { + return + } + if resp.Ret != 0 { + err = errors.New(resp.ErrMsg) + } + return +} + +/* +SetAmsCategoryBlackList 设置行业屏蔽信息 +*/ +func (wxApiService *WxApiService) SetAmsCategoryBlackList(appId string, amsCategory string) (err error) { // set方法 + apiAuthorizerToken, err := wxApiService.GetAuth(appId) + if err != nil { + return + } + url := "https://api.weixin.qq.com/wxa/operationams?action=agency_set_mp_amscategory_blacklist&access_token=" + apiAuthorizerToken + params := map[string]interface{}{ + "ams_category": amsCategory, + } + fmt.Println(utils.SerializeStr(params)) + postBody, err := utils.CurlPost(url, utils.SerializeStr(params), nil) + if err != nil { + return + } + + var resp md.SetAmsCategoryBlackListResp + err = json.Unmarshal(postBody, &resp) + if err != nil { + return + } + if resp.Ret != 0 { + err = errors.New(resp.ErrMsg) + } + return +} + +/* +GetAmsCategoryBlackList 获取行业屏蔽信息 +*/ +func (wxApiService *WxApiService) GetAmsCategoryBlackList(appId string) (err error, resp md.GetAmsCategoryBlackListResp) { // set方法 + apiAuthorizerToken, err := wxApiService.GetAuth(appId) + if err != nil { + return + } + url := "https://api.weixin.qq.com/wxa/operationams?action=agency_get_mp_amscategory_blacklist&access_token=" + apiAuthorizerToken + postBody, err := utils.CurlPost(url, "", nil) + if err != nil { + return + } + + err = json.Unmarshal(postBody, &resp) + if err != nil { + return + } + if resp.Ret != 0 { + err = errors.New(resp.ErrMsg) + } + return +} diff --git a/app/md/md_set_center.go b/app/md/md_set_center.go index 58174dc..39bf0e6 100644 --- a/app/md/md_set_center.go +++ b/app/md/md_set_center.go @@ -8,8 +8,8 @@ type SetOssReq struct { FileBucket string `json:"file_bucket" binding:"required" example:"对象存储bucket(空间)"` } type SetOssResp struct { - Data SetOssReq `json:"data"` //数据内容 - QiNiuBucketRegionList []QiNiuBucketRegion `json:"qi_niu_bucket_region_list"` //七牛云存储区域列表 + Data SetOssReq `json:"data"` // 数据内容 + QiNiuBucketRegionList []QiNiuBucketRegion `json:"qi_niu_bucket_region_list"` // 七牛云存储区域列表 } type WxOpenSetReq struct { @@ -53,12 +53,46 @@ type SetMobReq struct { MobAppSecret string `json:"mob_app_secret"` } type SetMobResp struct { - Data SetMobReq `json:"data"` //数据内容 + Data SetMobReq `json:"data"` // 数据内容 } type SetLogoReq struct { MediumLogo string `json:"medium_logo"` AgentLogo string `json:"agent_logo"` } type SetLogoResp struct { - Data SetLogoReq `json:"data"` //数据内容 + Data SetLogoReq `json:"data"` // 数据内容 +} +type AppletGetBlackListReq struct { + Appid string `json:"appid" binding:"required" example:"授权小程序appid"` +} +type AppletAddBlackListReq struct { + Appid string `json:"appid" binding:"required" example:"授权小程序appid"` + Kind int `json:"Kind" binding:"required"` // 类型(1:公众号 2:IOS应用 3:安卓应用 4:小程序/小游戏) + Id string `json:"id" binding:"required" example:"微信公众号id | IOS应用APPID | 安卓应用的应用宝包名 | 小程序/小游戏原始ID"` +} + +type AppletDelBlackListReq struct { + Appid string `json:"appid" binding:"required" example:"授权小程序appid"` + Kind int `json:"Kind" binding:"required"` // 类型(1:公众号 2:IOS应用 3:安卓应用 4:小程序/小游戏) + Id string `json:"id" binding:"required" example:"微信公众号id | IOS应用APPID | 安卓应用的应用宝包名 | 小程序/小游戏原始ID"` +} + +type AppletGetAmsCategoryBlackListReq struct { + Appid string `json:"appid" binding:"required" example:"授权小程序appid"` +} + +type AppletGetAmsCategoryBlackListResp struct { + CheckedAmsCategory []struct { + Value string `json:"value" example:"行业标识符"` + Name string `json:"name" example:"行业名称"` + } `json:"checked_ams_category"` // 选中的行业列表 + AllAmsCategory []struct { + Value string `json:"value" example:"行业标识符"` + Name string `json:"name" example:"行业名称"` + } `json:"ams_category"` // 行业列表 +} + +type AppletSetAmsCategoryBlackListReq struct { + Appid string `json:"appid" binding:"required" example:"授权小程序appid"` + CheckedAmsCategory []string `json:"checked_ams_category"` // 选中的行业列表 } diff --git a/app/router/router.go b/app/router/router.go index 711cfd8..7fd121b 100644 --- a/app/router/router.go +++ b/app/router/router.go @@ -18,10 +18,10 @@ func Init() *gin.Engine { mode = "debug" } gin.SetMode(mode) - //创建一个新的启动器 + // 创建一个新的启动器 r := gin.New() r.GET("/api/swagger/*any", func(c *gin.Context) { - //r.Use(mw.SwagAuth()) + // r.Use(mw.SwagAuth()) ginSwagger.DisablingWrapHandler(swaggerFiles.Handler, "SWAGGER")(c) }) @@ -33,7 +33,7 @@ func Init() *gin.Engine { } r.Use(gin.Recovery()) // r.Use(mw.Limiter) - //r.LoadHTMLGlob("static/html/*") + // r.LoadHTMLGlob("static/html/*") r.GET("/favicon.ico", func(c *gin.Context) { c.Status(204) @@ -51,73 +51,75 @@ func Init() *gin.Engine { func route(r *gin.RouterGroup) { r.GET("/test", hdl.Demo) + r.GET("/getAuthToken", hdl.GetAuthToken) + r.GET("/authorize", hdl.AppletAuthorize) - r.POST("/qiniuyun/callback", hdl.FileImgCallback) //七牛云回调 + r.POST("/qiniuyun/callback", hdl.FileImgCallback) // 七牛云回调 r.Use(mw.DB) // 以下接口需要用到数据库 { r.POST("/login", hdl.Login) } - r.Use(mw.CheckBody) //body参数转换 - r.Use(mw.CheckSign) //签名校验 - r.POST("/qiniuyun/upload", hdl.ImgReqUpload) //七牛云上传 + r.Use(mw.CheckBody) // body参数转换 + r.Use(mw.CheckSign) // 签名校验 + r.POST("/qiniuyun/upload", hdl.ImgReqUpload) // 七牛云上传 r.POST("/registerForMedium", hdl.RegisterForMedium) r.POST("/registerForAgent", hdl.RegisterForAgent) r.Use(mw.Auth) // 以下接口需要JWT验证 - rRole(r.Group("/role")) //权限管理 - rQualification(r.Group("/qualification")) //资质认证公共数据 - rAgentQualification(r.Group("/agentQualification")) //渠道-资质 - rMediumQualification(r.Group("/mediumQualification")) //媒体-资质 - rSetCenter(r.Group("/setCenter")) //设置中心 - rMedium(r.Group("/mediumCenter")) //媒体中心 - rDivisionStrategy(r.Group("/divisionStrategy")) //分成策略 - rDataCenter(r.Group("/dataCenter")) //数据中心 - rSettleCenter(r.Group("/settleCenter")) //结算中心 - rFinanceCenter(r.Group("/financeCenter")) //财务中心 - rIndex(r.Group("/index")) //首页 - rFinancialDynamics(r.Group("/financialDynamics")) //资产动态 + rRole(r.Group("/role")) // 权限管理 + rQualification(r.Group("/qualification")) // 资质认证公共数据 + rAgentQualification(r.Group("/agentQualification")) // 渠道-资质 + rMediumQualification(r.Group("/mediumQualification")) // 媒体-资质 + rSetCenter(r.Group("/setCenter")) // 设置中心 + rMedium(r.Group("/mediumCenter")) // 媒体中心 + rDivisionStrategy(r.Group("/divisionStrategy")) // 分成策略 + rDataCenter(r.Group("/dataCenter")) // 数据中心 + rSettleCenter(r.Group("/settleCenter")) // 结算中心 + rFinanceCenter(r.Group("/financeCenter")) // 财务中心 + rIndex(r.Group("/index")) // 首页 + rFinancialDynamics(r.Group("/financialDynamics")) // 资产动态 } func rIndex(r *gin.RouterGroup) { - r.GET("/base", hdl.Base) //首页-基本信息 - r.GET("/total", hdl.IndexTotal) //首页-统计数据 - r.POST("/app/list", hdl.IndexAppList) //首页-应用数据 - r.POST("/app/list/table", hdl.IndexAppListTable) //首页-应用数据-每个应用的折线图 + r.GET("/base", hdl.Base) // 首页-基本信息 + r.GET("/total", hdl.IndexTotal) // 首页-统计数据 + r.POST("/app/list", hdl.IndexAppList) // 首页-应用数据 + r.POST("/app/list/table", hdl.IndexAppListTable) // 首页-应用数据-每个应用的折线图 } func rRole(r *gin.RouterGroup) { - r.GET("/roleList", hdl.RoleList) //角色列表 - r.POST("/addRole", hdl.AddRole) //角色添加 - r.POST("/roleBindPermissionGroup", hdl.RoleBindPermissionGroup) //角色绑定权限组 - r.POST("/updateRoleState", hdl.UpdateRoleState) //修改角色状态 - r.POST("/updateRole", hdl.UpdateRole) //修改角色状态 - r.DELETE("/deleteRole/:id", hdl.DeleteRole) //删除角色 - r.GET("/permissionGroupList", hdl.PermissionGroupList) //权限组列表 - r.POST("/adminList", hdl.AdminList) //管理员列表 - r.POST("/updateAdminState", hdl.UpdateAdminState) //修改管理员状态 - r.POST("/updateAdmin", hdl.UpdateAdmin) //修改管理员信息 - r.POST("/addAdmin", hdl.AddAdmin) //新增管理员 - r.DELETE("/deleteAdmin/:adm_id", hdl.DeleteAdmin) //删除管理员 - r.GET("/adminInfo", hdl.AdminInfo) //获取管理员信息 - r.POST("/bindAdminRole", hdl.BindAdminRole) //绑定角色 + r.GET("/roleList", hdl.RoleList) // 角色列表 + r.POST("/addRole", hdl.AddRole) // 角色添加 + r.POST("/roleBindPermissionGroup", hdl.RoleBindPermissionGroup) // 角色绑定权限组 + r.POST("/updateRoleState", hdl.UpdateRoleState) // 修改角色状态 + r.POST("/updateRole", hdl.UpdateRole) // 修改角色状态 + r.DELETE("/deleteRole/:id", hdl.DeleteRole) // 删除角色 + r.GET("/permissionGroupList", hdl.PermissionGroupList) // 权限组列表 + r.POST("/adminList", hdl.AdminList) // 管理员列表 + r.POST("/updateAdminState", hdl.UpdateAdminState) // 修改管理员状态 + r.POST("/updateAdmin", hdl.UpdateAdmin) // 修改管理员信息 + r.POST("/addAdmin", hdl.AddAdmin) // 新增管理员 + r.DELETE("/deleteAdmin/:adm_id", hdl.DeleteAdmin) // 删除管理员 + r.GET("/adminInfo", hdl.AdminInfo) // 获取管理员信息 + r.POST("/bindAdminRole", hdl.BindAdminRole) // 绑定角色 } func rQualification(r *gin.RouterGroup) { - r.GET("/select/base", hdl.QualificationSelectBase) //资质认证-认证选择内容 + r.GET("/select/base", hdl.QualificationSelectBase) // 资质认证-认证选择内容 } func rAgentQualification(r *gin.RouterGroup) { - r.POST("/enterprise", hdl.AgentQualificationEnterprise) //企业主体资质 - r.POST("/enterprise/audit", hdl.AgentQualificationEnterpriseAudit) //企业主体资质审核 - r.POST("/bank", hdl.AgentQualificationBank) //银行资质 - r.POST("/bank/audit", hdl.AgentQualificationBankAudit) //银行审核 - r.POST("/contact", hdl.AgentQualificationContactInfo) //联系方式 - r.POST("/contact/audit", hdl.AgentQualificationContactInfoAudit) //联系方式 + r.POST("/enterprise", hdl.AgentQualificationEnterprise) // 企业主体资质 + r.POST("/enterprise/audit", hdl.AgentQualificationEnterpriseAudit) // 企业主体资质审核 + r.POST("/bank", hdl.AgentQualificationBank) // 银行资质 + r.POST("/bank/audit", hdl.AgentQualificationBankAudit) // 银行审核 + r.POST("/contact", hdl.AgentQualificationContactInfo) // 联系方式 + r.POST("/contact/audit", hdl.AgentQualificationContactInfoAudit) // 联系方式 } func rMediumQualification(r *gin.RouterGroup) { - r.POST("/enterprise", hdl.MediumQualificationEnterprise) //企业主体资质 - r.POST("/enterprise/audit", hdl.MediumQualificationEnterpriseAudit) //企业主体资质审核 - r.POST("/bank", hdl.MediumQualificationBank) //银行资质 - r.POST("/bank/audit", hdl.MediumQualificationBankAudit) //银行审核 - r.POST("/contact", hdl.MediumQualificationContactInfo) //联系方式 - r.POST("/contact/audit", hdl.MediumQualificationContactInfoAudit) //联系方式 + r.POST("/enterprise", hdl.MediumQualificationEnterprise) // 企业主体资质 + r.POST("/enterprise/audit", hdl.MediumQualificationEnterpriseAudit) // 企业主体资质审核 + r.POST("/bank", hdl.MediumQualificationBank) // 银行资质 + r.POST("/bank/audit", hdl.MediumQualificationBankAudit) // 银行审核 + r.POST("/contact", hdl.MediumQualificationContactInfo) // 联系方式 + r.POST("/contact/audit", hdl.MediumQualificationContactInfoAudit) // 联系方式 } func rSetCenter(r *gin.RouterGroup) { rBasicSetCenter := r.Group("/basic") @@ -139,6 +141,14 @@ func rSetCenter(r *gin.RouterGroup) { rAppletSetCenter.DELETE("/delete/:id", hdl.AppletDelete) rAppletSetCenter.GET("/authorize", hdl.AppletAuthorize) rAppletSetCenter.GET("/unauthorized", hdl.AppletUnauthorized) + rAppletShieldRules := r.Group("/shieldRules") + { + rAppletShieldRules.POST("/getBlackList", hdl.AppletGetBlackList) + rAppletShieldRules.POST("/addBlackList", hdl.AppletAddBlackList) + rAppletShieldRules.POST("/delBlackList", hdl.AppletDelBlackList) + rAppletShieldRules.POST("/getAmsCategoryBlackList", hdl.AppletGetAmsCategoryBlackList) + rAppletShieldRules.POST("/setAmsCategoryBlackList", hdl.AppletSetAmsCategoryBlackList) + } } rShareSetCenter := r.Group("/share") { @@ -147,82 +157,82 @@ func rSetCenter(r *gin.RouterGroup) { } func rMedium(r *gin.RouterGroup) { - r.POST("/applet/application/medium/list", hdl.AppletApplicationMediumList) //应用管理-媒体列表 - r.POST("/applet/application/list", hdl.AppletApplicationList) //小程序应用-列表数据 - r.POST("/applet/application/audit", hdl.AppletApplicationAudit) //小程序应用-审核 + r.POST("/applet/application/medium/list", hdl.AppletApplicationMediumList) // 应用管理-媒体列表 + r.POST("/applet/application/list", hdl.AppletApplicationList) // 小程序应用-列表数据 + r.POST("/applet/application/audit", hdl.AppletApplicationAudit) // 小程序应用-审核 - r.POST("/applet/application/ad/space/medium/list", hdl.AppletApplicationAdSpaceMediumList) //广告管理-媒体列表 - r.POST("/applet/application/ad/space/list", hdl.AppletApplicationAdSpaceList) //小程序应用-广告位列表数据 - r.POST("/applet/application/ad/space/audit", hdl.AppletApplicationAdSpaceAudit) //小程序应用-广告位审核 + r.POST("/applet/application/ad/space/medium/list", hdl.AppletApplicationAdSpaceMediumList) // 广告管理-媒体列表 + r.POST("/applet/application/ad/space/list", hdl.AppletApplicationAdSpaceList) // 小程序应用-广告位列表数据 + r.POST("/applet/application/ad/space/audit", hdl.AppletApplicationAdSpaceAudit) // 小程序应用-广告位审核 - r.POST("/medium/list", hdl.MediumList) //媒体列表 - r.POST("/medium/bind/agent/list", hdl.MediumBindAgentList) //媒体绑定代理列表 - r.POST("/medium/bind/agent/save", hdl.MediumBindAgentSave) //媒体绑定代理操作 - r.POST("/medium/bind/agent/del", hdl.MediumBindAgentDel) //媒体绑定代理删除 + r.POST("/medium/list", hdl.MediumList) // 媒体列表 + r.POST("/medium/bind/agent/list", hdl.MediumBindAgentList) // 媒体绑定代理列表 + r.POST("/medium/bind/agent/save", hdl.MediumBindAgentSave) // 媒体绑定代理操作 + r.POST("/medium/bind/agent/del", hdl.MediumBindAgentDel) // 媒体绑定代理删除 - r.POST("/agent/list", hdl.AgentList) //代理列表 - r.POST("/agent/bind/medium/list", hdl.AgentBindMediumList) //代理绑定媒体列表 + r.POST("/agent/list", hdl.AgentList) // 代理列表 + 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) //分成策略-保存 + 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.GET("/original/data/more/application/state", hdl.OriginalDataMoreApplicationState) //数据中心-原始数据-一键导入操作后的完成状态 - r.GET("/original/data/one/application", hdl.OriginalDataOneApplication) //数据中心-原始数据-单个导入应用列表 - r.POST("/original/data/one/application/ad/list", hdl.OriginalDataOneApplicationAdList) //数据中心-原始数据-单个导入应用-广告位列表 - r.POST("/original/data/one/application/total", hdl.OriginalDataOneApplicationTotal) //数据中心-原始数据-单个应用数据统计 - r.POST("/original/data/one/application/doing", hdl.OriginalDataOneApplicationDoing) //数据中心-原始数据-单个应用数据操作 - r.GET("/original/data/one/application/state", hdl.OriginalDataOneApplicationState) //数据中心-原始数据-单个应用数据操作后的完成状态 - - r.POST("/generate/data/list", hdl.GenerateDataList) //数据中心-分成数据 - r.POST("/generate/data/del", hdl.GenerateDataDel) //数据中心-分成数据-删除 - r.POST("/generate/data/detail", hdl.GenerateDataDetail) //数据中心-分成数据-详情 - r.POST("/generate/data/doing", hdl.GenerateDataDoing) //数据中心-分成数据-报表生成操作 - r.POST("/income/data/list", hdl.IncomeDataList) //数据中心-收益报表 - r.POST("/income/data/detail", hdl.IncomeDataDetail) //数据中心-收益报表-详情 + 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.GET("/original/data/more/application/state", hdl.OriginalDataMoreApplicationState) // 数据中心-原始数据-一键导入操作后的完成状态 + r.GET("/original/data/one/application", hdl.OriginalDataOneApplication) // 数据中心-原始数据-单个导入应用列表 + r.POST("/original/data/one/application/ad/list", hdl.OriginalDataOneApplicationAdList) // 数据中心-原始数据-单个导入应用-广告位列表 + r.POST("/original/data/one/application/total", hdl.OriginalDataOneApplicationTotal) // 数据中心-原始数据-单个应用数据统计 + r.POST("/original/data/one/application/doing", hdl.OriginalDataOneApplicationDoing) // 数据中心-原始数据-单个应用数据操作 + r.GET("/original/data/one/application/state", hdl.OriginalDataOneApplicationState) // 数据中心-原始数据-单个应用数据操作后的完成状态 + + r.POST("/generate/data/list", hdl.GenerateDataList) // 数据中心-分成数据 + r.POST("/generate/data/del", hdl.GenerateDataDel) // 数据中心-分成数据-删除 + r.POST("/generate/data/detail", hdl.GenerateDataDetail) // 数据中心-分成数据-详情 + r.POST("/generate/data/doing", hdl.GenerateDataDoing) // 数据中心-分成数据-报表生成操作 + r.POST("/income/data/list", hdl.IncomeDataList) // 数据中心-收益报表 + r.POST("/income/data/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("/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) //结算中心-代理结算详情 + 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) //财务中心-媒体详情-确认支付 - - r.POST("/platform/list", hdl.FinanceCenterPlatformList) //财务中心-平台报表 - - r.POST("/agent/list", hdl.FinanceCenterAgentList) //财务中心-代理列表 - r.POST("/agent/detail", hdl.FinanceCenterAgentDetail) //财务中心-代理详情 - r.POST("/agent/settle/file/save", hdl.FinanceCenterAgentSettleFileSave) //财务中心-代理详情-结算单上传 - r.POST("/agent/invoice/save", hdl.FinanceCenterAgentInvoiceSave) //财务中心-代理详情-发票审核 - r.POST("/agent/other/income/save", hdl.FinanceCenterAgentOtherIncomeSave) //财务中心-代理详情-其他收益调整 - r.POST("/agent/pay/save", hdl.FinanceCenterAgentPaySave) //财务中心-代理详情-确认支付 + 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) // 财务中心-媒体详情-确认支付 + + r.POST("/platform/list", hdl.FinanceCenterPlatformList) // 财务中心-平台报表 + + r.POST("/agent/list", hdl.FinanceCenterAgentList) // 财务中心-代理列表 + r.POST("/agent/detail", hdl.FinanceCenterAgentDetail) // 财务中心-代理详情 + r.POST("/agent/settle/file/save", hdl.FinanceCenterAgentSettleFileSave) // 财务中心-代理详情-结算单上传 + r.POST("/agent/invoice/save", hdl.FinanceCenterAgentInvoiceSave) // 财务中心-代理详情-发票审核 + r.POST("/agent/other/income/save", hdl.FinanceCenterAgentOtherIncomeSave) // 财务中心-代理详情-其他收益调整 + r.POST("/agent/pay/save", hdl.FinanceCenterAgentPaySave) // 财务中心-代理详情-确认支付 } func rFinancialDynamics(r *gin.RouterGroup) { - r.POST("/medium/total", hdl.FinancialDynamicsMediumTotal) //资产动态-媒体预付统计 - r.POST("/medium/list", hdl.FinancialDynamicsMediumList) //资产动态-媒体预付 - r.POST("/medium/save", hdl.FinancialDynamicsMediumSave) //资产动态-媒体预付创建 + r.POST("/medium/total", hdl.FinancialDynamicsMediumTotal) // 资产动态-媒体预付统计 + r.POST("/medium/list", hdl.FinancialDynamicsMediumList) // 资产动态-媒体预付 + r.POST("/medium/save", hdl.FinancialDynamicsMediumSave) // 资产动态-媒体预付创建 - r.POST("/agent/total", hdl.FinancialDynamicsAgentTotal) //资产动态-代理预付统计 - r.POST("/agent/list", hdl.FinancialDynamicsAgentList) //资产动态-代理预付 - r.POST("/agent/save", hdl.FinancialDynamicsAgentSave) //资产动态-代理预付创建 + r.POST("/agent/total", hdl.FinancialDynamicsAgentTotal) // 资产动态-代理预付统计 + r.POST("/agent/list", hdl.FinancialDynamicsAgentList) // 资产动态-代理预付 + r.POST("/agent/save", hdl.FinancialDynamicsAgentSave) // 资产动态-代理预付创建 } diff --git a/docs/docs.go b/docs/docs.go index c485883..c5ad3e1 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -2207,6 +2207,53 @@ const docTemplate = `{ } } }, + "/api/index/app/list/table": { + "post": { + "description": "首页-应用数据-每个应用的折线图", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "首页------嘉俊" + ], + "summary": "应用数据-每个应用的折线图", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "请求参数", + "name": "args", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.IndexAppListTableReq" + } + } + ], + "responses": { + "200": { + "description": "具体看返回内容 ", + "schema": { + "type": "string" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, "/api/index/base": { "get": { "description": "首页-右上角基本数据", @@ -4132,6 +4179,279 @@ const docTemplate = `{ } } }, + "/api/setCenter/basic/applet/shieldRules/addBlackList": { + "post": { + "description": "小程序设置-屏蔽规则-添加屏蔽的广告主", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "设置中心-小程序设置-屏蔽规则" + ], + "summary": "添加屏蔽的广告主", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "请求参数", + "name": "args", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.AppletAddBlackListReq" + } + } + ], + "responses": { + "200": { + "description": "success", + "schema": { + "type": "string" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, + "/api/setCenter/basic/applet/shieldRules/delBlackList": { + "post": { + "description": "小程序设置-屏蔽规则-删除屏蔽的广告主", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "设置中心-小程序设置-屏蔽规则" + ], + "summary": "删除屏蔽的广告主", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "请求参数", + "name": "args", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.AppletDelBlackListReq" + } + } + ], + "responses": { + "200": { + "description": "success", + "schema": { + "type": "string" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, + "/api/setCenter/basic/applet/shieldRules/getAmsCategoryBlackList": { + "post": { + "description": "小程序设置-屏蔽规则-获取行业屏蔽信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "设置中心-小程序设置-屏蔽规则" + ], + "summary": "获取行业屏蔽信息", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "请求参数", + "name": "args", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.AppletGetAmsCategoryBlackListReq" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/md.AppletGetAmsCategoryBlackListResp" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, + "/api/setCenter/basic/applet/shieldRules/getBlackList": { + "post": { + "description": "小程序设置-屏蔽规则-获取屏蔽的广告主", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "设置中心-小程序设置-屏蔽规则" + ], + "summary": "获取屏蔽的广告主", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "请求参数", + "name": "args", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.AppletGetBlackListReq" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/md.AgencyGetBlackListResp" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, + "/api/setCenter/basic/applet/shieldRules/setAmsCategoryBlackList": { + "post": { + "description": "小程序设置-屏蔽规则-设置行业屏蔽信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "设置中心-小程序设置-屏蔽规则" + ], + "summary": "设置行业屏蔽信息", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "请求参数", + "name": "args", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.AppletSetAmsCategoryBlackListReq" + } + } + ], + "responses": { + "200": { + "description": "success", + "schema": { + "type": "string" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, + "/api/setCenter/basic/getLogo": { + "get": { + "description": "基础设置-logo获取", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "设置中心-基础设置" + ], + "summary": "logo获取", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/md.SetLogoResp" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, "/api/setCenter/basic/getMob": { "get": { "description": "基础设置-mob获取", @@ -4208,6 +4528,53 @@ const docTemplate = `{ } } }, + "/api/setCenter/basic/setLogo": { + "post": { + "description": "基础设置-logo设置", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "设置中心-基础设置" + ], + "summary": "logo设置", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "请求参数", + "name": "args", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.SetLogoReq" + } + } + ], + "responses": { + "200": { + "description": "success", + "schema": { + "type": "string" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, "/api/setCenter/basic/setMob": { "post": { "description": "基础设置-mob设置", @@ -4877,6 +5244,103 @@ const docTemplate = `{ } } }, + "md.AgencyGetBlackListResp": { + "type": "object", + "properties": { + "blacklist_android": { + "description": "屏蔽安卓应用列表", + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "example": "屏蔽安卓应用的应用宝包名" + }, + "name": { + "type": "string", + "example": "屏蔽安卓应用的名称" + }, + "url": { + "type": "string", + "example": "屏蔽安卓应用标识图片" + } + } + } + }, + "blacklist_biz": { + "description": "屏蔽公众号列表", + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "example": "屏蔽公众号微信号" + }, + "name": { + "type": "string", + "example": "屏蔽公众号名称" + }, + "url": { + "type": "string", + "example": "屏蔽公众号头像URL" + } + } + } + }, + "blacklist_ios": { + "description": "屏蔽IOS应用列表", + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "example": "屏蔽IOS应用的APPID" + }, + "name": { + "type": "string", + "example": "屏蔽IOS应用名称" + }, + "url": { + "type": "string", + "example": "屏蔽IOS应用标识图片" + } + } + } + }, + "blacklist_weapp": { + "description": "屏蔽小程序/小游戏列表", + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "example": "屏蔽小程序/小游戏原始ID" + }, + "name": { + "type": "string", + "example": "屏蔽小程序/小游戏名称" + }, + "url": { + "type": "string", + "example": "屏蔽小程序/小游戏头像URL" + } + } + } + }, + "err_msg": { + "type": "string", + "example": "错误信息" + }, + "ret": { + "description": "错误码", + "type": "integer" + } + } + }, "md.AgentQualificationBankData": { "type": "object", "properties": { @@ -5189,6 +5653,28 @@ const docTemplate = `{ } } }, + "md.AppletAddBlackListReq": { + "type": "object", + "required": [ + "Kind", + "appid", + "id" + ], + "properties": { + "Kind": { + "description": "类型(1:公众号 2:IOS应用 3:安卓应用 4:小程序/小游戏)", + "type": "integer" + }, + "appid": { + "type": "string", + "example": "授权小程序appid" + }, + "id": { + "type": "string", + "example": "微信公众号id | IOS应用APPID | 安卓应用的应用宝包名 | 小程序/小游戏原始ID" + } + } + }, "md.AppletAddReq": { "type": "object", "required": [ @@ -5592,6 +6078,110 @@ const docTemplate = `{ } } }, + "md.AppletDelBlackListReq": { + "type": "object", + "required": [ + "Kind", + "appid", + "id" + ], + "properties": { + "Kind": { + "description": "类型(1:公众号 2:IOS应用 3:安卓应用 4:小程序/小游戏)", + "type": "integer" + }, + "appid": { + "type": "string", + "example": "授权小程序appid" + }, + "id": { + "type": "string", + "example": "微信公众号id | IOS应用APPID | 安卓应用的应用宝包名 | 小程序/小游戏原始ID" + } + } + }, + "md.AppletGetAmsCategoryBlackListReq": { + "type": "object", + "required": [ + "appid" + ], + "properties": { + "appid": { + "type": "string", + "example": "授权小程序appid" + } + } + }, + "md.AppletGetAmsCategoryBlackListResp": { + "type": "object", + "properties": { + "ams_category": { + "description": "行业列表", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "example": "行业名称" + }, + "value": { + "type": "string", + "example": "行业标识符" + } + } + } + }, + "checked_ams_category": { + "description": "选中的行业列表", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "example": "行业名称" + }, + "value": { + "type": "string", + "example": "行业标识符" + } + } + } + } + } + }, + "md.AppletGetBlackListReq": { + "type": "object", + "required": [ + "appid" + ], + "properties": { + "appid": { + "type": "string", + "example": "授权小程序appid" + } + } + }, + "md.AppletSetAmsCategoryBlackListReq": { + "type": "object", + "required": [ + "appid" + ], + "properties": { + "appid": { + "type": "string", + "example": "授权小程序appid" + }, + "checked_ams_category": { + "description": "选中的行业列表", + "type": "array", + "items": { + "type": "string" + } + } + } + }, "md.AppletUpdateReq": { "type": "object", "required": [ @@ -7321,6 +7911,12 @@ const docTemplate = `{ "md.IndexAppListRes": { "type": "object", "properties": { + "app_id": { + "type": "array", + "items": { + "type": "string" + } + }, "list": { "type": "array", "items": { @@ -7335,6 +7931,25 @@ const docTemplate = `{ } } }, + "md.IndexAppListTableReq": { + "type": "object", + "properties": { + "app_id": { + "type": "array", + "items": { + "type": "string" + } + }, + "end_date": { + "type": "string", + "example": "2024-08-30" + }, + "start_date": { + "type": "string", + "example": "2024-08-30" + } + } + }, "md.Invoice": { "type": "object", "properties": { @@ -7987,6 +8602,30 @@ const docTemplate = `{ } } }, + "md.SetLogoReq": { + "type": "object", + "properties": { + "agent_logo": { + "type": "string" + }, + "medium_logo": { + "type": "string" + } + } + }, + "md.SetLogoResp": { + "type": "object", + "properties": { + "data": { + "description": "数据内容", + "allOf": [ + { + "$ref": "#/definitions/md.SetLogoReq" + } + ] + } + } + }, "md.SetMobReq": { "type": "object", "properties": { diff --git a/docs/swagger.json b/docs/swagger.json index 50d2362..6f6858e 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -2199,6 +2199,53 @@ } } }, + "/api/index/app/list/table": { + "post": { + "description": "首页-应用数据-每个应用的折线图", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "首页------嘉俊" + ], + "summary": "应用数据-每个应用的折线图", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "请求参数", + "name": "args", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.IndexAppListTableReq" + } + } + ], + "responses": { + "200": { + "description": "具体看返回内容 ", + "schema": { + "type": "string" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, "/api/index/base": { "get": { "description": "首页-右上角基本数据", @@ -4124,6 +4171,279 @@ } } }, + "/api/setCenter/basic/applet/shieldRules/addBlackList": { + "post": { + "description": "小程序设置-屏蔽规则-添加屏蔽的广告主", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "设置中心-小程序设置-屏蔽规则" + ], + "summary": "添加屏蔽的广告主", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "请求参数", + "name": "args", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.AppletAddBlackListReq" + } + } + ], + "responses": { + "200": { + "description": "success", + "schema": { + "type": "string" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, + "/api/setCenter/basic/applet/shieldRules/delBlackList": { + "post": { + "description": "小程序设置-屏蔽规则-删除屏蔽的广告主", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "设置中心-小程序设置-屏蔽规则" + ], + "summary": "删除屏蔽的广告主", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "请求参数", + "name": "args", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.AppletDelBlackListReq" + } + } + ], + "responses": { + "200": { + "description": "success", + "schema": { + "type": "string" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, + "/api/setCenter/basic/applet/shieldRules/getAmsCategoryBlackList": { + "post": { + "description": "小程序设置-屏蔽规则-获取行业屏蔽信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "设置中心-小程序设置-屏蔽规则" + ], + "summary": "获取行业屏蔽信息", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "请求参数", + "name": "args", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.AppletGetAmsCategoryBlackListReq" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/md.AppletGetAmsCategoryBlackListResp" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, + "/api/setCenter/basic/applet/shieldRules/getBlackList": { + "post": { + "description": "小程序设置-屏蔽规则-获取屏蔽的广告主", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "设置中心-小程序设置-屏蔽规则" + ], + "summary": "获取屏蔽的广告主", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "请求参数", + "name": "args", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.AppletGetBlackListReq" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/md.AgencyGetBlackListResp" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, + "/api/setCenter/basic/applet/shieldRules/setAmsCategoryBlackList": { + "post": { + "description": "小程序设置-屏蔽规则-设置行业屏蔽信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "设置中心-小程序设置-屏蔽规则" + ], + "summary": "设置行业屏蔽信息", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "请求参数", + "name": "args", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.AppletSetAmsCategoryBlackListReq" + } + } + ], + "responses": { + "200": { + "description": "success", + "schema": { + "type": "string" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, + "/api/setCenter/basic/getLogo": { + "get": { + "description": "基础设置-logo获取", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "设置中心-基础设置" + ], + "summary": "logo获取", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/md.SetLogoResp" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, "/api/setCenter/basic/getMob": { "get": { "description": "基础设置-mob获取", @@ -4200,6 +4520,53 @@ } } }, + "/api/setCenter/basic/setLogo": { + "post": { + "description": "基础设置-logo设置", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "设置中心-基础设置" + ], + "summary": "logo设置", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "请求参数", + "name": "args", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.SetLogoReq" + } + } + ], + "responses": { + "200": { + "description": "success", + "schema": { + "type": "string" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, "/api/setCenter/basic/setMob": { "post": { "description": "基础设置-mob设置", @@ -4869,6 +5236,103 @@ } } }, + "md.AgencyGetBlackListResp": { + "type": "object", + "properties": { + "blacklist_android": { + "description": "屏蔽安卓应用列表", + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "example": "屏蔽安卓应用的应用宝包名" + }, + "name": { + "type": "string", + "example": "屏蔽安卓应用的名称" + }, + "url": { + "type": "string", + "example": "屏蔽安卓应用标识图片" + } + } + } + }, + "blacklist_biz": { + "description": "屏蔽公众号列表", + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "example": "屏蔽公众号微信号" + }, + "name": { + "type": "string", + "example": "屏蔽公众号名称" + }, + "url": { + "type": "string", + "example": "屏蔽公众号头像URL" + } + } + } + }, + "blacklist_ios": { + "description": "屏蔽IOS应用列表", + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "example": "屏蔽IOS应用的APPID" + }, + "name": { + "type": "string", + "example": "屏蔽IOS应用名称" + }, + "url": { + "type": "string", + "example": "屏蔽IOS应用标识图片" + } + } + } + }, + "blacklist_weapp": { + "description": "屏蔽小程序/小游戏列表", + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "example": "屏蔽小程序/小游戏原始ID" + }, + "name": { + "type": "string", + "example": "屏蔽小程序/小游戏名称" + }, + "url": { + "type": "string", + "example": "屏蔽小程序/小游戏头像URL" + } + } + } + }, + "err_msg": { + "type": "string", + "example": "错误信息" + }, + "ret": { + "description": "错误码", + "type": "integer" + } + } + }, "md.AgentQualificationBankData": { "type": "object", "properties": { @@ -5181,6 +5645,28 @@ } } }, + "md.AppletAddBlackListReq": { + "type": "object", + "required": [ + "Kind", + "appid", + "id" + ], + "properties": { + "Kind": { + "description": "类型(1:公众号 2:IOS应用 3:安卓应用 4:小程序/小游戏)", + "type": "integer" + }, + "appid": { + "type": "string", + "example": "授权小程序appid" + }, + "id": { + "type": "string", + "example": "微信公众号id | IOS应用APPID | 安卓应用的应用宝包名 | 小程序/小游戏原始ID" + } + } + }, "md.AppletAddReq": { "type": "object", "required": [ @@ -5584,6 +6070,110 @@ } } }, + "md.AppletDelBlackListReq": { + "type": "object", + "required": [ + "Kind", + "appid", + "id" + ], + "properties": { + "Kind": { + "description": "类型(1:公众号 2:IOS应用 3:安卓应用 4:小程序/小游戏)", + "type": "integer" + }, + "appid": { + "type": "string", + "example": "授权小程序appid" + }, + "id": { + "type": "string", + "example": "微信公众号id | IOS应用APPID | 安卓应用的应用宝包名 | 小程序/小游戏原始ID" + } + } + }, + "md.AppletGetAmsCategoryBlackListReq": { + "type": "object", + "required": [ + "appid" + ], + "properties": { + "appid": { + "type": "string", + "example": "授权小程序appid" + } + } + }, + "md.AppletGetAmsCategoryBlackListResp": { + "type": "object", + "properties": { + "ams_category": { + "description": "行业列表", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "example": "行业名称" + }, + "value": { + "type": "string", + "example": "行业标识符" + } + } + } + }, + "checked_ams_category": { + "description": "选中的行业列表", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "example": "行业名称" + }, + "value": { + "type": "string", + "example": "行业标识符" + } + } + } + } + } + }, + "md.AppletGetBlackListReq": { + "type": "object", + "required": [ + "appid" + ], + "properties": { + "appid": { + "type": "string", + "example": "授权小程序appid" + } + } + }, + "md.AppletSetAmsCategoryBlackListReq": { + "type": "object", + "required": [ + "appid" + ], + "properties": { + "appid": { + "type": "string", + "example": "授权小程序appid" + }, + "checked_ams_category": { + "description": "选中的行业列表", + "type": "array", + "items": { + "type": "string" + } + } + } + }, "md.AppletUpdateReq": { "type": "object", "required": [ @@ -7313,6 +7903,12 @@ "md.IndexAppListRes": { "type": "object", "properties": { + "app_id": { + "type": "array", + "items": { + "type": "string" + } + }, "list": { "type": "array", "items": { @@ -7327,6 +7923,25 @@ } } }, + "md.IndexAppListTableReq": { + "type": "object", + "properties": { + "app_id": { + "type": "array", + "items": { + "type": "string" + } + }, + "end_date": { + "type": "string", + "example": "2024-08-30" + }, + "start_date": { + "type": "string", + "example": "2024-08-30" + } + } + }, "md.Invoice": { "type": "object", "properties": { @@ -7979,6 +8594,30 @@ } } }, + "md.SetLogoReq": { + "type": "object", + "properties": { + "agent_logo": { + "type": "string" + }, + "medium_logo": { + "type": "string" + } + } + }, + "md.SetLogoResp": { + "type": "object", + "properties": { + "data": { + "description": "数据内容", + "allOf": [ + { + "$ref": "#/definitions/md.SetLogoReq" + } + ] + } + } + }, "md.SetMobReq": { "type": "object", "properties": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 2820907..fc72bd0 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -55,6 +55,75 @@ definitions: username: type: string type: object + md.AgencyGetBlackListResp: + properties: + blacklist_android: + description: 屏蔽安卓应用列表 + items: + properties: + id: + example: 屏蔽安卓应用的应用宝包名 + type: string + name: + example: 屏蔽安卓应用的名称 + type: string + url: + example: 屏蔽安卓应用标识图片 + type: string + type: object + type: array + blacklist_biz: + description: 屏蔽公众号列表 + items: + properties: + id: + example: 屏蔽公众号微信号 + type: string + name: + example: 屏蔽公众号名称 + type: string + url: + example: 屏蔽公众号头像URL + type: string + type: object + type: array + blacklist_ios: + description: 屏蔽IOS应用列表 + items: + properties: + id: + example: 屏蔽IOS应用的APPID + type: string + name: + example: 屏蔽IOS应用名称 + type: string + url: + example: 屏蔽IOS应用标识图片 + type: string + type: object + type: array + blacklist_weapp: + description: 屏蔽小程序/小游戏列表 + items: + properties: + id: + example: 屏蔽小程序/小游戏原始ID + type: string + name: + example: 屏蔽小程序/小游戏名称 + type: string + url: + example: 屏蔽小程序/小游戏头像URL + type: string + type: object + type: array + err_msg: + example: 错误信息 + type: string + ret: + description: 错误码 + type: integer + type: object md.AgentQualificationBankData: properties: account: @@ -276,6 +345,22 @@ definitions: $ref: '#/definitions/md.SelectData' type: array type: object + md.AppletAddBlackListReq: + properties: + Kind: + description: 类型(1:公众号 2:IOS应用 3:安卓应用 4:小程序/小游戏) + type: integer + appid: + example: 授权小程序appid + type: string + id: + example: 微信公众号id | IOS应用APPID | 安卓应用的应用宝包名 | 小程序/小游戏原始ID + type: string + required: + - Kind + - appid + - id + type: object md.AppletAddReq: properties: appid: @@ -558,6 +643,78 @@ definitions: example: 审核状态 type: string type: object + md.AppletDelBlackListReq: + properties: + Kind: + description: 类型(1:公众号 2:IOS应用 3:安卓应用 4:小程序/小游戏) + type: integer + appid: + example: 授权小程序appid + type: string + id: + example: 微信公众号id | IOS应用APPID | 安卓应用的应用宝包名 | 小程序/小游戏原始ID + type: string + required: + - Kind + - appid + - id + type: object + md.AppletGetAmsCategoryBlackListReq: + properties: + appid: + example: 授权小程序appid + type: string + required: + - appid + type: object + md.AppletGetAmsCategoryBlackListResp: + properties: + ams_category: + description: 行业列表 + items: + properties: + name: + example: 行业名称 + type: string + value: + example: 行业标识符 + type: string + type: object + type: array + checked_ams_category: + description: 选中的行业列表 + items: + properties: + name: + example: 行业名称 + type: string + value: + example: 行业标识符 + type: string + type: object + type: array + type: object + md.AppletGetBlackListReq: + properties: + appid: + example: 授权小程序appid + type: string + required: + - appid + type: object + md.AppletSetAmsCategoryBlackListReq: + properties: + appid: + example: 授权小程序appid + type: string + checked_ams_category: + description: 选中的行业列表 + items: + type: string + type: array + required: + - appid + type: object md.AppletUpdateReq: properties: id: @@ -1763,6 +1920,10 @@ definitions: type: object md.IndexAppListRes: properties: + app_id: + items: + type: string + type: array list: items: $ref: '#/definitions/md.IndexAppListData' @@ -1772,6 +1933,19 @@ definitions: $ref: '#/definitions/md.SelectData' type: array type: object + md.IndexAppListTableReq: + properties: + app_id: + items: + type: string + type: array + end_date: + example: "2024-08-30" + type: string + start_date: + example: "2024-08-30" + type: string + type: object md.Invoice: properties: count: @@ -2228,6 +2402,20 @@ definitions: example: 值 type: string type: object + md.SetLogoReq: + properties: + agent_logo: + type: string + medium_logo: + type: string + type: object + md.SetLogoResp: + properties: + data: + allOf: + - $ref: '#/definitions/md.SetLogoReq' + description: 数据内容 + type: object md.SetMobReq: properties: mob_app_key: @@ -3954,6 +4142,37 @@ paths: summary: 应用数据 tags: - 首页------嘉俊 + /api/index/app/list/table: + post: + consumes: + - application/json + description: 首页-应用数据-每个应用的折线图 + parameters: + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization + required: true + type: string + - description: 请求参数 + in: body + name: args + required: true + schema: + $ref: '#/definitions/md.IndexAppListTableReq' + produces: + - application/json + responses: + "200": + description: '具体看返回内容 ' + schema: + type: string + "400": + description: 具体错误 + schema: + $ref: '#/definitions/md.Response' + summary: 应用数据-每个应用的折线图 + tags: + - 首页------嘉俊 /api/index/base: get: consumes: @@ -5222,6 +5441,186 @@ paths: summary: 更新 tags: - 设置中心-小程序设置 + /api/setCenter/basic/applet/shieldRules/addBlackList: + post: + consumes: + - application/json + description: 小程序设置-屏蔽规则-添加屏蔽的广告主 + parameters: + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization + required: true + type: string + - description: 请求参数 + in: body + name: args + required: true + schema: + $ref: '#/definitions/md.AppletAddBlackListReq' + produces: + - application/json + responses: + "200": + description: success + schema: + type: string + "400": + description: 具体错误 + schema: + $ref: '#/definitions/md.Response' + summary: 添加屏蔽的广告主 + tags: + - 设置中心-小程序设置-屏蔽规则 + /api/setCenter/basic/applet/shieldRules/delBlackList: + post: + consumes: + - application/json + description: 小程序设置-屏蔽规则-删除屏蔽的广告主 + parameters: + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization + required: true + type: string + - description: 请求参数 + in: body + name: args + required: true + schema: + $ref: '#/definitions/md.AppletDelBlackListReq' + produces: + - application/json + responses: + "200": + description: success + schema: + type: string + "400": + description: 具体错误 + schema: + $ref: '#/definitions/md.Response' + summary: 删除屏蔽的广告主 + tags: + - 设置中心-小程序设置-屏蔽规则 + /api/setCenter/basic/applet/shieldRules/getAmsCategoryBlackList: + post: + consumes: + - application/json + description: 小程序设置-屏蔽规则-获取行业屏蔽信息 + parameters: + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization + required: true + type: string + - description: 请求参数 + in: body + name: args + required: true + schema: + $ref: '#/definitions/md.AppletGetAmsCategoryBlackListReq' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/md.AppletGetAmsCategoryBlackListResp' + "400": + description: 具体错误 + schema: + $ref: '#/definitions/md.Response' + summary: 获取行业屏蔽信息 + tags: + - 设置中心-小程序设置-屏蔽规则 + /api/setCenter/basic/applet/shieldRules/getBlackList: + post: + consumes: + - application/json + description: 小程序设置-屏蔽规则-获取屏蔽的广告主 + parameters: + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization + required: true + type: string + - description: 请求参数 + in: body + name: args + required: true + schema: + $ref: '#/definitions/md.AppletGetBlackListReq' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/md.AgencyGetBlackListResp' + "400": + description: 具体错误 + schema: + $ref: '#/definitions/md.Response' + summary: 获取屏蔽的广告主 + tags: + - 设置中心-小程序设置-屏蔽规则 + /api/setCenter/basic/applet/shieldRules/setAmsCategoryBlackList: + post: + consumes: + - application/json + description: 小程序设置-屏蔽规则-设置行业屏蔽信息 + parameters: + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization + required: true + type: string + - description: 请求参数 + in: body + name: args + required: true + schema: + $ref: '#/definitions/md.AppletSetAmsCategoryBlackListReq' + produces: + - application/json + responses: + "200": + description: success + schema: + type: string + "400": + description: 具体错误 + schema: + $ref: '#/definitions/md.Response' + summary: 设置行业屏蔽信息 + tags: + - 设置中心-小程序设置-屏蔽规则 + /api/setCenter/basic/getLogo: + get: + consumes: + - application/json + description: 基础设置-logo获取 + parameters: + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/md.SetLogoResp' + "400": + description: 具体错误 + schema: + $ref: '#/definitions/md.Response' + summary: logo获取 + tags: + - 设置中心-基础设置 /api/setCenter/basic/getMob: get: consumes: @@ -5272,6 +5671,37 @@ paths: summary: oss获取 tags: - 设置中心-基础设置 + /api/setCenter/basic/setLogo: + post: + consumes: + - application/json + description: 基础设置-logo设置 + parameters: + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization + required: true + type: string + - description: 请求参数 + in: body + name: args + required: true + schema: + $ref: '#/definitions/md.SetLogoReq' + produces: + - application/json + responses: + "200": + description: success + schema: + type: string + "400": + description: 具体错误 + schema: + $ref: '#/definitions/md.Response' + summary: logo设置 + tags: + - 设置中心-基础设置 /api/setCenter/basic/setMob: post: consumes: diff --git a/etc/cfg.yml b/etc/cfg.yml index 039085b..a457b4e 100644 --- a/etc/cfg.yml +++ b/etc/cfg.yml @@ -9,11 +9,22 @@ srv_addr: ':1002' redis_addr: '120.24.28.6:32572' # 连接官网数据库获取db mapping +#db: +# host: '119.23.182.117:3306' +# name: 'super_advertisement' +# user: 'root' +# psw: 'Fnuo123com@' +# show_log: true +# max_lifetime: 30 +# max_open_conns: 100 +# max_idle_conns: 100 +# path: 'tmp/%s.log' + db: - host: '119.23.182.117:3306' + host: 'advertisement-db.rwlb.rds.aliyuncs.com:3306' name: 'super_advertisement' - user: 'root' - psw: 'Fnuo123com@' + user: 'zhios' + psw: 'ZHIoscnfnuo123@' show_log: true max_lifetime: 30 max_open_conns: 100