github.com/chanxuehong/wechat@v0.0.0-20230222024006-36f0325263cd/mp/bizwifi/statistics/list.go (about) 1 package statistics 2 3 import ( 4 "github.com/chanxuehong/wechat/mp/core" 5 ) 6 7 type Statistics struct { 8 ShopId int64 `json:"shop_id"` // 门店ID,-1为总统计 9 StatisTime int64 `json:"statis_time"` // 统计时间,单位为毫秒 10 TotalUser int `json:"total_user"` // 微信连wifi成功人数 11 HomepageUV int `json:"homepage_uv"` // 商家主页访问人数 12 NewFans int `json:"new_fans"` // 新增公众号关注人数 13 TotalFans int `json:"total_fans"` // 累计公众号关注人数 14 } 15 16 // 数据统计 17 // 18 // shopId 按门店ID搜索,-1为总统计 19 // beginDate: 起始日期时间,格式yyyy-mm-dd,最长时间跨度为30天 20 // endDate: 结束日期时间戳,格式yyyy-mm-dd,最长时间跨度为30天 21 func List(clt *core.Client, shopId int64, beginDate, endDate string) (data []Statistics, err error) { 22 request := struct { 23 ShopId int64 `json:"shop_id"` 24 BeginDate string `json:"begin_date"` 25 EndDate string `json:"end_date"` 26 }{ 27 ShopId: shopId, 28 BeginDate: beginDate, 29 EndDate: endDate, 30 } 31 32 var result struct { 33 core.Error 34 Data []Statistics `json:"data"` 35 } 36 37 incompleteURL := "https://api.weixin.qq.com/bizwifi/statistics/list?access_token=" 38 if err = clt.PostJSON(incompleteURL, &request, &result); err != nil { 39 return 40 } 41 42 if result.ErrCode != core.ErrCodeOK { 43 err = &result.Error 44 return 45 } 46 47 data = result.Data 48 return 49 }