已绑定成功的,直接提示
This commit is contained in:
parent
b48b1c97b3
commit
622d71c476
|
@ -162,7 +162,6 @@ class WechatsController < ActionController::Base
|
|||
code = params[:code] || session[:wechat_code]
|
||||
openid = get_openid_from_code(code)
|
||||
|
||||
|
||||
raise "无法获取到微信openid" unless openid
|
||||
render :json => {status:0, openid: openid}
|
||||
rescue Exception=>e
|
||||
|
@ -197,6 +196,9 @@ class WechatsController < ActionController::Base
|
|||
|
||||
def login
|
||||
session[:wechat_code] = params[:code] if params[:code]
|
||||
openid = get_openid_from_code(code)
|
||||
@wechat_user = user_binded?(openid)
|
||||
|
||||
render 'wechats/login', layout: 'base_wechat'
|
||||
end
|
||||
|
||||
|
|
|
@ -1,4 +1,22 @@
|
|||
<% if @wechat_user %>
|
||||
|
||||
<div class="page">
|
||||
<div class="weui_msg">
|
||||
<div class="weui_icon_area"><i class="weui_icon_success weui_icon_msg"></i></div>
|
||||
<div class="weui_text_area">
|
||||
<h2 class="weui_msg_title">操作成功</h2>
|
||||
<p class="weui_msg_desc">您已经绑定过微信了,用户名: (<%= @wechat_user.user.login %>)</p>
|
||||
</div>
|
||||
<div class="weui_opr_area">
|
||||
<p class="weui_btn_area">
|
||||
<a href="javascript:close();" class="weui_btn weui_btn_primary">确定</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% else %>
|
||||
<div class="loginIn">
|
||||
<div>
|
||||
<p class="weui_cells_title wechat-error">
|
||||
|
@ -64,3 +82,6 @@
|
|||
})
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<% end %>
|
Loading…
Reference in New Issue