Преглед изворни кода

Merge branch 'master' into feature/v1.2.8

lianbingjie пре 1 година
родитељ
комит
101dc35bbd

+ 2 - 1
rpc/internal/common/sendMsg.go

@@ -462,7 +462,8 @@ func MultSave(this message.MultipleSaveMsgReq) (int64, string) {
 					logx.Error(fmt.Sprintf("SendWxTmplMsg uId %s  Error %s", v, err.Error()))
 					logx.Error(fmt.Sprintf("SendWxTmplMsg uId %s  Error %s", v, err.Error()))
 				}
 				}
 				p := &WxTmplPush{
 				p := &WxTmplPush{
-					Config: pushConfig,
+					Config:      pushConfig,
+					CustomWxTpl: this.CustomWxTpl,
 				}
 				}
 				p.MgoId = v
 				p.MgoId = v
 				if this.MsgType == 10 {
 				if this.MsgType == 10 {

+ 27 - 12
rpc/internal/common/sendWxTmplMsg.go

@@ -1,26 +1,29 @@
 package common
 package common
 
 
 import (
 import (
+	"encoding/json"
+	"fmt"
+	"log"
+	"net/url"
+	"regexp"
+	"strings"
+	"time"
+
 	"app.yhyue.com/moapp/MessageCenter/entity"
 	"app.yhyue.com/moapp/MessageCenter/entity"
 	"app.yhyue.com/moapp/MessageCenter/rpc/internal/config"
 	"app.yhyue.com/moapp/MessageCenter/rpc/internal/config"
+	"app.yhyue.com/moapp/MessageCenter/rpc/type/message"
 	"app.yhyue.com/moapp/MessageCenter/util"
 	"app.yhyue.com/moapp/MessageCenter/util"
 	"app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/common"
 	dataFormat "app.yhyue.com/moapp/jybase/date"
 	dataFormat "app.yhyue.com/moapp/jybase/date"
 	m "app.yhyue.com/moapp/jybase/mongodb"
 	m "app.yhyue.com/moapp/jybase/mongodb"
 	"app.yhyue.com/moapp/jybase/redis"
 	"app.yhyue.com/moapp/jybase/redis"
 	qrpc "app.yhyue.com/moapp/jybase/rpc"
 	qrpc "app.yhyue.com/moapp/jybase/rpc"
-	"encoding/json"
-	"fmt"
-	"log"
-	"net/url"
-	"regexp"
-	"strings"
-	"time"
 )
 )
 
 
 type WxTmplPush struct {
 type WxTmplPush struct {
 	MgoId, OpenId, Position, OpushId, JpushId, AppPoneType string //UserId 用户mgoId, OpenId 微信id, Position 职位id
 	MgoId, OpenId, Position, OpushId, JpushId, AppPoneType string //UserId 用户mgoId, OpenId 微信id, Position 职位id
 	Config                                                 *WxTmplConfig
 	Config                                                 *WxTmplConfig
+	CustomWxTpl                                            *message.CustomWxTpl
 }
 }
 
 
 var AllMsgType func() map[int64]WxTmplConfig
 var AllMsgType func() map[int64]WxTmplConfig
@@ -90,12 +93,24 @@ func (stm *WxTmplPush) SendMsg(link, title, detail, date, row4 string) error {
 	if err := stm.getUserOpenIdAndWxPushState(); err != nil {
 	if err := stm.getUserOpenIdAndWxPushState(); err != nil {
 		return err
 		return err
 	}
 	}
-	// 获取消息
-	msg, err := stm.getMessage(title, detail, date, row4)
-	if err != nil {
-		return err
+	var msg map[string]*qrpc.TmplItem
+	if stm.CustomWxTpl != nil && stm.CustomWxTpl.TplId != "" {
+		stm.Config.TmplId = stm.CustomWxTpl.TplId
+		msg = map[string]*qrpc.TmplItem{}
+		for k, v := range stm.CustomWxTpl.TmplData {
+			msg[k] = &qrpc.TmplItem{
+				Value: v.Value,
+				Color: v.Color,
+			}
+		}
+	} else {
+		// 获取消息
+		msgTemp, err := stm.getMessage(title, detail, date, row4)
+		if err != nil {
+			return err
+		}
+		msg = msgTemp
 	}
 	}
-
 	// 校验发送量及频率
 	// 校验发送量及频率
 	err, noteFunc := stm.IncrCount()
 	err, noteFunc := stm.IncrCount()
 	if err != nil {
 	if err != nil {

+ 11 - 0
rpc/message.proto

@@ -138,8 +138,19 @@ message multipleSaveMsgReq {
     string appPushUrl = 20;
     string appPushUrl = 20;
     string wxPushUrl = 21;
     string wxPushUrl = 21;
     string iosPushUrl = 22;
     string iosPushUrl = 22;
+    CustomWxTpl customWxTpl = 23;
  }
  }
 
 
+message CustomWxTpl {
+	string TplId = 1;
+	map<string, TmplItem> tmplData = 2;
+}
+
+message TmplItem {
+	string value = 1;
+	string color = 2;
+}
+
 message multipleSaveMsgResp {
 message multipleSaveMsgResp {
     int64 code = 1; //状态码
     int64 code = 1; //状态码
     string message = 2; //响应消息
     string message = 2; //响应消息

Разлика између датотеке није приказан због своје велике величине
+ 401 - 265
rpc/type/message/message.pb.go


+ 1 - 1
rpc/type/message/message_grpc.pb.go

@@ -1,7 +1,7 @@
 // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
 // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
 // versions:
 // versions:
 // - protoc-gen-go-grpc v1.2.0
 // - protoc-gen-go-grpc v1.2.0
-// - protoc             v3.19.4
+// - protoc             v3.20.0--rc2
 // source: message.proto
 // source: message.proto
 
 
 package message
 package message

Неке датотеке нису приказане због велике количине промена