// GO的微信SDK我用的是这个:https://github.com/silenceper/wechat
// 发送模版消息
// UserNickName,UserMobile是发起预约的人的昵称和手机号
func (this *BaseController) SendTemplate(postAuthor *models.User,UserNickName,UserMobile,AppointmentTimeString,Comment string) {
wc:=helper.NewWechatHelperInstance().MyNewWechat myTemplate:=template.Message{
ToUser:postAuthor.WechatOpenId,
TemplateID:"此处填入模版ID",
URL:"可选/可填入点击消息后跳转的地址",
Data: map[string]*template.DataItem{
"first": {Value: "有新的客户预约,请及时查看"},
"keyword1": {Value: UserNickName},
"keyword2": {Value: UserMobile},
"keyword3": {Value: AppointmentTimeString},
"keyword4": {Value: Comment},
"remark": {Value: "点击进入预约中心"},
},
} _, err := wc.GetTemplate().Send(&myTemplate)
if err!=nil {
log.Println("模版消息发送失败:"+err.Error())
}
}