登录注册记录引流的行为

dev_aliyun
daiao 5 years ago
parent 1b631e6d95
commit f8eff25139

@ -377,10 +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 = 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::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)

@ -114,9 +114,7 @@ class CompetitionTeamsController < ApplicationController
new_team.team_members.create!(user_id: user_id, role: 3, competition_id: @competition.id, is_teacher: 1) new_team.team_members.create!(user_id: user_id, role: 3, competition_id: @competition.id, is_teacher: 1)
end end
# 创建时,记录是否是引流用户 # 创建时,记录是否是引流用户
# ip = request.remote_ip record_agent_user_action
# ua = UserAgent.find_by_ip(ip)
# ua.update_column(:type, UserAgent::COMPETITION) if ua
end end
end end
@ -230,10 +228,8 @@ class CompetitionTeamsController < ApplicationController
end end
team.team_members.create!(user_id: User.current.id, role: 2, competition_id: @competition.id) team.team_members.create!(user_id: User.current.id, role: 2, competition_id: @competition.id)
# # 创建时,记录是否是引流用户 # 记录引流
# ip = request.remote_ip record_agent_user_action
# ua = UserAgent.find_by_ip(ip)
# ua.update_column(:type, UserAgent::COMPETITION) if ua
end end
end end
@ -351,7 +347,7 @@ class CompetitionTeamsController < ApplicationController
end end
def record_agent_user_action def record_agent_user_action
# 注册时,记录是否是引流用户 # 记录是否是引流用户的行为
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::COMPETITION) if ua

Loading…
Cancel
Save