From 5cc0ac04e6849ba737e4afd55f4da19656a0fe11 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Fri, 8 Apr 2016 11:19:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E6=B6=88=E6=81=AF=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/mailer.rb | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 98ed4ee1f..7438b24d8 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -1150,14 +1150,11 @@ class Mailer < ActionMailer::Base } } } - uri = URI("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=1234567") - body = data.to_json - res = Net::HTTP.new(uri.host, uri.port).start do |client| - request = Net::HTTP::Post.new(uri.path) - request.body = body - request["Content-Type"] = "application/json" - client.request(request) - end + + logger.info "start send template message: #{data}" + req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data) + logger.info "send over. #{req}" + end end end