|
|
@ -1185,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]
|
|
|
@ -1256,7 +1257,7 @@ end
|
|
|
|
customer = Customer.where(id: params[:customer]).first
|
|
|
|
customer = Customer.where(id: params[:customer]).first
|
|
|
|
@current_partner = customer.partner
|
|
|
|
@current_partner = customer.partner
|
|
|
|
customer.school.update_attributes(:customer_id => nil)
|
|
|
|
customer.school.update_attributes(:customer_id => nil)
|
|
|
|
customer.destroy if customer && @current_partner
|
|
|
|
customer.destroy
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
@ -1293,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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|