作者 tangxvhui

调整 手机推送异常

@@ -117,7 +117,7 @@ spec: @@ -117,7 +117,7 @@ spec:
117 - name: BUSINESS_ADMIN_SERVICE_HOST 117 - name: BUSINESS_ADMIN_SERVICE_HOST
118 value: "https://suplus-business-admin-test.fjmaimaimai.com" 118 value: "https://suplus-business-admin-test.fjmaimaimai.com"
119 - name: MMM_OPEN_API_SERVICE_HOST 119 - name: MMM_OPEN_API_SERVICE_HOST
120 - value: "http://mmm-open-api-dev.fjmaimaimai.com" 120 + value: "http://mmm-open-api-test.fjmaimaimai.com"
121 volumes: 121 volumes:
122 - name: accesslogs 122 - name: accesslogs
123 emptyDir: {} 123 emptyDir: {}
@@ -157,7 +157,7 @@ func messageTaskRecordAnomaly() ([]*domain.MessagePersonal, error) { @@ -157,7 +157,7 @@ func messageTaskRecordAnomaly() ([]*domain.MessagePersonal, error) {
157 payloadStr, _ := json.Marshal(payload) 157 payloadStr, _ := json.Marshal(payload)
158 newMessage := domain.MessagePersonal{ 158 newMessage := domain.MessagePersonal{
159 Id: 0, 159 Id: 0,
160 - Types: domain.MessageTypesTaskStageApp, 160 + Types: domain.MessageTypesTaskRecordApp,
161 TargetUserId: val2.Id, 161 TargetUserId: val2.Id,
162 ReadFlag: domain.MessageIsRead, 162 ReadFlag: domain.MessageIsRead,
163 Title: "", 163 Title: "",
@@ -234,7 +234,7 @@ func appMessageSend() error { @@ -234,7 +234,7 @@ func appMessageSend() error {
234 appMessage = append(appMessage, messageList2...) 234 appMessage = append(appMessage, messageList2...)
235 openApi := serviceGateway.NewHttplibMmmOpenApiServiceGateway() 235 openApi := serviceGateway.NewHttplibMmmOpenApiServiceGateway()
236 for _, val := range appMessage { 236 for _, val := range appMessage {
237 - _, err := openApi.PushInfo(1, constant.APP_MESSAGE_KEY, []int64{int64(val.TargetUserId)}, val.Title, val.Content) 237 + _, err := openApi.PushInfo(0, constant.APP_MESSAGE_KEY, []int64{int64(val.TargetUserId)}, val.Title, val.Content)
238 if err != nil { 238 if err != nil {
239 log.Logger.Error("发送远端openApi关于里程碑异常的消息通知:" + err.Error()) 239 log.Logger.Error("发送远端openApi关于里程碑异常的消息通知:" + err.Error())
240 } 240 }
@@ -17,7 +17,7 @@ var UPLOAD_ZIP_PATH = "./uploads/zip" @@ -17,7 +17,7 @@ var UPLOAD_ZIP_PATH = "./uploads/zip"
17 // Env 判断当前环境变量 17 // Env 判断当前环境变量
18 var Env = "dev" 18 var Env = "dev"
19 19
20 -var MMM_OPEN_API_SERVICE_HOST = "http://mmm-open-api-dev.fjmaimaimai.com" 20 +var MMM_OPEN_API_SERVICE_HOST = "http://mmm-open-api-test.fjmaimaimai.com"
21 21
22 // 绩效管理平台ID 22 // 绩效管理平台ID
23 var PLATFORM_ADMIN_ID = 28 23 var PLATFORM_ADMIN_ID = 28
@@ -19,11 +19,12 @@ type MessagePersonal struct { @@ -19,11 +19,12 @@ type MessagePersonal struct {
19 type MessageTypes string 19 type MessageTypes string
20 20
21 const ( 21 const (
22 - MessageTypesOther MessageTypes = "other" //综合自评开启时,消息通知  
23 - MessageTypesTaskStage MessageTypes = "task_stage" //任务里程碑未按时完成  
24 - MessageTypesTaskRecord MessageTypes = "task_record" //任务每日反馈异常  
25 - MessageTypesTaskModify MessageTypes = "task_modify" //修改任务  
26 - MessageTypesTaskStageApp MessageTypes = "task_stage-app" //任务里程碑未按时完成 22 + MessageTypesOther MessageTypes = "other" //综合自评开启时,消息通知
  23 + MessageTypesTaskStage MessageTypes = "task_stage" //任务里程碑未按时完成
  24 + MessageTypesTaskRecord MessageTypes = "task_record" //任务每日反馈异常
  25 + MessageTypesTaskModify MessageTypes = "task_modify" //修改任务
  26 + MessageTypesTaskStageApp MessageTypes = "task_stage-app" //任务里程碑未按时完成
  27 + MessageTypesTaskRecordApp MessageTypes = "task_record-app" //任务每日反馈异常
27 ) 28 )
28 29
29 type MessageReadFlag string 30 type MessageReadFlag string
@@ -3,14 +3,14 @@ package serviceGateway @@ -3,14 +3,14 @@ package serviceGateway
3 import ( 3 import (
4 "crypto/tls" 4 "crypto/tls"
5 "encoding/json" 5 "encoding/json"
6 - "github.com/beego/beego/v2/client/httplib"  
7 - "github.com/linmadan/egglib-go/utils/tool_funs"  
8 - "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/log"  
9 "io/ioutil" 6 "io/ioutil"
10 "net/http" 7 "net/http"
11 "reflect" 8 "reflect"
12 "strings" 9 "strings"
13 "time" 10 "time"
  11 +
  12 + "github.com/beego/beego/v2/client/httplib"
  13 + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/log"
14 ) 14 )
15 15
16 type httpLibBaseServiceGateway struct { 16 type httpLibBaseServiceGateway struct {
@@ -101,7 +101,7 @@ func (client *httpLibBaseServiceGateway) ToJson(result interface{}) error { @@ -101,7 +101,7 @@ func (client *httpLibBaseServiceGateway) ToJson(result interface{}) error {
101 } 101 }
102 err = json.Unmarshal(mBytes, result) 102 err = json.Unmarshal(mBytes, result)
103 //增加返回数据日志 103 //增加返回数据日志
104 - log.Logger.Debug(response.Request.Method+" "+response.Request.URL.String()+"----response----", tool_funs.SimpleStructToMap(result)) 104 + log.Logger.Debug(response.Request.Method + " " + response.Request.URL.String() + "----response----" + string(mBytes))
105 return err 105 return err
106 } 106 }
107 107
1 package serviceGateway 1 package serviceGateway
2 2
3 import ( 3 import (
4 - "strings"  
5 -  
6 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/constant" 4 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/constant"
7 ) 5 )
8 6
@@ -31,7 +29,8 @@ type MessageExt struct { @@ -31,7 +29,8 @@ type MessageExt struct {
31 29
32 // PushInfo 个推 30 // PushInfo 个推
33 func (serviceGateway *HttplibMmmOpenApiServiceGateway) PushInfo(msgType int, project string, uids []int64, title string, content string) (map[string]interface{}, error) { 31 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"}, "/") 32 + // url := strings.Join([]string{"v1", "push", "pushInfo"}, "/")
  33 + url := "/v1/push/pushInfo"
35 serviceGateway.CreateRequest("post", url) 34 serviceGateway.CreateRequest("post", url)
36 options := &MessageOptions{ 35 options := &MessageOptions{
37 MmmType: msgType, 36 MmmType: msgType,
  1 +package serviceGateway
  2 +
  3 +import "testing"
  4 +
  5 +func TestPushInfo(t *testing.T) {
  6 + //测试消息推送
  7 + c := NewHttplibMmmOpenApiServiceGateway()
  8 + resp, err := c.PushInfo(0, "mmm.ability.performance", []int64{3422174102828544}, "ceshi推送一个消息233", "消息内容xxxx332")
  9 + if err != nil {
  10 + t.Error(err)
  11 + }
  12 + t.Logf("%v", resp)
  13 +}