Ver Fonte

代码合并

renjiaojiao há 1 ano atrás
pai
commit
a24a537f4b
2 ficheiros alterados com 27 adições e 14 exclusões
  1. 22 4
      rpc/internal/common/newSendMsgService.go
  2. 5 10
      rpc/internal/config/config.go

+ 22 - 4
rpc/internal/common/newSendMsgService.go

@@ -2,6 +2,7 @@ package common
 
 import (
 	"app.yhyue.com/moapp/MessageCenter/entity"
+	"app.yhyue.com/moapp/MessageCenter/rpc/internal/config"
 	"app.yhyue.com/moapp/MessageCenter/rpc/type/message"
 	"app.yhyue.com/moapp/jybase/common"
 	"context"
@@ -94,7 +95,7 @@ func NewUserSendMsg(in *message.NewUserInsertMsgReq) string {
 				OrderMoney:  in.OrderMoney,
 				Row4:        in.Row4,
 			}
-			SentWxTmplAndAppPush(pushData, v, group_id)
+			SentWxTmplAndAppPush(pushData, v, group_id, "", "")
 		}(userIdArr[i], positionId)
 	}
 	wg.Wait()
@@ -121,6 +122,18 @@ func UpdateUserMsgSummary(in *message.BitmapSaveMsgReq) error {
 	if err1 != nil {
 		return err1
 	}
+	//p459 特殊处理 传过来的消息内容格式为 消息内容#jy#微信模板项目名称#jy#服务地址
+	equityName, equityAddr := "", ""
+	if in.MsgType == config.ConfigJson.EquityInfoMsgType {
+		equityRs := strings.Split(in.Content, "#jy#")
+		if len(equityRs) != 3 {
+			log.Println("消息内容格式有误:", in.Content)
+			return errors.New("无效的消息内容格式")
+		}
+		in.Content = equityRs[0]
+		equityName = equityRs[1]
+		equityAddr = equityRs[2]
+	}
 	for i := 0; i < len(userIdArr); i++ {
 		if userIdArr[i] == "" {
 			continue
@@ -149,7 +162,7 @@ func UpdateUserMsgSummary(in *message.BitmapSaveMsgReq) error {
 				OrderMoney:  in.OrderMoney,
 				Row4:        in.Row4,
 			}
-			SentWxTmplAndAppPush(pushData, v, group_id)
+			SentWxTmplAndAppPush(pushData, v, group_id, equityName, equityAddr)
 		}(userIdArr[i])
 	}
 	wg.Wait()
@@ -180,7 +193,7 @@ type WxTmplAndPush struct {
 	SendUserId  string
 }
 
-func SentWxTmplAndAppPush(this WxTmplAndPush, v string, group_id int) {
+func SentWxTmplAndAppPush(this WxTmplAndPush, v string, group_id int, equityName, equityAddr string) {
 	nTime := time.Now().Format("2006-01-02 15:04:05")
 	//发送消息成功,推送微信、app
 	//fmt.Println("this.MsgType", this.MsgType)
@@ -199,7 +212,12 @@ func SentWxTmplAndAppPush(this WxTmplAndPush, v string, group_id int) {
 	}
 	// 消息模版 工单类型 {{thing19.DATA}} 工单标题 {{thing6.DATA}} 项目名称 {{thing13.DATA}} 服务时间 {{time25.DATA}} 服务地址 {{thing26.DATA}}
 	if this.MsgType != 1 && this.MsgType != 10 {
-		err = p.SendMsg(this.WxPushUrl, this.Title, this.Content, nTime, this.Row4)
+		if this.MsgType == config.ConfigJson.EquityInfoMsgType {
+			// p459 服务地址特殊处理
+			err = p.SendMsg(this.WxPushUrl, this.Title, equityName, nTime, this.Row4, equityAddr)
+		} else {
+			err = p.SendMsg(this.WxPushUrl, this.Title, this.Content, nTime, this.Row4, "")
+		}
 		if err != nil {
 			logx.Error(fmt.Sprintf("SendWxTmplMsg uId %s  Error %s", v, err.Error()))
 		} else {

+ 5 - 10
rpc/internal/config/config.go

@@ -23,11 +23,11 @@ type Config struct {
 		Pwd  string `json:"pwd"`
 		User string `json:"user"`
 	} `json:"mail"`
-<<<<<<< HEAD
-	TidbEng         string  `json:"Tidb"`
-	ClassSearchList []int64 `json:"ClassSearchList"` // 需要按照messageclass 查询的groupId
-	Clickhouse      *CHouseConfig
-	GlobMsgLoadTime string `json:"GlobMsgLoadTime"`
+	TidbEng           string  `json:"Tidb"`
+	ClassSearchList   []int64 `json:"ClassSearchList"` // 需要按照messageclass 查询的groupId
+	Clickhouse        *CHouseConfig
+	GlobMsgLoadTime   string `json:"GlobMsgLoadTime"`
+	EquityInfoMsgType int64  `json:"EquityInfoMsgType"` // 营销权益消息需要特殊处理的消息类型
 }
 
 type CHouseConfig struct {
@@ -37,11 +37,6 @@ type CHouseConfig struct {
 	DbName       string
 	MaxIdleConns int
 	MaxOpenConns int
-=======
-	TidbEng           string  `json:"Tidb"`
-	ClassSearchList   []int64 `json:"ClassSearchList"`   // 需要按照messageclass 查询的groupId
-	EquityInfoMsgType int64   `json:"EquityInfoMsgType"` // 营销权益消息需要特殊处理的消息类型
->>>>>>> master
 }
 
 type mysqlConfig struct {