From f7e8c5232c0e80d908df7ad9304f7358b38d9a19 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 1 Aug 2016 09:50:05 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E9=A1=B9=E7=9B=AE=EF=BC=8C=E5=A6=82=E6=9E=9C?= =?UTF-8?q?=E5=B7=B2=E7=BB=8F=E7=94=B3=E8=AF=B7=E4=BA=86=E5=88=99=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E5=B7=B2=E7=94=B3=E8=AF=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 2 +- app/controllers/applied_project_controller.rb | 2 ++ app/views/applied_project/_applied_project_tip.js.erb | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 6e8a4dcdf..6ee66a592 100644 --- a/Gemfile +++ b/Gemfile @@ -50,7 +50,7 @@ gem 'elasticsearch-model' gem 'elasticsearch-rails' #rails 3.2.22.2 bug -gem "test-unit", "~>3.0" +# gem "test-unit", "~>3.0" ### profile # gem 'oneapm_rpm' diff --git a/app/controllers/applied_project_controller.rb b/app/controllers/applied_project_controller.rb index 539a974c1..883fd1c68 100644 --- a/app/controllers/applied_project_controller.rb +++ b/app/controllers/applied_project_controller.rb @@ -59,6 +59,8 @@ class AppliedProjectController < ApplicationController @flag = 2 elsif params[:member].nil? @flag = 3 + elsif !AppliedProject.where(:project_id => @project.id, :user_id => User.current.id).first.nil? + @flag = 5 else @flag = 4 role = params[:member] == "member_manager" ? 3 : (params[:member] == "member_developer" ? 4 :5) diff --git a/app/views/applied_project/_applied_project_tip.js.erb b/app/views/applied_project/_applied_project_tip.js.erb index 56e5270d6..c2bc555db 100644 --- a/app/views/applied_project/_applied_project_tip.js.erb +++ b/app/views/applied_project/_applied_project_tip.js.erb @@ -15,6 +15,8 @@

请选择一个角色

<% elsif @flag == 4 %>

您的申请已提交,请等待项目管理员审批

+ <% elsif @flag == 5 %> +

您已经申请加入该项目了,请耐心等待

<% end %>
  • From 8a8860bd6c37f665dd4a033789159839dcea5726 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 1 Aug 2016 09:51:13 +0800 Subject: [PATCH 2/4] =?UTF-8?q?gemfile=E6=B3=A8=E9=87=8A=E5=90=8E=E6=81=A2?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 6ee66a592..1c1edfd35 100644 --- a/Gemfile +++ b/Gemfile @@ -50,10 +50,10 @@ gem 'elasticsearch-model' gem 'elasticsearch-rails' #rails 3.2.22.2 bug -# gem "test-unit", "~>3.0" +gem "test-unit", "~>3.0" ### profile -# gem 'oneapm_rpm' +gem 'oneapm_rpm' group :development do gem 'grape-swagger' From 3bc696a5972f46598f5cd33902a85856acbd6803 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 1 Aug 2016 13:57:55 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E5=AD=A6=E6=A0=A1?= =?UTF-8?q?=E7=9A=84=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 6 ++++-- db/schema.rb | 28 +++++++++++++++++++++++----- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 935ca1d71..0b165b7c5 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -676,7 +676,9 @@ class AdminController < ApplicationController users.each do |user| user.update_column("school_id", school[0].id) end - aas.school.destroy + if aas.school_id != school[0].id.to_i + aas.school.destroy + end aas.update_attribute(:school_id, school[0].id) rescue Exception => e puts e @@ -687,7 +689,7 @@ class AdminController < ApplicationController end def all_schools - apply_schools = ApplyAddSchools.where("status != 1") + apply_schools = ApplyAddSchools.where("status = 0") apply_school_ids = apply_schools.empty? ? "(-1)" : "(" + apply_schools.map{|sc| sc.school_id}.join(',') + ")" if !params[:search].nil? search = "%#{params[:search].to_s.strip.downcase}%" diff --git a/db/schema.rb b/db/schema.rb index c7d918346..d8b93da88 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20160725091759) do +ActiveRecord::Schema.define(:version => 20160729124833) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -52,9 +52,24 @@ ActiveRecord::Schema.define(:version => 20160725091759) do add_index "api_keys", ["access_token"], :name => "index_api_keys_on_access_token" add_index "api_keys", ["user_id"], :name => "index_api_keys_on_user_id" + create_table "applied_messages", :force => true do |t| + t.integer "user_id" + t.integer "applied_id" + t.string "applied_type" + t.integer "viewed", :default => 0 + t.integer "status", :default => 0 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "name" + t.integer "applied_user_id" + t.integer "role" + t.integer "project_id" + end + create_table "applied_projects", :force => true do |t| - t.integer "project_id", :null => false - t.integer "user_id", :null => false + t.integer "project_id", :null => false + t.integer "user_id", :null => false + t.integer "role", :default => 0 end create_table "apply_add_schools", :force => true do |t| @@ -1106,9 +1121,10 @@ ActiveRecord::Schema.define(:version => 20160725091759) do end create_table "member_roles", :force => true do |t| - t.integer "member_id", :null => false - t.integer "role_id", :null => false + t.integer "member_id", :null => false + t.integer "role_id", :null => false t.integer "inherited_from" + t.integer "is_current", :default => 1 end add_index "member_roles", ["member_id"], :name => "index_member_roles_on_member_id" @@ -1539,6 +1555,8 @@ ActiveRecord::Schema.define(:version => 20160725091759) do t.integer "boards_reply_count", :default => 0 t.integer "visits", :default => 0 t.integer "hot", :default => 0 + t.string "invite_code" + t.string "qrcode" end add_index "projects", ["lft"], :name => "index_projects_on_lft" From 0ffeec64e3c3a5879fede8a7f86813d5263d734a Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 1 Aug 2016 16:10:57 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=8D=95=E4=BD=8D=E5=AE=A1=E6=A0=B8bug?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/admin/applied_schools.html.erb | 2 +- app/views/admin/has_applied_schools.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/admin/applied_schools.html.erb b/app/views/admin/applied_schools.html.erb index 2f139ca72..d1f0acfa1 100644 --- a/app/views/admin/applied_schools.html.erb +++ b/app/views/admin/applied_schools.html.erb @@ -55,7 +55,7 @@ <%= apply.name %> - + <% user = User.where("id=?", apply.user_id).first %> diff --git a/app/views/admin/has_applied_schools.html.erb b/app/views/admin/has_applied_schools.html.erb index 1b6341fb3..971c8cb0d 100644 --- a/app/views/admin/has_applied_schools.html.erb +++ b/app/views/admin/has_applied_schools.html.erb @@ -60,7 +60,7 @@ <% unless apply.school_id.nil? %> <% school_name = School.where("id=?", apply.school_id).first %> <%= school_name.name %> - + <% end %>