dev_aliyun
cxt 5 years ago
commit ee6dfc3dfe

@ -33,9 +33,9 @@ module Mobile
if params[:edu]
Rails.logger.info("####11111222##{@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
UserAgent.create(:key => params[:edu].strip, :ip => ip, :type => UserAgent::AD)
UserAgent.create!(:key => params[:edu].strip, :ip => ip, :type => UserAgent::AD)
end
end
MemosService.new.show params, current_user

@ -377,6 +377,10 @@ class AccountController < ApplicationController
else
us = UsersService.new
@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?
self.logged_user = @user
flash[:notice] = l(:notice_account_activated)

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

@ -136,10 +136,6 @@ class UsersService
ue = @user.user_extensions ||= UserExtensions.new
ue.user_id = @user.id
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
@user
#img_url = url_to_avatar(@user)

Loading…
Cancel
Save