模板消息修改

This commit is contained in:
guange 2016-04-08 11:19:05 +08:00
parent 0731405828
commit 5cc0ac04e6
1 changed files with 5 additions and 8 deletions

View File

@ -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