-
Notifications
You must be signed in to change notification settings - Fork 3
/
non-task-push.go
76 lines (58 loc) · 2.45 KB
/
non-task-push.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package goPushSdk
import "github.com/ddliu/go-httpclient"
const (
pushThroughMessageByPushId = PUSH_API_SERVER + "/garcia/api/server/push/unvarnished/pushByPushId"
pushNotificationMessageByPushId = PUSH_API_SERVER + "/garcia/api/server/push/varnished/pushByPushId"
pushThroughMessageByAlias = PUSH_API_SERVER + "/garcia/api/server/push/unvarnished/pushByAlias"
pushNotificationMessageByAlias = PUSH_API_SERVER + "/garcia/api/server/push/varnished/pushByAlias"
)
/**
* 通过PushId推送透传消息
*/
func PushThroughMessageByPushId(appId string, pushIds string, messageJson string, appKey string) PushResponse {
pushThroughMessageMap := map[string]string{
"appId": appId,
"pushIds": pushIds,
"messageJson": messageJson,
}
sign := GenerateSign(pushThroughMessageMap, appKey)
pushThroughMessageMap["sign"] = sign
res, err := httpclient.Post(pushThroughMessageByPushId, pushThroughMessageMap)
return ResolvePushResponse(res, err)
}
//pushId推送接口(通知栏消息)
func PushNotificationMessageByPushId(appId string, pushIds string, messageJson string, appKey string) PushResponse {
pushNotificationMessageMap := map[string]string{
"appId": appId,
"pushIds": pushIds,
"messageJson": messageJson,
}
sign := GenerateSign(pushNotificationMessageMap, appKey)
pushNotificationMessageMap["sign"] = sign
res, err := httpclient.Post(pushNotificationMessageByPushId, pushNotificationMessageMap)
return ResolvePushResponse(res, err)
}
//别名推送接口(透传消息
func PushThroughMessageByAlias(appId string, alias string, messageJson string, appKey string) PushResponse {
pushThroughMessageMap := map[string]string{
"appId": appId,
"alias": alias,
"messageJson": messageJson,
}
sign := GenerateSign(pushThroughMessageMap, appKey)
pushThroughMessageMap["sign"] = sign
res, err := httpclient.Post(pushThroughMessageByAlias, pushThroughMessageMap)
return ResolvePushResponse(res, err)
}
//别名推送接口(通知栏消息)
func PushNotificationMessageByAlias(appId string, alias string, messageJson string, appKey string) PushResponse {
pushNotificationMessageMap := map[string]string{
"appId": appId,
"alias": alias,
"messageJson": messageJson,
}
sign := GenerateSign(pushNotificationMessageMap, appKey)
pushNotificationMessageMap["sign"] = sign
res, err := httpclient.Post(pushNotificationMessageByAlias, pushNotificationMessageMap)
return ResolvePushResponse(res, err)
}