From 3efcdfc7dcfec8382f9b14660d41699197bfe577 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 21 Jun 2017 14:43:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=88=91=E5=8F=82=E5=85=A5?= =?UTF-8?q?=E7=9A=84=E5=AE=9E=E8=AE=AD=E6=95=B0=E6=8D=AE=E4=B8=BA=E7=A9=BA?= =?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 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 70e76e31d..dde4c8943 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -658,11 +658,10 @@ class UsersController < ApplicationController # 我发布的实训 def shixuns @type = params[:type] - # 我发布的 if @type == "1" - ids = Shixun.find_by_sql("select id from shixun_members where role=2 and user_id=#{@user.id}") + ids = Shixun.find_by_sql("select shixun_id from shixun_members where role=2 and user_id=#{@user.id}") ids2 = Shixun.find_by_sql("select id from shixuns where id in (select shixun_id from myshixuns where user_id = #{@user.id})") - ids = ids.map{|shixun| shixun.id} unless ids.blank? + ids = ids.map{|shixun| shixun.shixun_id} unless ids.blank? ids2 = ids2.map{|shixun| shixun.id} unless ids2.blank? id = ids + ids2 id = id.uniq