You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/app/controllers/admins/shixun_feedback_messages_co...

22 lines
760 B

class Admins::ShixunFeedbackMessagesController < Admins::BaseController
def index
@params_page = params[:page] || 1
if params[:keyword].present?
discusses = Discuss.joins("LEFT JOIN shixuns ON discusses.dis_id = shixuns.id AND dis_type = 'Shixun'")
.where("shixuns.name like ?", "%#{params[:keyword]}%")
else
discusses = Discuss.where(:dis_type => 'Shixun').includes(:user, :dis)
end
if params[:begin_date].present?
discusses = discusses.where("discusses.created_at > ?", params[:begin_date])
end
if params[:end_date].present?
discusses = discusses.where("discusses.created_at < ?", params[:end_date])
end
@discusses = paginate discusses.order("created_at desc")
end
end