This commit is contained in:
guange 2016-08-13 13:53:21 +08:00
parent 4a88fbe3db
commit fc74e714ee
1 changed files with 1 additions and 6 deletions

View File

@ -19,15 +19,10 @@ module Mobile
raise "无法获取到openid,请在微信中打开本页面" unless openid raise "无法获取到openid,请在微信中打开本页面" unless openid
us = UsersService.new us = UsersService.new
userinfo = Wechat.api.user(openid) user = us.register ({:login=>openid, :mail=>"#{openid}@163.com",
name = userinfo["nickname"]
user = us.register ({:login=>openid, :mail=>login+"@163.com",
:password=>"12345678", :password_confirmation=>"12345678", :password=>"12345678", :password_confirmation=>"12345678",
:should_confirmation_password => true}) :should_confirmation_password => true})
user.update_attributes(:lastname=>name)
raise user.errors.full_messages.first if user.new_record? raise user.errors.full_messages.first if user.new_record?
UserWechat.create!( UserWechat.create!(
openid: openid, openid: openid,