Merge remote-tracking branch 'origin/educoder' into educoder

dev_aliyun
杨树明 6 years ago
commit 20071b3dea

@ -377,10 +377,10 @@ class AccountController < ApplicationController
else
us = UsersService.new
@user = us.register user_params.merge(:should_confirmation_password => false)
# 注册时,记录是否是引流用户
ip = request.remote_ip
ua = UserAgent.find_by_ip(ip)
ua.update_column(:type, UserAgent::REGISTER) if ua
# # 注册时,记录是否是引流用户
# ip = request.remote_ip
# ua = UserAgent.find_by_ip(ip)
# ua.update_column(:type, UserAgent::REGISTER) if ua
if !@user.new_record?
self.logged_user = @user
flash[:notice] = l(:notice_account_activated)

@ -114,9 +114,9 @@ class CompetitionTeamsController < ApplicationController
new_team.team_members.create!(user_id: user_id, role: 3, competition_id: @competition.id, is_teacher: 1)
end
# 创建时,记录是否是引流用户
ip = request.remote_ip
ua = UserAgent.find_by_ip(ip)
ua.update_column(:type, UserAgent::COMPETITION) if ua
# ip = request.remote_ip
# ua = UserAgent.find_by_ip(ip)
# ua.update_column(:type, UserAgent::COMPETITION) if ua
end
end
@ -230,10 +230,10 @@ class CompetitionTeamsController < ApplicationController
end
team.team_members.create!(user_id: User.current.id, role: 2, competition_id: @competition.id)
# 创建时,记录是否是引流用户
ip = request.remote_ip
ua = UserAgent.find_by_ip(ip)
ua.update_column(:type, UserAgent::COMPETITION) if ua
# # 创建时,记录是否是引流用户
# ip = request.remote_ip
# ua = UserAgent.find_by_ip(ip)
# ua.update_column(:type, UserAgent::COMPETITION) if ua
end
end

@ -2,7 +2,7 @@ class Library < ActiveRecord::Base
include AASM
belongs_to :user
belongs_to :cover, class_name: 'Attachment', foreign_key: :cover_id, optional: true
belongs_to :cover, class_name: 'Attachment', foreign_key: :cover_id
has_many :library_applies, dependent: :delete_all
has_many :attachments, as: :container

Loading…
Cancel
Save