From e7f818deb9e62b599ab126b781eedbeef148a4bb Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Wed, 19 Aug 2015 09:20:39 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=BA=93=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 2caae19e1..bc9394716 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1146,25 +1146,25 @@ class UsersController < ApplicationController # @attachments = Attachment.where("author_id = #{params[:id]} and container_type not in ('Version','PhoneAppVersion','StudentWork') and is_public = 1 and (filename like '%#{search}%') ").order("created_on desc") # end if(params[:type].nil? || params[:type] == "1") #全部 - if User.current.id == params[:id] + if User.current.id.to_i == params[:id].to_i @attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon') and (filename like '%#{search}%') ").order("created_on desc") else @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon') and (filename like '%#{search}%') ").order("created_on desc") end elsif params[:type] == "2" #课程资源 - if User.current.id == params[:id] + if User.current.id.to_i == params[:id].to_i @attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Course' and (filename like '%#{search}%')").order("created_on desc") else @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type = 'Course' and (filename like '%#{search}%') ").order("created_on desc") end elsif params[:type] == "3" #项目资源 - if User.current.id == params[:id] + if User.current.id.to_i == params[:id].to_i @attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Project' and (filename like '%#{search}%')").order("created_on desc") else @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type = 'Project' and (filename like '%#{search}%') ").order("created_on desc") end elsif params[:type] == "4" #附件 - if User.current.id == params[:id] + if User.current.id.to_i == params[:id].to_i @attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Project','Issue','Document','Message','News','StudentWorkScore','HomewCommon') and (filename like '%#{search}%')").order("created_on desc") else @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon') and (filename like '%#{search}%')").order("created_on desc")