作者 tangxvhui

更新openApi 调用

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