...
|
...
|
@@ -27,16 +27,22 @@ func Notification(header *protocol.RequestHeader, request *protocol.PushInfoRequ |
|
|
Content: request.Content,
|
|
|
Ext: request.Ext,
|
|
|
}
|
|
|
projectKeys []string = []string{request.ProjectKey}
|
|
|
)
|
|
|
if len(request.ProjectKeys) > 0 {
|
|
|
projectKeys = request.ProjectKeys
|
|
|
}
|
|
|
for i := 0; i < len(projectKeys); i++ {
|
|
|
projectKey := projectKeys[i]
|
|
|
rsp = &protocol.PushInfoResponse{}
|
|
|
if project, err = repProject.FindOne(map[string]interface{}{"project_slave_key": request.ProjectKey}); err != nil {
|
|
|
if project, err = repProject.FindOne(map[string]interface{}{"project_slave_key": projectKey}); err != nil {
|
|
|
log.Error(err)
|
|
|
err = protocol.NewCustomMessage(1, fmt.Sprintf("project_key:%v not found", request.ProjectKey))
|
|
|
err = protocol.NewCustomMessage(1, fmt.Sprintf("project_key:%v not found", projectKey))
|
|
|
return
|
|
|
}
|
|
|
if appInfo, err = repApp.FindOne(map[string]interface{}{"project_id": project.Id}); err != nil {
|
|
|
log.Error(err)
|
|
|
err = protocol.NewCustomMessage(1, fmt.Sprintf("project_key:%v not found", request.ProjectKey))
|
|
|
err = protocol.NewCustomMessage(1, fmt.Sprintf("project_key:%v not found", projectKey))
|
|
|
return
|
|
|
}
|
|
|
if deviceList, err = repDevice.Find(
|
...
|
...
|
@@ -56,8 +62,9 @@ func Notification(header *protocol.RequestHeader, request *protocol.PushInfoRequ |
|
|
}
|
|
|
}
|
|
|
if len(deviceList) == 0 {
|
|
|
err = protocol.NewSuccessWithMessage(fmt.Sprintf("接收人:%v 未查询到注册的设备信息!", request.Receivers))
|
|
|
return
|
|
|
//e := protocol.NewSuccessWithMessage(fmt.Sprintf("Project:%v 接收人:%v 未查询到注册的设备信息!",projectKey, request.Receivers))
|
|
|
log.Error(fmt.Sprintf("【个推】 Project:%v 接收人:%v 未查询到注册的设备信息!", projectKey, request.Receivers))
|
|
|
continue
|
|
|
}
|
|
|
for i := range deviceList {
|
|
|
receivers = append(receivers, deviceList[i].ClientId)
|
...
|
...
|
@@ -73,6 +80,7 @@ func Notification(header *protocol.RequestHeader, request *protocol.PushInfoRequ |
|
|
if err != nil {
|
|
|
err = protocol.NewCustomMessage(1, err.Error())
|
|
|
}
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
|
...
|
...
|
|