From 56da43221d6b2bba36e5db78873408d6a821d50b Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Sun, 14 Aug 2016 10:28:46 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=91=E5=AE=9A?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E7=9A=84=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/wechats_controller.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/wechats_controller.rb b/app/controllers/wechats_controller.rb index fbd1f2f0c..ced8854d9 100644 --- a/app/controllers/wechats_controller.rb +++ b/app/controllers/wechats_controller.rb @@ -252,13 +252,16 @@ class WechatsController < ActionController::Base end def sendBind(request) + tmpurl = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{Wechat.config.appid}&redirect_uri=#{ROOT_URL+'/wechat/user_activities'}&response_type=code&scope=snsapi_base&state=login&connect_redirect=1#wechat_redirect" + logger.info "tmpurl!!!!!!!!!!!!!!" + logger.info tmpurl news = (1..1).each_with_object([]) { |n, memo| memo << { title: '绑定登录', content: "欢迎使用Trustie创新实践服务平台! 在这里您可以随时了解您的课程和项目动态,随时点赞和回复。 我们将会与微信不断结合,为您提供更有价值的服务。 您还未绑定确实的用户,请先绑定,谢谢!" } } request.reply.news(news) do |article, n, index| # article is return object - url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{Wechat.config.appid}&redirect_uri=#{ROOT_URL+'/wechat/user_activities'}&response_type=code&scope=snsapi_base&state=login#wechat_redirect" + url = tmpurl pic_url = "#{ROOT_URL}/images/weixin_pic.jpg" article.item title: "#{n[:title]}", description: n[:content], From 91a64a67c5017e2734f6cbc86a7cbaec55aabbe7 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Sun, 14 Aug 2016 10:46:17 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E5=92=8C=E7=BB=91=E5=AE=9A=E5=88=A4=E6=96=ADBUG=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/api/mobile/apis/users.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/api/mobile/apis/users.rb b/app/api/mobile/apis/users.rb index 96cec7b39..62376dc6e 100644 --- a/app/api/mobile/apis/users.rb +++ b/app/api/mobile/apis/users.rb @@ -37,7 +37,7 @@ module Mobile raise "此用户已经绑定过公众号, 请换一个帐户试试" if user.user_wechat - if uw && !user.real? + if uw && !uw.real? uw.migrate_user(user) else UserWechat.create!( @@ -69,7 +69,7 @@ module Mobile :should_confirmation_password => true) raise user.errors.full_messages.first if user.new_record? - if uw && !user.real? + if uw && !uw.real? user.update_attributes(:lastname=>uw.user[:lastname]) uw.migrate_user(user) else From 6cea0bfb6717cdfed3b74fd59a5325728569dbd2 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Sun, 14 Aug 2016 10:56:38 +0800 Subject: [PATCH 3/5] . --- app/models/user_wechat.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/models/user_wechat.rb b/app/models/user_wechat.rb index a96cabbe5..68ea75679 100644 --- a/app/models/user_wechat.rb +++ b/app/models/user_wechat.rb @@ -15,12 +15,12 @@ class UserWechat < ActiveRecord::Base self.save ## 主要是将comment 迁移 - User.delete(old_user) + User.delete(old_user) - JournalForMessages.where(user_id: old_user).update_all(user_id: u.id) - Journal.where(user_id: old_user).update_all(user_id: u.id) - Comment.where(author_id: old_user).update_all(author_id: u.id) - Message.where(author_id: old_user).update_all(author_id: u.id) - BlogComment.where(author_id: old_user).update_all(author_id: u.id) + Mobile::Apis.JournalForMessages.where(user_id: old_user).update_all(user_id: u.id) + Mobile::Apis.Journal.where(user_id: old_user).update_all(user_id: u.id) + Mobile::Apis.Comment.where(author_id: old_user).update_all(author_id: u.id) + Mobile::Apis.Message.where(author_id: old_user).update_all(author_id: u.id) + Mobile::Apis.BlogComment.where(author_id: old_user).update_all(author_id: u.id) end end From dc7ff8f90f9c6205f40b285076dc3e569074a4b8 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Sun, 14 Aug 2016 11:15:37 +0800 Subject: [PATCH 4/5] . --- app/models/user_wechat.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/user_wechat.rb b/app/models/user_wechat.rb index a96cabbe5..b121aa4d2 100644 --- a/app/models/user_wechat.rb +++ b/app/models/user_wechat.rb @@ -17,7 +17,7 @@ class UserWechat < ActiveRecord::Base ## 主要是将comment 迁移 User.delete(old_user) - JournalForMessages.where(user_id: old_user).update_all(user_id: u.id) + JournalForMessage.where(user_id: old_user).update_all(user_id: u.id) Journal.where(user_id: old_user).update_all(user_id: u.id) Comment.where(author_id: old_user).update_all(author_id: u.id) Message.where(author_id: old_user).update_all(author_id: u.id) From 3be75c8633972cecd62f74493e2de546b9d6c3a9 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Sun, 14 Aug 2016 11:18:23 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E5=BE=AE=E4=BF=A1BUG=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/user_wechat.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/user_wechat.rb b/app/models/user_wechat.rb index 692ead74e..8328a47df 100644 --- a/app/models/user_wechat.rb +++ b/app/models/user_wechat.rb @@ -17,7 +17,7 @@ class UserWechat < ActiveRecord::Base ## 主要是将comment 迁移 User.delete(old_user) - JournalForMessage.where(user_id: old_user).update_all(user_id: u.id) + JournalsForMessage.where(user_id: old_user).update_all(user_id: u.id) Journal.where(user_id: old_user).update_all(user_id: u.id) Comment.where(author_id: old_user).update_all(author_id: u.id) Message.where(author_id: old_user).update_all(author_id: u.id)