wechat icon indicating copy to clipboard operation
wechat copied to clipboard

会增加 公众号群发消息和模板消息吗

Open 15098713556 opened this issue 6 years ago • 3 comments

15098713556 avatar Aug 05 '19 02:08 15098713556

我看源代码里有支持 template 的部分,但没找到使用说明。

aetherwu avatar Jan 19 '20 14:01 aetherwu

	// 发送消息返回数据
	templateMsg := message.NewTemplate(WeChat.Context)
	msg := &message.Message{
		ToUser:     user,
		TemplateID: templateId,
		URL:        url,
		Data:       msgData,
	}

	if msgId, err := templateMsg.Send(msg); err != nil {
		Log.Info("send template msg err: ", err.Error())
		data := map[string]string{"errorCode": err.Error()}
		response.Json(r, 1, "error", data)
	} else {
		data := map[string]string{"msgid": gconv.String(msgId)}
		response.Json(r, 0, "ok", data)
	}

loocor avatar May 03 '20 18:05 loocor

TODO 支持消息群发

silenceper avatar May 26 '20 10:05 silenceper