|
@@ -85,7 +85,7 @@ func GetWxTmplConfig(msgType int64) (*WxTmplConfig, error) {
|
|
return nil, fmt.Errorf("未知消息类型")
|
|
return nil, fmt.Errorf("未知消息类型")
|
|
}
|
|
}
|
|
|
|
|
|
-func (stm *WxTmplPush) SendMsg(link, title, detail, date, row4 string) error {
|
|
|
|
|
|
+func (stm *WxTmplPush) SendMsg(link, title, detail, date, row4 string, note string) error {
|
|
if stm.Config == nil || stm.Config.TmplId == "" || (stm.MgoId != "" && stm.OpenId != "" && stm.Position != "") || link == "" {
|
|
if stm.Config == nil || stm.Config.TmplId == "" || (stm.MgoId != "" && stm.OpenId != "" && stm.Position != "") || link == "" {
|
|
return fmt.Errorf("缺少参数 stm.Config.TmplId:%v stm.MgoId:%v stm.OpenId:%v stm.Position:%v link:%v ", stm.Config.TmplId, stm.MgoId, stm.OpenId, stm.Position, link)
|
|
return fmt.Errorf("缺少参数 stm.Config.TmplId:%v stm.MgoId:%v stm.OpenId:%v stm.Position:%v link:%v ", stm.Config.TmplId, stm.MgoId, stm.OpenId, stm.Position, link)
|
|
}
|
|
}
|
|
@@ -105,7 +105,7 @@ func (stm *WxTmplPush) SendMsg(link, title, detail, date, row4 string) error {
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
// 获取消息
|
|
// 获取消息
|
|
- msgTemp, err := stm.getMessage(title, detail, date, row4)
|
|
|
|
|
|
+ msgTemp, err := stm.getMessage(title, detail, date, row4, note)
|
|
if err != nil {
|
|
if err != nil {
|
|
return err
|
|
return err
|
|
}
|
|
}
|
|
@@ -135,7 +135,7 @@ var (
|
|
)
|
|
)
|
|
|
|
|
|
// getMessage 获取消息内容
|
|
// getMessage 获取消息内容
|
|
-func (stm *WxTmplPush) getMessage(title, detail, date, row4 string) (map[string]*qrpc.TmplItem, error) {
|
|
|
|
|
|
+func (stm *WxTmplPush) getMessage(title, detail, date, row4 string, note string) (map[string]*qrpc.TmplItem, error) {
|
|
var formatValue string = stm.Config.TmplValue
|
|
var formatValue string = stm.Config.TmplValue
|
|
for _, key := range allMsgValueKeys {
|
|
for _, key := range allMsgValueKeys {
|
|
switch key {
|
|
switch key {
|
|
@@ -150,7 +150,11 @@ func (stm *WxTmplPush) getMessage(title, detail, date, row4 string) (map[string]
|
|
case "$row4":
|
|
case "$row4":
|
|
formatValue = strings.ReplaceAll(formatValue, key, regSpecial.ReplaceAllString(row4, ""))
|
|
formatValue = strings.ReplaceAll(formatValue, key, regSpecial.ReplaceAllString(row4, ""))
|
|
case "$note":
|
|
case "$note":
|
|
- formatValue = strings.ReplaceAll(formatValue, key, regSpecial.ReplaceAllString(config.ConfigJson.WxTmplConfig.CloseNotice, ""))
|
|
|
|
|
|
+ if note == "" {
|
|
|
|
+ formatValue = strings.ReplaceAll(formatValue, key, regSpecial.ReplaceAllString(config.ConfigJson.WxTmplConfig.CloseNotice, ""))
|
|
|
|
+ } else {
|
|
|
|
+ formatValue = strings.ReplaceAll(formatValue, key, regSpecial.ReplaceAllString(note, ""))
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
bValue := map[string]*qrpc.TmplItem{}
|
|
bValue := map[string]*qrpc.TmplItem{}
|