|
|
@ -792,12 +792,22 @@ class ManagementsController < ApplicationController
|
|
|
|
@menu_type = 8
|
|
|
|
@menu_type = 8
|
|
|
|
@sub_type = 2
|
|
|
|
@sub_type = 2
|
|
|
|
@search = params[:search]
|
|
|
|
@search = params[:search]
|
|
|
|
|
|
|
|
@beginTime = params[:beginTime]
|
|
|
|
|
|
|
|
@endTime = params[:endTime]
|
|
|
|
if @search.present?
|
|
|
|
if @search.present?
|
|
|
|
shixun_ids = Shixun.where("name like ?", "%#{params[:search]}%").pluck(:id)
|
|
|
|
shixun_ids = Shixun.where("name like ?", "%#{params[:search]}%").pluck(:id)
|
|
|
|
@discusses = Discuss.where(:dis_type => "Shixun", :dis_id => shixun_ids).reorder("created_at desc")
|
|
|
|
@discusses = Discuss.where(:dis_type => "Shixun", :dis_id => shixun_ids).reorder("created_at desc")
|
|
|
|
else
|
|
|
|
else
|
|
|
|
@discusses = Discuss.where(:dis_type => "Shixun").reorder("created_at desc")
|
|
|
|
@discusses = Discuss.where(:dis_type => "Shixun").reorder("created_at desc")
|
|
|
|
end
|
|
|
|
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
|
|
|
|
@all_discusses = @discusses
|
|
|
|
@discusses_count = @discusses.count
|
|
|
|
@discusses_count = @discusses.count
|
|
|
|
@limit = 20
|
|
|
|
@limit = 20
|
|
|
@ -1175,6 +1185,7 @@ end
|
|
|
|
@menu_type = 6
|
|
|
|
@menu_type = 6
|
|
|
|
@sub_type = 3
|
|
|
|
@sub_type = 3
|
|
|
|
@partners = Partner.includes(:school).order("created_at desc")
|
|
|
|
@partners = Partner.includes(:school).order("created_at desc")
|
|
|
|
|
|
|
|
@partners = @partners.where("concat(schools.name) like ? ", "%#{params[:search]}%") unless params[:search].blank?
|
|
|
|
|
|
|
|
|
|
|
|
@current_partner = nil
|
|
|
|
@current_partner = nil
|
|
|
|
if params[:partner]
|
|
|
|
if params[:partner]
|
|
|
@ -1241,6 +1252,15 @@ end
|
|
|
|
end
|
|
|
|
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
|
|
|
|
def all_partners
|
|
|
|
@search = params[:search]
|
|
|
|
@search = params[:search]
|
|
|
|
@province = params[:province]
|
|
|
|
@province = params[:province]
|
|
|
@ -1274,13 +1294,14 @@ end
|
|
|
|
if school_ids.length > 0
|
|
|
|
if school_ids.length > 0
|
|
|
|
school_ids.each do |s|
|
|
|
|
school_ids.each do |s|
|
|
|
|
school = School.where("id = ?",s).first
|
|
|
|
school = School.where("id = ?",s).first
|
|
|
|
if school.present?
|
|
|
|
if school.present? && school.partner_id.nil?
|
|
|
|
partner = Partner.new(name: school.name)
|
|
|
|
partner = Partner.new(name: school.name)
|
|
|
|
partner.save
|
|
|
|
partner.save
|
|
|
|
school.update_attributes(:partner_id => partner.id)
|
|
|
|
school.update_attributes(:partner_id => partner.id)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
render :json => {status: 1, message: "创建成功!"}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -4241,7 +4262,8 @@ end
|
|
|
|
sheet1[count_row, 5] = discusses.count
|
|
|
|
sheet1[count_row, 5] = discusses.count
|
|
|
|
discusses.each_with_index do |discuss, j|
|
|
|
|
discusses.each_with_index do |discuss, j|
|
|
|
|
user = discuss.user
|
|
|
|
user = discuss.user
|
|
|
|
sheet1[count_row, 6] = discuss.content.gsub(/<img.*\/>/, "【图片评论】").gsub(/!\[\].+\)/, "【图片评论】")
|
|
|
|
content = discuss.content.gsub(/<img.*\/>/, "【图片评论】").gsub(/!\[\].+\)/, "【图片评论】")
|
|
|
|
|
|
|
|
sheet1[count_row, 6] = strip_html content
|
|
|
|
sheet1[count_row, 7] = "第#{discuss.position}关"
|
|
|
|
sheet1[count_row, 7] = "第#{discuss.position}关"
|
|
|
|
sheet1[count_row, 8] = user.show_real_name
|
|
|
|
sheet1[count_row, 8] = user.show_real_name
|
|
|
|
sheet1[count_row, 9] = user.identity
|
|
|
|
sheet1[count_row, 9] = user.identity
|
|
|
|