From 8512f862bc3a8914f994d534be9b51f61d26b7c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 28 Sep 2020 09:17:15 +0800 Subject: [PATCH] authbind --- business/jxutils/weixinmsg/weixinmsg.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/business/jxutils/weixinmsg/weixinmsg.go b/business/jxutils/weixinmsg/weixinmsg.go index 54d60e0da..a08e91790 100644 --- a/business/jxutils/weixinmsg/weixinmsg.go +++ b/business/jxutils/weixinmsg/weixinmsg.go @@ -903,6 +903,9 @@ func SendMsgToUser(userID string, templateID string, data interface{}) (err erro return err } successCount := 0 + if len(authBinds) == 0 { + return fmt.Errorf("此用户未找到微信认证方式!userID: %v", userID) + } globals.SugarLogger.Debugf("SendMsgToUser userID:%d, openID:%s, templateID:%s", userID, authBinds[0].AuthID, templateID) if err2 := SmartMessageTemplateSend(authBinds[0].AuthID, templateID, "", "", data); err2 == nil { successCount++