广告平台(站长使用)
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

hdl_demo.go 2.2 KiB

2 달 전
2 달 전
2 달 전
2 달 전
2 달 전
2 달 전
2 달 전
2 달 전
2 달 전
2 달 전
2 달 전
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. mediumId := utils.GenerateUniqueRandomNumbers(8)
  16. fmt.Println(mediumId)
  17. return
  18. appId := c.DefaultQuery("app_id", "")
  19. masterId := svc.GetMasterId(c)
  20. adUnitId := c.DefaultQuery("adunit_id", "")
  21. //1、查找对应 user_wx_applet_list 记录
  22. userWxAppletListDb := implement.NewUserWxAppletListDb(db.Db)
  23. UserWxAppletList, err := userWxAppletListDb.GetUserWxAppletList(masterId)
  24. if err != nil {
  25. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  26. return
  27. }
  28. if UserWxAppletList == nil {
  29. e.OutErr(c, e.ERR_NO_DATA, "未查询到对应记录")
  30. return
  31. }
  32. wxOpenThirdPartyAppListDb := implement.NewWxOpenThirdPartyAppListDb(db.Db)
  33. wxOpenThirdPartyAppList, err := wxOpenThirdPartyAppListDb.GetWxOpenThirdPartyAppList(utils.StrToInt(masterId))
  34. if err != nil {
  35. e.OutErr(c, e.ERR, err.Error())
  36. return
  37. }
  38. if wxOpenThirdPartyAppList == nil {
  39. e.OutErr(c, e.ERR_NOT_FAN, "未查询到对应三方应用记录")
  40. return
  41. }
  42. ch, err := rabbit.Cfg.Pool.GetChannel()
  43. if err != nil {
  44. return
  45. }
  46. defer ch.Release()
  47. var arg = md.ZhiosAdOriginalDataApplication{
  48. Mid: "123456",
  49. AppId: "123",
  50. AdId: "123",
  51. Date: "123",
  52. ComponentAppsecret: wxOpenThirdPartyAppList.AppSecret,
  53. ComponentAppid: wxOpenThirdPartyAppList.Appid,
  54. }
  55. err = ch.PublishV2(md.AdOriginalData, arg, md.AdOriginalDataApplication)
  56. if err != nil {
  57. ch.PublishV2(md.AdOriginalData, arg, md.AdOriginalDataApplication)
  58. }
  59. return
  60. wxApiService, err := wechat.NewWxApiService(masterId, wxOpenThirdPartyAppList.Appid, wxOpenThirdPartyAppList.AppSecret)
  61. if err != nil {
  62. e.OutErr(c, e.ERR, err.Error())
  63. return
  64. }
  65. err, args := wxApiService.GetAdposDetail(appId, 1, 10, "2024-08-19", "2024-08-23", adUnitId)
  66. if err != nil {
  67. e.OutErr(c, e.ERR, err.Error())
  68. return
  69. }
  70. e.OutSuc(c, map[string]interface{}{
  71. "args": args,
  72. }, nil)
  73. return
  74. }