dev_aliyun
daiao 5 years ago
parent 9882ea3957
commit 9886ea4811

@ -42,7 +42,7 @@ class WelcomeController < ApplicationController
# 运营引流个人数据展示
def user_agents
@user_agents = UserAgent.where(key: params[:edu])
@user_agents = UserAgent.where(key: params[:edu]).includes(:user_actionss)
@agents_count = @user_agents.count
limit = 20
@agents_pages = Paginator.new @agents_count, limit, params['page'] || 1

@ -25,8 +25,8 @@ module WelcomeHelper
# 引流注册情况
def register_info user_agent
if user_agent.agent_type.to_i == UserAgent::USER_AD
user_id = UserActions.find_by_ip(user_agent.ip).try(:user_id)
if user_id && UserActions.where("user_id = #{user_id} and created_at < '2019-07-15 00:00:00'").present?
user_id = ua.user_actionss.first.try(:user_id)
if user_id && User.where("user_id = #{user_id} and created_on < '2019-07-15 00:00:00'").present?
"代理前注册"
else
"未转换"
@ -34,8 +34,8 @@ module WelcomeHelper
elsif user_agent.agent_type.to_i == UserAgent::USER_REGISTER || UserActions.find_by_ip(user_agent.ip)
"代理后注册"
else
user_id = UserActions.find_by_ip(user_agent.ip).try(:user_id)
if user_id && UserActions.where("user_id = #{user_id} and created_at < '2019-07-15 00:00:00'").present?
user_id = ua.user_actionss.first.try(:user_id)
if user_id && User.where("user_id = #{user_id} and created_on < '2019-07-15 00:00:00'").present?
"代理前注册"
else
"代理后注册"

@ -1,5 +1,5 @@
class UserAgent < ActiveRecord::Base
has_many :user_actionss, :foreign_key => "ip", :primary_key => "ip"
USER_AD = 1 # 广告宣传的引流
USER_REGISTER = 2 # 引流注册
USER_COMPETITION = 3 # 引流参加竞赛

Loading…
Cancel
Save