parent
ae619cea50
commit
a69753f990
@ -0,0 +1,57 @@
|
|||||||
|
package wechatopen
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"github.com/dtapps/go-library/utils/gojson"
|
||||||
|
"github.com/dtapps/go-library/utils/gorequest"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
type DataCubeGetWeAnAlySisAppidDailySummaryTrendResponse struct {
|
||||||
|
List []struct {
|
||||||
|
RefDate string `json:"ref_date"`
|
||||||
|
VisitTotal int `json:"visit_total"`
|
||||||
|
SharePv int `json:"share_pv"`
|
||||||
|
ShareUv int `json:"share_uv"`
|
||||||
|
} `json:"list"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type DataCubeGetWeAnAlySisAppidDailySummaryTrendResult struct {
|
||||||
|
Result DataCubeGetWeAnAlySisAppidDailySummaryTrendResponse // 结果
|
||||||
|
Body []byte // 内容
|
||||||
|
Http gorequest.Response // 请求
|
||||||
|
}
|
||||||
|
|
||||||
|
func newDataCubeGetWeAnAlySisAppidDailySummaryTrendResult(result DataCubeGetWeAnAlySisAppidDailySummaryTrendResponse, body []byte, http gorequest.Response) *DataCubeGetWeAnAlySisAppidDailySummaryTrendResult {
|
||||||
|
return &DataCubeGetWeAnAlySisAppidDailySummaryTrendResult{Result: result, Body: body, Http: http}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DataCubeGetWeAnAlySisAppidDailySummaryTrend 获取用户访问小程序数据概况
|
||||||
|
// https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/data-analysis/others/getDailySummary.html
|
||||||
|
func (c *Client) DataCubeGetWeAnAlySisAppidDailySummaryTrend(ctx context.Context, beginDate, endDate string) (*DataCubeGetWeAnAlySisAppidDailySummaryTrendResult, error) {
|
||||||
|
// 检查
|
||||||
|
err := c.checkComponentIsConfig()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
err = c.checkAuthorizerIsConfig()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
// 参数
|
||||||
|
params := gorequest.NewParams()
|
||||||
|
params.Set("begin_date", beginDate)
|
||||||
|
params.Set("end_date", endDate)
|
||||||
|
// 请求
|
||||||
|
request, err := c.request(ctx, apiUrl+"/datacube/getweanalysisappiddailysummarytrend?access_token="+c.GetAuthorizerAccessToken(ctx), params, http.MethodPost)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
// 定义
|
||||||
|
var response DataCubeGetWeAnAlySisAppidDailySummaryTrendResponse
|
||||||
|
err = gojson.Unmarshal(request.ResponseBody, &response)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return newDataCubeGetWeAnAlySisAppidDailySummaryTrendResult(response, request.ResponseBody, request), nil
|
||||||
|
}
|
@ -0,0 +1,114 @@
|
|||||||
|
package wechatopen
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"github.com/dtapps/go-library/utils/gojson"
|
||||||
|
"github.com/dtapps/go-library/utils/gorequest"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
type DataCubeGetWeAnAlySisAppidUserPortraitResponse struct {
|
||||||
|
RefDate string `json:"ref_date"` // 时间范围
|
||||||
|
VisitUvNew struct {
|
||||||
|
Province []struct {
|
||||||
|
Id int `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Value int `json:"value"`
|
||||||
|
} `json:"province"` // 分布类型
|
||||||
|
City []struct {
|
||||||
|
Id int `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Value int `json:"value"`
|
||||||
|
} `json:"city"` // 省份
|
||||||
|
Genders []struct {
|
||||||
|
Id int `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Value int `json:"value"`
|
||||||
|
} `json:"genders"` // 城市
|
||||||
|
Platforms []struct {
|
||||||
|
Id int `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Value int `json:"value"`
|
||||||
|
} `json:"platforms"` // 性别
|
||||||
|
Devices []struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Value int `json:"value"`
|
||||||
|
} `json:"devices"` // 终端类型
|
||||||
|
Ages []struct {
|
||||||
|
Id int `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Value int `json:"value"`
|
||||||
|
} `json:"ages"` // 年龄
|
||||||
|
} `json:"visit_uv_new"` // 新用户画像
|
||||||
|
VisitUv struct {
|
||||||
|
Province []struct {
|
||||||
|
Id int `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Value int `json:"value"`
|
||||||
|
} `json:"province"` // 分布类型
|
||||||
|
City []struct {
|
||||||
|
Id int `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Value int `json:"value"`
|
||||||
|
} `json:"city"` // 省份
|
||||||
|
Genders []struct {
|
||||||
|
Id int `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Value int `json:"value"`
|
||||||
|
} `json:"genders"` // 城市
|
||||||
|
Platforms []struct {
|
||||||
|
Id int `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Value int `json:"value"`
|
||||||
|
} `json:"platforms"` // 性别
|
||||||
|
Devices []struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Value int `json:"value"`
|
||||||
|
} `json:"devices"` // 终端类型
|
||||||
|
Ages []struct {
|
||||||
|
Id int `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Value int `json:"value"`
|
||||||
|
} `json:"ages"` // 年龄
|
||||||
|
} `json:"visit_uv"` // 活跃用户画像
|
||||||
|
}
|
||||||
|
|
||||||
|
type DataCubeGetWeAnAlySisAppidUserPortraitResult struct {
|
||||||
|
Result DataCubeGetWeAnAlySisAppidUserPortraitResponse // 结果
|
||||||
|
Body []byte // 内容
|
||||||
|
Http gorequest.Response // 请求
|
||||||
|
}
|
||||||
|
|
||||||
|
func newDataCubeGetWeAnAlySisAppidUserPortraitResult(result DataCubeGetWeAnAlySisAppidUserPortraitResponse, body []byte, http gorequest.Response) *DataCubeGetWeAnAlySisAppidUserPortraitResult {
|
||||||
|
return &DataCubeGetWeAnAlySisAppidUserPortraitResult{Result: result, Body: body, Http: http}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DataCubeGetWeAnAlySisAppidUserPortrait 获取小程序用户画像分布
|
||||||
|
// https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/data-analysis/others/getUserPortrait.html
|
||||||
|
func (c *Client) DataCubeGetWeAnAlySisAppidUserPortrait(ctx context.Context, beginDate, endDate string) (*DataCubeGetWeAnAlySisAppidUserPortraitResult, error) {
|
||||||
|
// 检查
|
||||||
|
err := c.checkComponentIsConfig()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
err = c.checkAuthorizerIsConfig()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
// 参数
|
||||||
|
params := gorequest.NewParams()
|
||||||
|
params.Set("begin_date", beginDate)
|
||||||
|
params.Set("end_date", endDate)
|
||||||
|
// 请求
|
||||||
|
request, err := c.request(ctx, apiUrl+"/datacube/getweanalysisappiduserportrait?access_token="+c.GetAuthorizerAccessToken(ctx), params, http.MethodPost)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
// 定义
|
||||||
|
var response DataCubeGetWeAnAlySisAppidUserPortraitResponse
|
||||||
|
err = gojson.Unmarshal(request.ResponseBody, &response)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return newDataCubeGetWeAnAlySisAppidUserPortraitResult(response, request.ResponseBody, request), nil
|
||||||
|
}
|
@ -0,0 +1,62 @@
|
|||||||
|
package wechatopen
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"github.com/dtapps/go-library/utils/gojson"
|
||||||
|
"github.com/dtapps/go-library/utils/gorequest"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
type DataCubeGetWeAnAlySisAppidVisitPageResponse struct {
|
||||||
|
RefDate string `json:"ref_date"`
|
||||||
|
List []struct {
|
||||||
|
PagePath string `json:"page_path"`
|
||||||
|
PageVisitPv int `json:"page_visit_pv"`
|
||||||
|
PageVisitUv int `json:"page_visit_uv"`
|
||||||
|
PageStaytimePv float64 `json:"page_staytime_pv"`
|
||||||
|
EntrypagePv int `json:"entrypage_pv"`
|
||||||
|
ExitpagePv int `json:"exitpage_pv"`
|
||||||
|
PageSharePv int `json:"page_share_pv"`
|
||||||
|
PageShareUv int `json:"page_share_uv"`
|
||||||
|
} `json:"list"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type DataCubeGetWeAnAlySisAppidVisitPageResult struct {
|
||||||
|
Result DataCubeGetWeAnAlySisAppidVisitPageResponse // 结果
|
||||||
|
Body []byte // 内容
|
||||||
|
Http gorequest.Response // 请求
|
||||||
|
}
|
||||||
|
|
||||||
|
func newDataCubeGetWeAnAlySisAppidVisitPageResult(result DataCubeGetWeAnAlySisAppidVisitPageResponse, body []byte, http gorequest.Response) *DataCubeGetWeAnAlySisAppidVisitPageResult {
|
||||||
|
return &DataCubeGetWeAnAlySisAppidVisitPageResult{Result: result, Body: body, Http: http}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DataCubeGetWeAnAlySisAppidVisitPage 获取访问页面数据
|
||||||
|
// https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/data-analysis/others/getVisitPage.html
|
||||||
|
func (c *Client) DataCubeGetWeAnAlySisAppidVisitPage(ctx context.Context, beginDate, endDate string) (*DataCubeGetWeAnAlySisAppidVisitPageResult, error) {
|
||||||
|
// 检查
|
||||||
|
err := c.checkComponentIsConfig()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
err = c.checkAuthorizerIsConfig()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
// 参数
|
||||||
|
params := gorequest.NewParams()
|
||||||
|
params.Set("begin_date", beginDate)
|
||||||
|
params.Set("end_date", endDate)
|
||||||
|
// 请求
|
||||||
|
request, err := c.request(ctx, apiUrl+"/datacube/getweanalysisappidvisitpage?access_token="+c.GetAuthorizerAccessToken(ctx), params, http.MethodPost)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
// 定义
|
||||||
|
var response DataCubeGetWeAnAlySisAppidVisitPageResponse
|
||||||
|
err = gojson.Unmarshal(request.ResponseBody, &response)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return newDataCubeGetWeAnAlySisAppidVisitPageResult(response, request.ResponseBody, request), nil
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
package wechatopen
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"github.com/dtapps/go-library/utils/gojson"
|
||||||
|
"github.com/dtapps/go-library/utils/gorequest"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
type DataCubeGetWeAnAlySisAppidWeeklyVisitTrendResponse struct {
|
||||||
|
List []struct {
|
||||||
|
RefDate string `json:"ref_date"`
|
||||||
|
SessionCnt int `json:"session_cnt"`
|
||||||
|
VisitPv int `json:"visit_pv"`
|
||||||
|
VisitUv int `json:"visit_uv"`
|
||||||
|
VisitUvNew int `json:"visit_uv_new"`
|
||||||
|
StayTimeSession float64 `json:"stay_time_session"`
|
||||||
|
VisitDepth float64 `json:"visit_depth"`
|
||||||
|
} `json:"list"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type DataCubeGetWeAnAlySisAppidWeeklyVisitTrendResult struct {
|
||||||
|
Result DataCubeGetWeAnAlySisAppidWeeklyVisitTrendResponse // 结果
|
||||||
|
Body []byte // 内容
|
||||||
|
Http gorequest.Response // 请求
|
||||||
|
}
|
||||||
|
|
||||||
|
func newDataCubeGetWeAnAlySisAppidWeeklyVisitTrendResult(result DataCubeGetWeAnAlySisAppidWeeklyVisitTrendResponse, body []byte, http gorequest.Response) *DataCubeGetWeAnAlySisAppidWeeklyVisitTrendResult {
|
||||||
|
return &DataCubeGetWeAnAlySisAppidWeeklyVisitTrendResult{Result: result, Body: body, Http: http}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DataCubeGetWeAnAlySisAppidWeeklyVisitTrend 获取用户访问小程序数据概况
|
||||||
|
// https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/data-analysis/visit-trend/getWeeklyVisitTrend.html
|
||||||
|
func (c *Client) DataCubeGetWeAnAlySisAppidWeeklyVisitTrend(ctx context.Context, beginDate, endDate string) (*DataCubeGetWeAnAlySisAppidWeeklyVisitTrendResult, error) {
|
||||||
|
// 检查
|
||||||
|
err := c.checkComponentIsConfig()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
err = c.checkAuthorizerIsConfig()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
// 参数
|
||||||
|
params := gorequest.NewParams()
|
||||||
|
params.Set("begin_date", beginDate)
|
||||||
|
params.Set("end_date", endDate)
|
||||||
|
// 请求
|
||||||
|
request, err := c.request(ctx, apiUrl+"/datacube/getweanalysisappidweeklyvisittrend?access_token="+c.GetAuthorizerAccessToken(ctx), params, http.MethodPost)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
// 定义
|
||||||
|
var response DataCubeGetWeAnAlySisAppidWeeklyVisitTrendResponse
|
||||||
|
err = gojson.Unmarshal(request.ResponseBody, &response)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return newDataCubeGetWeAnAlySisAppidWeeklyVisitTrendResult(response, request.ResponseBody, request), nil
|
||||||
|
}
|
Loading…
Reference in new issue