dev_aliyun
cxt 5 years ago
commit ee6dfc3dfe

@ -33,9 +33,9 @@ module Mobile
if params[:edu] if params[:edu]
Rails.logger.info("####11111222##{@env['HTTP_X_REAL_IP']}") Rails.logger.info("####11111222##{@env['HTTP_X_REAL_IP']}")
ip = @env['HTTP_X_REAL_IP'] ip = @env['HTTP_X_REAL_IP']
ua = UserAgent.where(:ip => ip, :type => UserAgent::AD) ua = UserAgent.where(:ip => ip)
unless ua unless ua
UserAgent.create(:key => params[:edu].strip, :ip => ip, :type => UserAgent::AD) UserAgent.create!(:key => params[:edu].strip, :ip => ip, :type => UserAgent::AD)
end end
end end
MemosService.new.show params, current_user MemosService.new.show params, current_user

@ -377,6 +377,10 @@ class AccountController < ApplicationController
else else
us = UsersService.new us = UsersService.new
@user = us.register user_params.merge(:should_confirmation_password => false) @user = us.register user_params.merge(:should_confirmation_password => false)
# 注册时,记录是否是引流用户
ip = @env['HTTP_X_REAL_IP']
ua = UserAgent.find_by_id(:ip => ip)
ua.update_column(:type, UserAgent::REGISTER) if ua
if !@user.new_record? if !@user.new_record?
self.logged_user = @user self.logged_user = @user
flash[:notice] = l(:notice_account_activated) flash[:notice] = l(:notice_account_activated)

@ -349,9 +349,7 @@ class CompetitionTeamsController < ApplicationController
def record_agent_user_action def record_agent_user_action
# 注册时,记录是否是引流用户 # 注册时,记录是否是引流用户
ip = @env['HTTP_X_REAL_IP'] ip = @env['HTTP_X_REAL_IP']
ua = UserAgent.where(:ip => ip, :type => UserAgent::AD).take ua = UserAgent.find_by_id(:ip => ip)
if ua && UserAgent.where(:ip => ip, :type => UserAgent::COMPETITION).blank? ua.update_column(:type, UserAgent::COMPETITION) if ua
UserAgent.create(:key => ua.key, :ip => ip, :type => UserAgent::COMPETITION, :user_id => User.current.id)
end
end end
end end

@ -136,10 +136,6 @@ class UsersService
ue = @user.user_extensions ||= UserExtensions.new ue = @user.user_extensions ||= UserExtensions.new
ue.user_id = @user.id ue.user_id = @user.id
ue.save ue.save
# 注册时,记录是否是引流用户
ip = @env['HTTP_X_REAL_IP']
ua = UserAgent.where(:ip => ip, :type => UserAgent::AD).take
UserAgent.create(:key => ua.key, :ip => ip, :type => UserAgent::REGISTER, :user_id => @user.id) if ua
end end
@user @user
#img_url = url_to_avatar(@user) #img_url = url_to_avatar(@user)

Loading…
Cancel
Save