|
@@ -27,16 +27,22 @@ func Notification(header *protocol.RequestHeader, request *protocol.PushInfoRequ |
|
@@ -27,16 +27,22 @@ func Notification(header *protocol.RequestHeader, request *protocol.PushInfoRequ |
27
|
Content: request.Content,
|
27
|
Content: request.Content,
|
28
|
Ext: request.Ext,
|
28
|
Ext: request.Ext,
|
29
|
}
|
29
|
}
|
|
|
30
|
+ projectKeys []string = []string{request.ProjectKey}
|
30
|
)
|
31
|
)
|
|
|
32
|
+ if len(request.ProjectKeys) > 0 {
|
|
|
33
|
+ projectKeys = request.ProjectKeys
|
|
|
34
|
+ }
|
|
|
35
|
+ for i := 0; i < len(projectKeys); i++ {
|
|
|
36
|
+ projectKey := projectKeys[i]
|
31
|
rsp = &protocol.PushInfoResponse{}
|
37
|
rsp = &protocol.PushInfoResponse{}
|
32
|
- if project, err = repProject.FindOne(map[string]interface{}{"project_slave_key": request.ProjectKey}); err != nil {
|
38
|
+ if project, err = repProject.FindOne(map[string]interface{}{"project_slave_key": projectKey}); err != nil {
|
33
|
log.Error(err)
|
39
|
log.Error(err)
|
34
|
- err = protocol.NewCustomMessage(1, fmt.Sprintf("project_key:%v not found", request.ProjectKey))
|
40
|
+ err = protocol.NewCustomMessage(1, fmt.Sprintf("project_key:%v not found", projectKey))
|
35
|
return
|
41
|
return
|
36
|
}
|
42
|
}
|
37
|
if appInfo, err = repApp.FindOne(map[string]interface{}{"project_id": project.Id}); err != nil {
|
43
|
if appInfo, err = repApp.FindOne(map[string]interface{}{"project_id": project.Id}); err != nil {
|
38
|
log.Error(err)
|
44
|
log.Error(err)
|
39
|
- err = protocol.NewCustomMessage(1, fmt.Sprintf("project_key:%v not found", request.ProjectKey))
|
45
|
+ err = protocol.NewCustomMessage(1, fmt.Sprintf("project_key:%v not found", projectKey))
|
40
|
return
|
46
|
return
|
41
|
}
|
47
|
}
|
42
|
if deviceList, err = repDevice.Find(
|
48
|
if deviceList, err = repDevice.Find(
|
|
@@ -56,8 +62,9 @@ func Notification(header *protocol.RequestHeader, request *protocol.PushInfoRequ |
|
@@ -56,8 +62,9 @@ func Notification(header *protocol.RequestHeader, request *protocol.PushInfoRequ |
56
|
}
|
62
|
}
|
57
|
}
|
63
|
}
|
58
|
if len(deviceList) == 0 {
|
64
|
if len(deviceList) == 0 {
|
59
|
- err = protocol.NewSuccessWithMessage(fmt.Sprintf("接收人:%v 未查询到注册的设备信息!", request.Receivers))
|
|
|
60
|
- return
|
65
|
+ //e := protocol.NewSuccessWithMessage(fmt.Sprintf("Project:%v 接收人:%v 未查询到注册的设备信息!",projectKey, request.Receivers))
|
|
|
66
|
+ log.Error(fmt.Sprintf("【个推】 Project:%v 接收人:%v 未查询到注册的设备信息!", projectKey, request.Receivers))
|
|
|
67
|
+ continue
|
61
|
}
|
68
|
}
|
62
|
for i := range deviceList {
|
69
|
for i := range deviceList {
|
63
|
receivers = append(receivers, deviceList[i].ClientId)
|
70
|
receivers = append(receivers, deviceList[i].ClientId)
|
|
@@ -73,6 +80,7 @@ func Notification(header *protocol.RequestHeader, request *protocol.PushInfoRequ |
|
@@ -73,6 +80,7 @@ func Notification(header *protocol.RequestHeader, request *protocol.PushInfoRequ |
73
|
if err != nil {
|
80
|
if err != nil {
|
74
|
err = protocol.NewCustomMessage(1, err.Error())
|
81
|
err = protocol.NewCustomMessage(1, err.Error())
|
75
|
}
|
82
|
}
|
|
|
83
|
+ }
|
76
|
return
|
84
|
return
|
77
|
}
|
85
|
}
|
78
|
|
86
|
|