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