From 0e9c65deb04191f33009d727383bca72987df0a6 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 17 Jul 2019 19:18:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E5=86=8C=E6=8A=A5500?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/memos.rb | 2 +- app/controllers/account_controller.rb | 2 +- app/controllers/competition_teams_controller.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/api/mobile/apis/memos.rb b/app/api/mobile/apis/memos.rb index 89412316..a72b9b6c 100644 --- a/app/api/mobile/apis/memos.rb +++ b/app/api/mobile/apis/memos.rb @@ -33,7 +33,7 @@ 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) + ua = UserAgent.find_by_ip(ip) if ua.blank? UserAgent.create!(:key => params[:edu].strip, :ip => ip, :type => UserAgent::AD) end diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index d362cde3..eb4f1a82 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -379,7 +379,7 @@ class AccountController < ApplicationController @user = us.register user_params.merge(:should_confirmation_password => false) # 注册时,记录是否是引流用户 ip = request.remote_ip - ua = UserAgent.find_by_id(:ip => ip) + ua = UserAgent.find_by_ip(ip) ua.update_column(:type, UserAgent::REGISTER) if ua if !@user.new_record? self.logged_user = @user diff --git a/app/controllers/competition_teams_controller.rb b/app/controllers/competition_teams_controller.rb index 092426ef..3efaa1cf 100644 --- a/app/controllers/competition_teams_controller.rb +++ b/app/controllers/competition_teams_controller.rb @@ -349,7 +349,7 @@ class CompetitionTeamsController < ApplicationController def record_agent_user_action # 注册时,记录是否是引流用户 ip = request.remote_ip - ua = UserAgent.find_by_id(:ip => ip) + ua = UserAgent.find_by_ip(ip) ua.update_column(:type, UserAgent::COMPETITION) if ua end end