引流数据

dev_aliyun
daiao 6 years ago
parent f8eff25139
commit de3a76fee9

@ -35,7 +35,7 @@ module Mobile
ip = @env['HTTP_X_REAL_IP'] ip = @env['HTTP_X_REAL_IP']
ua = UserAgent.find_by_ip(ip) ua = UserAgent.find_by_ip(ip)
if ua.blank? 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
end end
MemosService.new.show params, current_user MemosService.new.show params, current_user

@ -380,7 +380,7 @@ class AccountController < ApplicationController
# 注册时,记录是否是引流用户 # 注册时,记录是否是引流用户
ip = request.remote_ip ip = request.remote_ip
ua = UserAgent.find_by_ip(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? if !@user.new_record?
self.logged_user = @user self.logged_user = @user
flash[:notice] = l(:notice_account_activated) flash[:notice] = l(:notice_account_activated)

@ -350,6 +350,6 @@ class CompetitionTeamsController < ApplicationController
# 记录是否是引流用户的行为 # 记录是否是引流用户的行为
ip = request.remote_ip ip = request.remote_ip
ua = UserAgent.find_by_ip(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
end end

@ -1,6 +1,6 @@
class UserAgent < ActiveRecord::Base class UserAgent < ActiveRecord::Base
AD = 1 # 广告宣传的引流 USER_AD = 1 # 广告宣传的引流
REGISTER = 2 # 引流注册 USER_REGISTER = 2 # 引流注册
COMPETITION = 3 # 引流参加竞赛 USER_COMPETITION = 3 # 引流参加竞赛
end end

Loading…
Cancel
Save