wangkaiyue 2 лет назад
Родитель
Сommit
1f95e8b723
1 измененных файлов с 3 добавлено и 2 удалено
  1. 3 2
      rpc/internal/common/sendWxTmplMsg.go

+ 3 - 2
rpc/internal/common/sendWxTmplMsg.go

@@ -11,6 +11,7 @@ import (
 	qrpc "app.yhyue.com/moapp/jybase/rpc"
 	"encoding/json"
 	"fmt"
+	"net/url"
 	"strings"
 	"time"
 )
@@ -69,7 +70,7 @@ func GetWxTmplConfig(class string) (*WxTmplConfig, error) {
 }
 
 func (stm *WxTmplPush) SendMsg(link, title, detail, date string) error {
-	if stm.Config.TmplId == "" || (stm.MgoId != "" && stm.OpenId != "" && stm.Position != "") {
+	if stm.Config.TmplId == "" || (stm.MgoId != "" && stm.OpenId != "" && stm.Position != "") || link == "" {
 		return fmt.Errorf("缺少参数")
 	}
 	// 校验推送是否开启
@@ -86,7 +87,7 @@ func (stm *WxTmplPush) SendMsg(link, title, detail, date string) error {
 		return err
 	}
 	// 发送信息
-	autoLoginHref := fmt.Sprintf("%s/swordfish/SingleLogin?toHref=%s", config.ConfigJson.WxWebdomain, link)
+	autoLoginHref := fmt.Sprintf("%s/swordfish/SingleLogin?toHref=%s", config.ConfigJson.WxWebdomain, url.QueryEscape(link))
 	if _, err := stm.Send(autoLoginHref, msg); err != nil {
 		return err
 	}