Method: Wechat::WechatController#auth

Defined in:
app/controllers/wechat/wechat_controller.rb

#authObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/wechat/wechat_controller.rb', line 5

def auth
  @wechat_user = WechatUser.find_or_initialize_by(uid: params[:openid])
  @wechat_user.assign_attributes params.permit(:access_token, :refresh_token, :app_id)
  @wechat_user.
  @wechat_user. =  if 
  @wechat_user.save

  if @wechat_user.user
    (@wechat_user)
    render 'auth'
  else
    render json: { oauth_user_id: @wechat_user.id }
  end
end