Skip to content

Commit a9a08ad

Browse files
committed
add user push report
1 parent 903196f commit a9a08ad

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

getui.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,21 @@ func (g *PushClient) SearchTaskDetailByCid(cid, taskId string) (resp *models.Tas
370370
return searchTaskDetailByCid(g.AppId, token, cid, taskId)
371371
}
372372

373+
// ReportPushTask 获取推送结果(含自定义事件)可查询消息可下发数、下发数,接收数、展示数、点击数等结果
374+
//
375+
// 用于跟踪某个用户的消息到达情况
376+
func (g *PushClient) ReportPushTask(taskId string) (resp *models.Response, err error) {
377+
if taskId == "" {
378+
err = errors.New("taskid为空")
379+
return
380+
}
381+
token, err := g.GetToken()
382+
if err != nil {
383+
return
384+
}
385+
return reportPushTask(g.AppId, token, taskId)
386+
}
387+
373388
/*
374389
===============================================================
375390
推给所有人
@@ -655,6 +670,7 @@ func (g *PushClient) PushAllByCustomTag(scheduleTime int, customTag []string, pa
655670
}
656671

657672
// PushAllByLogicTags 对指定应用的符合筛选条件的用户群发推送消息。支持定时、定速功能
673+
//
658674
// 此接口频次限制100次/天,每分钟不能超过5次(推送限制和接口执行群推共享限制),定时推送功能需要申请开通才可以使用
659675
// scheduleTime 定时推送时间戳,为0时,不定时
660676
// tags为[]*models.Tag,需要自己构建tag表达式

search_api.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
)
77

88
// searchTaskDetailByCid 可以查询某任务下某cid的具体实时推送路径情况
9+
//
910
// 此接口需要SVIP权限,暂时不可用
1011
func searchTaskDetailByCid(appId, token string, cid, taskId string) (*models.TaskDetailResp, error) {
1112
b, err := HttpRequest("GET", appId+"/task/detail/"+cid+"/"+taskId, token, nil)
@@ -22,6 +23,7 @@ func searchTaskDetailByCid(appId, token string, cid, taskId string) (*models.Tas
2223
}
2324

2425
// searchSchedule 查询定时任务
26+
//
2527
// 该接口支持在推送完定时任务之后,查看定时任务状态,定时任务是否发送成功。
2628
func searchSchedule(appId, token, taskId string) (*models.Response, error) {
2729
resp, err := RequestAPI("GET", appId+"/task/schedule/"+taskId, token, nil)
@@ -30,3 +32,14 @@ func searchSchedule(appId, token, taskId string) (*models.Response, error) {
3032
}
3133
return resp, nil
3234
}
35+
36+
// reportPushTask
37+
// 查询推送数据,可查询消息可下发数、下发数,接收数、展示数、点击数等结果。支持单个taskId查询和多个taskId查询。
38+
// 此接口调用,仅可以查询toList或toApp的推送结果数据;不能查询toSingle的推送结果数据。
39+
func reportPushTask(appId, token, taskId string) (*models.Response, error) {
40+
resp, err := RequestAPI("GET", appId+"/report/push/task/"+taskId, token, nil)
41+
if err != nil {
42+
return nil, err
43+
}
44+
return resp, nil
45+
}

0 commit comments

Comments
 (0)