ソースを参照

新增参数校验

longyu 2 年 前
コミット
55af8d7fec
2 ファイル変更11 行追加3 行削除
  1. 11 0
      controllers/wechat.go
  2. 0 3
      controllers/wx_user.go

+ 11 - 0
controllers/wechat.go

@@ -30,6 +30,17 @@ func (this *WechatController) SendTemplateMsg() {
 		br.ErrMsg = "参数解析失败,Err:" + err.Error()
 		return
 	}
+
+	if sendItem.TemplateId == "" {
+		br.Msg = "参数错误,模板id为空"
+		return
+	}
+
+	if len(sendItem.OpenIdArr) <= 0 {
+		br.Msg = "openid为空"
+		return
+	}
+
 	go func() {
 		err = services.SendWxTemplateMsg(sendItem)
 		if err != nil {

+ 0 - 3
controllers/wx_user.go

@@ -1,3 +0,0 @@
-package controllers
-
-