From babf30af0ae7fbb3cc63c6093bf1bacc8a4cbf00 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 19 Jan 2016 15:06:40 +0800 Subject: [PATCH] =?UTF-8?q?=E7=95=8C=E9=9D=A2=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/wechats_controller.rb | 5 +++-- app/views/wechats/bind.html.erb | 14 ++++++++++++++ app/views/wechats/login.html.erb | 15 ++++++++++++++- 3 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 app/views/wechats/bind.html.erb diff --git a/app/controllers/wechats_controller.rb b/app/controllers/wechats_controller.rb index 017886194..a83969d39 100644 --- a/app/controllers/wechats_controller.rb +++ b/app/controllers/wechats_controller.rb @@ -142,8 +142,9 @@ class WechatsController < ActionController::Base raise "用户名或密码错误,请重新登录" unless user #补全用户信息 - user.user_wechat = UserWechat.find_by_id(params[:openid]) - user.save! + uw = UserWechat.find_by_id(params[:openid]) + uw.user = user + uw.save! rescue Exception=>e @wechat_bind_errors = e.message render :login diff --git a/app/views/wechats/bind.html.erb b/app/views/wechats/bind.html.erb new file mode 100644 index 000000000..e569162b2 --- /dev/null +++ b/app/views/wechats/bind.html.erb @@ -0,0 +1,14 @@ + + +
+恭喜! 绑定成功.
+ + + \ No newline at end of file diff --git a/app/views/wechats/login.html.erb b/app/views/wechats/login.html.erb index 44fc1da32..cbc476f26 100644 --- a/app/views/wechats/login.html.erb +++ b/app/views/wechats/login.html.erb @@ -1,3 +1,13 @@ + + + +@@ -29,4 +39,7 @@ <% end %> -