github.com/chanxuehong/wechat@v0.0.0-20230222024006-36f0325263cd/mp/shakearound/statistics/page.go (about) 1 package statistics 2 3 import ( 4 "github.com/chanxuehong/wechat/mp/core" 5 ) 6 7 // 以页面为维度的数据统计接口 8 func Page(clt *core.Client, pageId, beginDate, endDate int64) (data []StatisticsBase, err error) { 9 request := struct { 10 PageId int64 `json:"page_id"` 11 BeginDate int64 `json:"begin_date"` 12 EndDate int64 `json:"end_date"` 13 }{ 14 PageId: pageId, 15 BeginDate: beginDate, 16 EndDate: endDate, 17 } 18 19 var result struct { 20 core.Error 21 Data []StatisticsBase `json:"data"` 22 } 23 24 incompleteURL := "https://api.weixin.qq.com/shakearound/statistics/page?access_token=" 25 if err = clt.PostJSON(incompleteURL, &request, &result); err != nil { 26 return 27 } 28 29 if result.ErrCode != core.ErrCodeOK { 30 err = &result.Error 31 return 32 } 33 data = result.Data 34 return 35 }