From de3a76fee97a7454f8bd6a86090e1081080bc8c2 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 18 Jul 2019 08:50:43 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E5=BC=95=E6=B5=81=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/memos.rb | 2 +- app/controllers/account_controller.rb | 2 +- app/controllers/competition_teams_controller.rb | 2 +- app/models/user_agent.rb | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) 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 From 1aba3212c69bb3f05d53dfa5a34d5df4f5e166c6 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Thu, 18 Jul 2019 08:56:13 +0800 Subject: [PATCH 2/5] fix library form cover --- app/views/libraries/_form.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/libraries/_form.html.erb b/app/views/libraries/_form.html.erb index 0b5201e3..6a1afdef 100644 --- a/app/views/libraries/_form.html.erb +++ b/app/views/libraries/_form.html.erb @@ -73,7 +73,7 @@
- <% cover_url = cover_exists ? named_attachment_path(@library.cover.id, @library.cover.filename) : '' %> + <% cover_url = cover_exists ? download_attachment_path(@library.cover_id) : '' %>
From 4228780e85b60b64c576a94b9de5a47a02170a05 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 18 Jul 2019 09:01:41 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=BC=95=E6=B5=81?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/memos.rb | 2 +- app/controllers/account_controller.rb | 2 +- app/controllers/competition_teams_controller.rb | 2 +- db/migrate/20190718005920_modify_type_for_user_agents.rb | 8 ++++++++ 4 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 db/migrate/20190718005920_modify_type_for_user_agents.rb diff --git a/app/api/mobile/apis/memos.rb b/app/api/mobile/apis/memos.rb index 01f1e79e..a167a214 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::USER_AD) + UserAgent.create!(:key => params[:edu].strip, :ip => ip, :agent_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 ad49d1ad..64833a14 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::USER_REGISTER) if ua + ua.update_column(:agent_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 563faffe..5e76d263 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::USER_COMPETITION) if ua + ua.update_column(:agent_type, UserAgent::USER_COMPETITION) if ua end end diff --git a/db/migrate/20190718005920_modify_type_for_user_agents.rb b/db/migrate/20190718005920_modify_type_for_user_agents.rb new file mode 100644 index 00000000..72d4f99b --- /dev/null +++ b/db/migrate/20190718005920_modify_type_for_user_agents.rb @@ -0,0 +1,8 @@ +class ModifyTypeForUserAgents < ActiveRecord::Migration + def up + rename_column :user_agents, :type, :agent_type + end + + def down + end +end From e115495effb048c54ad1e52bbd3e2d15f4ea0de4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Thu, 18 Jul 2019 09:18:36 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/competitions/competitionsName.html.erb.html | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/app/views/competitions/competitionsName.html.erb.html b/app/views/competitions/competitionsName.html.erb.html index 0ae6e2e6..e0248043 100644 --- a/app/views/competitions/competitionsName.html.erb.html +++ b/app/views/competitions/competitionsName.html.erb.html @@ -8,7 +8,6 @@ bottom: 0px; right: 0px; } -ddd
@@ -18,15 +17,6 @@ ddd
- -
From 7b19036cb424f3c12e8c84b8fadb057c5ab4419e Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 18 Jul 2019 09:25:36 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E6=88=98=E9=98=9F?= =?UTF-8?q?=E6=97=B6=E6=90=9C=E7=B4=A2=E7=94=A8=E6=88=B7=E9=99=90=E5=88=B6?= =?UTF-8?q?=E5=9C=A820=E4=B8=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/competition_teams_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/competition_teams_controller.rb b/app/controllers/competition_teams_controller.rb index 5e76d263..06d504b2 100644 --- a/app/controllers/competition_teams_controller.rb +++ b/app/controllers/competition_teams_controller.rb @@ -51,7 +51,7 @@ class CompetitionTeamsController < ApplicationController end condition = "%#{params[:search].strip}%".gsub(" ","") - @teachers = User.joins(:user_extensions).where("status = 1 and LOWER(concat(lastname, firstname, login, nickname)) LIKE '#{condition}' and user_extensions.identity = 0") + @teachers = User.joins(:user_extensions).where("status = 1 and LOWER(concat(lastname, firstname, login, nickname)) LIKE '#{condition}' and user_extensions.identity = 0").limit(20) end def search_non_user @@ -71,7 +71,7 @@ class CompetitionTeamsController < ApplicationController end user_ids = user_ids.length > 0 ? "(" + user_ids.uniq.join(',') + ")" : "(-1)" condition = "%#{params[:search].strip}%".gsub(" ","") - @users = User.joins(:user_extensions).where("users.id not in #{user_ids} and status = 1 and user_extensions.identity = 1 and LOWER(concat(lastname, firstname, login, nickname)) LIKE '#{condition}'") + @users = User.joins(:user_extensions).where("users.id not in #{user_ids} and status = 1 and user_extensions.identity = 1 and LOWER(concat(lastname, firstname, login, nickname)) LIKE '#{condition}'").limit(20) end def create