diff --git a/app/api/mobile/apis/memos.rb b/app/api/mobile/apis/memos.rb index a72b9b6c..01f1e79e 100644 --- a/app/api/mobile/apis/memos.rb +++ b/app/api/mobile/apis/memos.rb @@ -35,7 +35,7 @@ module Mobile ip = @env['HTTP_X_REAL_IP'] ua = UserAgent.find_by_ip(ip) if ua.blank? - UserAgent.create!(:key => params[:edu].strip, :ip => ip, :type => UserAgent::AD) + UserAgent.create!(:key => params[:edu].strip, :ip => ip, :type => UserAgent::USER_AD) end end MemosService.new.show params, current_user diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index eb4f1a82..ad49d1ad 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -380,7 +380,7 @@ class AccountController < ApplicationController # 注册时,记录是否是引流用户 ip = request.remote_ip ua = UserAgent.find_by_ip(ip) - ua.update_column(:type, UserAgent::REGISTER) if ua + ua.update_column(:type, UserAgent::USER_REGISTER) if ua if !@user.new_record? self.logged_user = @user flash[:notice] = l(:notice_account_activated) diff --git a/app/controllers/competition_teams_controller.rb b/app/controllers/competition_teams_controller.rb index 9159cf07..563faffe 100644 --- a/app/controllers/competition_teams_controller.rb +++ b/app/controllers/competition_teams_controller.rb @@ -350,6 +350,6 @@ class CompetitionTeamsController < ApplicationController # 记录是否是引流用户的行为 ip = request.remote_ip ua = UserAgent.find_by_ip(ip) - ua.update_column(:type, UserAgent::COMPETITION) if ua + ua.update_column(:type, UserAgent::USER_COMPETITION) if ua end end diff --git a/app/models/user_agent.rb b/app/models/user_agent.rb index 9c0e6cfe..acc45a8a 100644 --- a/app/models/user_agent.rb +++ b/app/models/user_agent.rb @@ -1,6 +1,6 @@ class UserAgent < ActiveRecord::Base - AD = 1 # 广告宣传的引流 - REGISTER = 2 # 引流注册 - COMPETITION = 3 # 引流参加竞赛 + USER_AD = 1 # 广告宣传的引流 + USER_REGISTER = 2 # 引流注册 + USER_COMPETITION = 3 # 引流参加竞赛 end