作者 tangxvhui

更新openApi 调用

... ... @@ -137,6 +137,15 @@ func appMessageSend() error {
}
appMessage = append(appMessage, messageList...)
}
// openApi := serviceGateway.NewHttplibMmmOpenApiServiceGateway()
// for _, val := range appMessage {
// _, err := openApi.PushInfo(1, constant.APP_MESSAGE_KEY, []int64{int64(val.TargetUserId)}, val.Title, val.Content)
// if err != nil {
// log.Logger.Error("发送远端openApi关于里程碑异常的消息通知:" + err.Error())
// }
// }
err = saveAllMessagePersonal(appMessage)
if err != nil {
return fmt.Errorf("保存里程碑异常的消息通知失败%s", err)
... ...
... ... @@ -30,16 +30,19 @@ type MessageExt struct {
}
// PushInfo 个推
func (serviceGateway *HttplibMmmOpenApiServiceGateway) PushInfo(msgType int, projects []string, uids []int64, title string, content string) (map[string]interface{}, error) {
func (serviceGateway *HttplibMmmOpenApiServiceGateway) PushInfo(msgType int, project string, uids []int64, title string, content string) (map[string]interface{}, error) {
url := strings.Join([]string{serviceGateway.baseURL, "v1", "push", "pushInfo"}, "/")
serviceGateway.CreateRequest("post", url)
options := &MessageOptions{
MmmType: msgType,
Projects: projects,
Project: project,
Receivers: uids,
Title: title,
Content: content,
}
options.Ext.TransData.MmmType = "103" //固定值,需要手机端配合设置
options.Ext.TransData.MmmTitle = title
options.Ext.TransData.MmmContent = content
serviceGateway.SetBody(options)
response := make(map[string]interface{})
err := serviceGateway.ToJson(&response)
... ...