diff --git a/app/controllers/colleges_controller.rb b/app/controllers/colleges_controller.rb
index c814d957..eafc1c62 100644
--- a/app/controllers/colleges_controller.rb
+++ b/app/controllers/colleges_controller.rb
@@ -254,7 +254,10 @@ class CollegesController < ApplicationController
def manager_auth
# unless (User.current.admin? || DepartmentMember.where(:user_id => User.current.id, :department_id => @department.id).first.present?)
- unless (User.current.admin? || DepartmentMember.where(:user_id => User.current.id, :department_id => @department.id).first.present? || (User.current.user_extensions.try(:school_id) == @department.school_id && User.current.user_extensions.try(:identity) == 0))
+ unless (User.current.admin? ||
+ DepartmentMember.where(:user_id => User.current.id, :department_id => @department.id).first.present? ||
+ (User.current.user_extensions.try(:school_id) == @department.school_id && User.current.user_extensions.try(:identity) == 0) ||
+ @department.school.try(:partner_id) == User.current.partner_id)
render_403
end
end
diff --git a/app/controllers/cooperates_controller.rb b/app/controllers/cooperates_controller.rb
index 8a014d62..12467a36 100644
--- a/app/controllers/cooperates_controller.rb
+++ b/app/controllers/cooperates_controller.rb
@@ -23,7 +23,7 @@ class CooperatesController < ApplicationController
def find_partner
@partner = Partner.find_by_id(params[:id])
- render_404 if @partner.nil? || @partner.status == -1
+ render_404 if @partner.nil?
rescue ActiveRecord::RecordNotFound
render_404
end
diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb
index 3c3a92e5..31e42f05 100644
--- a/app/controllers/managements_controller.rb
+++ b/app/controllers/managements_controller.rb
@@ -792,12 +792,22 @@ class ManagementsController < ApplicationController
@menu_type = 8
@sub_type = 2
@search = params[:search]
+ @beginTime = params[:beginTime]
+ @endTime = params[:endTime]
if @search.present?
shixun_ids = Shixun.where("name like ?", "%#{params[:search]}%").pluck(:id)
@discusses = Discuss.where(:dis_type => "Shixun", :dis_id => shixun_ids).reorder("created_at desc")
else
@discusses = Discuss.where(:dis_type => "Shixun").reorder("created_at desc")
end
+
+ if params[:beginTime] && params[:beginTime].strip != ""
+ @discusses = @discusses.where("created_at >= '#{Time.parse(params[:beginTime])}'")
+ end
+ if params[:endTime] && params[:endTime].strip != ""
+ @discusses = @discusses.where("created_at <= '#{Time.parse(params[:endTime])}'")
+ end
+
@all_discusses = @discusses
@discusses_count = @discusses.count
@limit = 20
@@ -1175,6 +1185,7 @@ end
@menu_type = 6
@sub_type = 3
@partners = Partner.includes(:school).order("created_at desc")
+ @partners = @partners.where("concat(schools.name) like ? ", "%#{params[:search]}%") unless params[:search].blank?
@current_partner = nil
if params[:partner]
@@ -1241,6 +1252,15 @@ end
end
end
+ def delete_customers
+ if params[:customer]
+ customer = Customer.where(id: params[:customer]).first
+ @current_partner = customer.partner
+ customer.school.update_attributes(:customer_id => nil)
+ customer.destroy
+ end
+ end
+
def all_partners
@search = params[:search]
@province = params[:province]
@@ -1274,13 +1294,14 @@ end
if school_ids.length > 0
school_ids.each do |s|
school = School.where("id = ?",s).first
- if school.present?
+ if school.present? && school.partner_id.nil?
partner = Partner.new(name: school.name)
partner.save
school.update_attributes(:partner_id => partner.id)
end
end
end
+ render :json => {status: 1, message: "创建成功!"}
end
@@ -4241,7 +4262,8 @@ end
sheet1[count_row, 5] = discusses.count
discusses.each_with_index do |discuss, j|
user = discuss.user
- sheet1[count_row, 6] = discuss.content.gsub(/
" + " " + " " + - " " + + " " + " " + " \n" + " \n" + diff --git a/app/views/managements/_partner_addManage.html.erb b/app/views/managements/_partner_addManage.html.erb index 54a141a4..91eb6898 100644 --- a/app/views/managements/_partner_addManage.html.erb +++ b/app/views/managements/_partner_addManage.html.erb @@ -60,7 +60,7 @@ $.each(members,function (index,array) { s_html = s_html+ "
" + " " + - " " + + " " + " " + " \n" + ""+array["identity"]+"" + diff --git a/app/views/managements/_partner_addUnit.html.erb b/app/views/managements/_partner_addUnit.html.erb index 0d80e5a7..cb1ac7c5 100644 --- a/app/views/managements/_partner_addUnit.html.erb +++ b/app/views/managements/_partner_addUnit.html.erb @@ -59,7 +59,7 @@ s_html = s_html+ "
" + " " + " " + - " " + + " " + " " + " \n" + " \n" + diff --git a/app/views/managements/_partner_customer_list.html.erb b/app/views/managements/_partner_customer_list.html.erb new file mode 100644 index 00000000..4720fc96 --- /dev/null +++ b/app/views/managements/_partner_customer_list.html.erb @@ -0,0 +1,20 @@ +