From 6eca6253dbaade78cb83d01a18857932286dae02 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Sun, 14 Aug 2016 12:29:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E6=B3=A8=E5=86=8C=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E6=BF=80=E6=B4=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/new_comment.rb | 5 +++-- app/api/mobile/apis/users.rb | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/api/mobile/apis/new_comment.rb b/app/api/mobile/apis/new_comment.rb index 02411c080..872225e47 100644 --- a/app/api/mobile/apis/new_comment.rb +++ b/app/api/mobile/apis/new_comment.rb @@ -56,9 +56,10 @@ module Mobile user = us.register ({:login=>openid, :mail=>"#{openid}@163.com", :password=>"12345678", :password_confirmation=>"12345678", :should_confirmation_password => true}) - user.update_attributes(:lastname=>name) - raise user.errors.full_messages.first if user.new_record? + user.update_attributes(:lastname=>name) + #自动激活 + user = automatically_register(user) UserWechat.create!( openid: openid, user: user, diff --git a/app/api/mobile/apis/users.rb b/app/api/mobile/apis/users.rb index 62376dc6e..08f037588 100644 --- a/app/api/mobile/apis/users.rb +++ b/app/api/mobile/apis/users.rb @@ -2,6 +2,7 @@ module Mobile module Apis class Users < Grape::API + include AccountHelper resource :users do desc "查询是否已绑定" @@ -68,6 +69,8 @@ module Mobile user = us.register params.merge(:password_confirmation => params[:password], :should_confirmation_password => true) raise user.errors.full_messages.first if user.new_record? + #自动激活 + user = automatically_register(user) if uw && !uw.real? user.update_attributes(:lastname=>uw.user[:lastname])