package hdl import ( "applet/app/e" "applet/app/lib/wechat" "applet/app/md" "applet/app/svc" "applet/app/utils" "code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit" db "code.fnuoos.com/zhimeng/model.git/src" "code.fnuoos.com/zhimeng/model.git/src/super/implement" "fmt" "github.com/gin-gonic/gin" ) func Demo(c *gin.Context) { for { mediumId := utils.GenerateUniqueRandomNumbers(8) fmt.Println(mediumId) } appId := c.DefaultQuery("app_id", "") masterId := svc.GetMasterId(c) adUnitId := c.DefaultQuery("adunit_id", "") //1、查找对应 user_wx_applet_list 记录 userWxAppletListDb := implement.NewUserWxAppletListDb(db.Db) 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 } 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) if err != nil { e.OutErr(c, e.ERR, err.Error()) return } err, args := wxApiService.GetAdposDetail(appId, 1, 10, "2024-08-19", "2024-08-23", adUnitId) if err != nil { e.OutErr(c, e.ERR, err.Error()) return } e.OutSuc(c, map[string]interface{}{ "args": args, }, nil) return }