package hdl import ( "applet/app/e" "applet/app/lib/wechat" "applet/app/svc" "applet/app/utils" 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 } 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 }