diff --git a/app/controllers/wechats_controller.rb b/app/controllers/wechats_controller.rb index 120de197a..bdd11d660 100644 --- a/app/controllers/wechats_controller.rb +++ b/app/controllers/wechats_controller.rb @@ -16,6 +16,8 @@ class WechatsController < ActionController::Base return join_class(content, uw.user) end rescue => e + logger.error e.inspect + logger.error e.backtrace.join("\n") return request.reply.text e end end @@ -54,6 +56,8 @@ class WechatsController < ActionController::Base return join_class({ticket: ticket}, uw.user) end rescue => e + logger.error e.inspect + logger.error e.backtrace.join("\n") return request.reply.text e end end diff --git a/app/models/course.rb b/app/models/course.rb index b8ec4181d..d36f0e636 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -424,12 +424,14 @@ class Course < ActiveRecord::Base # __elasticsearch__.delete_document # end def create_course_ealasticsearch_index + return if Rails.env.development? if self.is_public == 1 and self.is_delete == 0 #公开 和 没有被删除的课程才被索引 self.__elasticsearch__.index_document end end def update_course_ealasticsearch_index + return if Rails.env.development? if self.is_public == 1 and self.is_delete == 0 #如果是初次更新成为公开或者恢复被删除的情况,会报错,那么这条记录尚未被索引过。没有报错就是更新的其他属性 begin self.__elasticsearch__.update_document @@ -446,6 +448,7 @@ class Course < ActiveRecord::Base end def delete_course_ealasticsearch_index + return if Rails.env.development? begin self.__elasticsearch__.delete_document rescue => e diff --git a/config/wechat.yml b/config/wechat.yml index cf5be1f2b..711f2f1f8 100644 --- a/config/wechat.yml +++ b/config/wechat.yml @@ -5,11 +5,11 @@ default: &default # Or if using public account, only need above two line # guange test - #appid: "wxf694495398c7d470" - #secret: "743e038392f1d89540e95f8f7645849a" + appid: "wxf694495398c7d470" + secret: "743e038392f1d89540e95f8f7645849a" - appid: "wx8e1ab05163a28e37" - secret: "beb4d3bc4b32b3557811680835357841" +# appid: "wx8e1ab05163a28e37" +# secret: "beb4d3bc4b32b3557811680835357841" token: "123456" access_token: "1234567"