广告平台(站长使用)
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 

80 rader
2.2 KiB

  1. package hdl
  2. import (
  3. "applet/app/e"
  4. "applet/app/lib/wechat"
  5. "applet/app/md"
  6. "applet/app/svc"
  7. "applet/app/utils"
  8. "code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit"
  9. db "code.fnuoos.com/zhimeng/model.git/src"
  10. "code.fnuoos.com/zhimeng/model.git/src/super/implement"
  11. "fmt"
  12. "github.com/gin-gonic/gin"
  13. )
  14. func Demo(c *gin.Context) {
  15. for {
  16. mediumId := utils.GenerateUniqueRandomNumbers(8)
  17. fmt.Println(mediumId)
  18. }
  19. appId := c.DefaultQuery("app_id", "")
  20. masterId := svc.GetMasterId(c)
  21. adUnitId := c.DefaultQuery("adunit_id", "")
  22. //1、查找对应 user_wx_applet_list 记录
  23. userWxAppletListDb := implement.NewUserWxAppletListDb(db.Db)
  24. UserWxAppletList, err := userWxAppletListDb.GetUserWxAppletList(masterId)
  25. if err != nil {
  26. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  27. return
  28. }
  29. if UserWxAppletList == nil {
  30. e.OutErr(c, e.ERR_NO_DATA, "未查询到对应记录")
  31. return
  32. }
  33. wxOpenThirdPartyAppListDb := implement.NewWxOpenThirdPartyAppListDb(db.Db)
  34. wxOpenThirdPartyAppList, err := wxOpenThirdPartyAppListDb.GetWxOpenThirdPartyAppList(utils.StrToInt(masterId))
  35. if err != nil {
  36. e.OutErr(c, e.ERR, err.Error())
  37. return
  38. }
  39. if wxOpenThirdPartyAppList == nil {
  40. e.OutErr(c, e.ERR_NOT_FAN, "未查询到对应三方应用记录")
  41. return
  42. }
  43. ch, err := rabbit.Cfg.Pool.GetChannel()
  44. if err != nil {
  45. return
  46. }
  47. defer ch.Release()
  48. var arg = md.ZhiosAdOriginalDataApplication{
  49. Mid: "123456",
  50. AppId: "123",
  51. AdId: "123",
  52. Date: "123",
  53. ComponentAppsecret: wxOpenThirdPartyAppList.AppSecret,
  54. ComponentAppid: wxOpenThirdPartyAppList.Appid,
  55. }
  56. err = ch.PublishV2(md.AdOriginalData, arg, md.AdOriginalDataApplication)
  57. if err != nil {
  58. ch.PublishV2(md.AdOriginalData, arg, md.AdOriginalDataApplication)
  59. }
  60. return
  61. wxApiService, err := wechat.NewWxApiService(masterId, wxOpenThirdPartyAppList.Appid, wxOpenThirdPartyAppList.AppSecret)
  62. if err != nil {
  63. e.OutErr(c, e.ERR, err.Error())
  64. return
  65. }
  66. err, args := wxApiService.GetAdposDetail(appId, 1, 10, "2024-08-19", "2024-08-23", adUnitId)
  67. if err != nil {
  68. e.OutErr(c, e.ERR, err.Error())
  69. return
  70. }
  71. e.OutSuc(c, map[string]interface{}{
  72. "args": args,
  73. }, nil)
  74. return
  75. }