广告平台(站长使用)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

hdl_demo.go 1.6 KiB

3 months ago
2 months ago
3 months ago
2 months ago
2 months ago
2 months ago
3 months ago
2 months ago
2 months ago
3 months ago
2 months ago
3 months ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package hdl
  2. import (
  3. "applet/app/e"
  4. "applet/app/lib/wechat"
  5. "applet/app/svc"
  6. "applet/app/utils"
  7. db "code.fnuoos.com/zhimeng/model.git/src"
  8. "code.fnuoos.com/zhimeng/model.git/src/super/implement"
  9. "fmt"
  10. "github.com/gin-gonic/gin"
  11. )
  12. func Demo(c *gin.Context) {
  13. for {
  14. mediumId := utils.GenerateUniqueRandomNumbers(8)
  15. fmt.Println(mediumId)
  16. }
  17. appId := c.DefaultQuery("app_id", "")
  18. masterId := svc.GetMasterId(c)
  19. adUnitId := c.DefaultQuery("adunit_id", "")
  20. //1、查找对应 user_wx_applet_list 记录
  21. userWxAppletListDb := implement.NewUserWxAppletListDb(db.Db)
  22. UserWxAppletList, err := userWxAppletListDb.GetUserWxAppletList(masterId)
  23. if err != nil {
  24. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  25. return
  26. }
  27. if UserWxAppletList == nil {
  28. e.OutErr(c, e.ERR_NO_DATA, "未查询到对应记录")
  29. return
  30. }
  31. wxOpenThirdPartyAppListDb := implement.NewWxOpenThirdPartyAppListDb(db.Db)
  32. wxOpenThirdPartyAppList, err := wxOpenThirdPartyAppListDb.GetWxOpenThirdPartyAppList(utils.StrToInt(masterId))
  33. if err != nil {
  34. e.OutErr(c, e.ERR, err.Error())
  35. return
  36. }
  37. if wxOpenThirdPartyAppList == nil {
  38. e.OutErr(c, e.ERR_NOT_FAN, "未查询到对应三方应用记录")
  39. return
  40. }
  41. wxApiService, err := wechat.NewWxApiService(masterId, wxOpenThirdPartyAppList.Appid, wxOpenThirdPartyAppList.AppSecret)
  42. if err != nil {
  43. e.OutErr(c, e.ERR, err.Error())
  44. return
  45. }
  46. err, args := wxApiService.GetAdposDetail(appId, 1, 10, "2024-08-19", "2024-08-23", adUnitId)
  47. if err != nil {
  48. e.OutErr(c, e.ERR, err.Error())
  49. return
  50. }
  51. e.OutSuc(c, map[string]interface{}{
  52. "args": args,
  53. }, nil)
  54. return
  55. }