From c041f742c1624609d8c3924cfb5d020b8012f011 Mon Sep 17 00:00:00 2001 From: cxt Date: Sat, 9 Apr 2016 16:21:13 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=BA=E9=99=B7=E5=92=8C=E7=95=99=E8=A8=80?= =?UTF-8?q?=E7=9A=84=E5=9B=9E=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1234567 | 2 +- app/models/blog_comment.rb | 6 +++++- app/models/homework_common.rb | 6 +++++- app/models/journal.rb | 6 +++++- app/models/journals_for_message.rb | 6 +++++- app/models/mailer.rb | 7 +++++-- public/javascripts/wechat/app.js | 2 +- 7 files changed, 27 insertions(+), 8 deletions(-) diff --git a/1234567 b/1234567 index 1aa01764f..dfd7e3ee3 100644 --- a/1234567 +++ b/1234567 @@ -1 +1 @@ -{"access_token":"G4QG7VJgF8Vmm71kLgC1XgHvyeXK-ZZrikaG7sPBrKuw6vgbYzV2FPYuNq3wNp7e-hsyfDI--rTlVspQXZk5bRK_CsZl8wWvuiPazV9mznGpOBGE5zVR8WOtvlqhylpHIMBdABABFU","expires_in":7200,"got_token_at":1460179500} \ No newline at end of file +{"access_token":"7MBMEBoE6sSC15bIHZYAZSxj47yCKlbWEVjrkUgEJxPP3K083tbhc1RIWmxGu3WoB5dAXxK_yd4l1jrcvt6YrsTcOfFGRirOHVfzrpvhsQgxOoxcdc7YljfO_dnwUtWgFTAcAIALZG","expires_in":7200,"got_token_at":1460189856} \ No newline at end of file diff --git a/app/models/blog_comment.rb b/app/models/blog_comment.rb index 86b69e993..cfe6fe3f3 100644 --- a/app/models/blog_comment.rb +++ b/app/models/blog_comment.rb @@ -110,7 +110,11 @@ class BlogComment < ActiveRecord::Base } } logger.info "start send template message: #{data}" - req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data) + begin + req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data) + rescue Exception => e + logger.error "[blog_comment] ===> #{e}" + end logger.info "send over. #{req}" end end diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb index 0c58458a6..ab687c869 100644 --- a/app/models/homework_common.rb +++ b/app/models/homework_common.rb @@ -135,7 +135,11 @@ class HomeworkCommon < ActiveRecord::Base } } logger.info "start send template message: #{data}" - req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data) + begin + req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data) + rescue Exception => e + logger.error "[homework_common] ===> #{e}" + end logger.info "send over. #{req}" end end diff --git a/app/models/journal.rb b/app/models/journal.rb index eede42d98..499abf344 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -271,7 +271,11 @@ class Journal < ActiveRecord::Base } } logger.info "start send template message: #{data}" - req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data) + begin + req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data) + rescue Exception => e + logger.error "[journal] ===> #{e}" + end logger.info "send over. #{req}" end end diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 22bc33cd1..f85fb7000 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -341,7 +341,11 @@ class JournalsForMessage < ActiveRecord::Base } } logger.info "start send template message: #{data}" - req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data) + begin + req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data) + rescue Exception => e + logger.error "[journal_for_message] ===> #{e}" + end logger.info "send over. #{req}" end end diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 5bfbfec01..4b7180857 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -1155,9 +1155,12 @@ class Mailer < ActionMailer::Base } logger.info "start send template message: #{data}" - req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data) + begin + req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data) + rescue Exception => e + logger.error "[mailer] ===> #{e}" + end logger.info "send over. #{req}" - end end end diff --git a/public/javascripts/wechat/app.js b/public/javascripts/wechat/app.js index 25cb0f169..4c71334cc 100644 --- a/public/javascripts/wechat/app.js +++ b/public/javascripts/wechat/app.js @@ -10,7 +10,7 @@ app.factory('auth', function($http,$routeParams, $cookies, $q){ var _openid = ''; if(debug===true){ - _openid = "6"; + _openid = "3"; } var getOpenId = function() {